Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,12 @@ case class InMemoryTableScanExec(

private lazy val columnarBatchSchema = new StructType(columnIndices.map(i => relationSchema(i)))

private def createAndDecompressColumn(cachedColumnarBatch: CachedBatch): ColumnarBatch = {
private def createAndDecompressColumn(
cachedColumnarBatch: CachedBatch,
offHeapColumnVectorEnabled: Boolean): ColumnarBatch = {
val rowCount = cachedColumnarBatch.numRows
val taskContext = Option(TaskContext.get())
val columnVectors = if (!conf.offHeapColumnVectorEnabled || taskContext.isEmpty) {
val columnVectors = if (!offHeapColumnVectorEnabled || taskContext.isEmpty) {
OnHeapColumnVector.allocateColumns(rowCount, columnarBatchSchema)
} else {
OffHeapColumnVector.allocateColumns(rowCount, columnarBatchSchema)
Expand All @@ -101,10 +103,13 @@ case class InMemoryTableScanExec(

private lazy val inputRDD: RDD[InternalRow] = {
val buffers = filteredCachedBatches()
val offHeapColumnVectorEnabled = conf.offHeapColumnVectorEnabled
if (supportsBatch) {
// HACK ALERT: This is actually an RDD[ColumnarBatch].
// We're taking advantage of Scala's type erasure here to pass these batches along.
buffers.map(createAndDecompressColumn).asInstanceOf[RDD[InternalRow]]
buffers
.map(createAndDecompressColumn(_, offHeapColumnVectorEnabled))
.asInstanceOf[RDD[InternalRow]]
} else {
val numOutputRows = longMetric("numOutputRows")

Expand Down