cloud-fan commented on a change in pull request #24696: [SPARK-27832][SQL] 
Don't decompress and create column batch when the task is completed
URL: https://github.com/apache/spark/pull/24696#discussion_r288445659
 
 

 ##########
 File path: 
sql/core/src/main/scala/org/apache/spark/sql/execution/columnar/InMemoryTableScanExec.scala
 ##########
 @@ -98,14 +98,23 @@ case class InMemoryTableScanExec(
     val columnarBatch = new 
ColumnarBatch(columnVectors.asInstanceOf[Array[ColumnVector]])
     columnarBatch.setNumRows(rowCount)
 
-    for (i <- attributes.indices) {
-      ColumnAccessor.decompress(
-        cachedColumnarBatch.buffers(columnIndices(i)),
-        columnarBatch.column(i).asInstanceOf[WritableColumnVector],
-        columnarBatchSchema.fields(i).dataType, rowCount)
+    // Decompress cached batch if the task is not completed, or there is no 
task context.
+    if (taskContext.isEmpty || !taskContext.get.isCompleted) {
 
 Review comment:
   It's still possible that the task completes right after this check. I think 
it's OK to create unnecessary column vectors, as this is a corner case.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to