peter-toth commented on code in PR #60444:
URL: https://github.com/apache/spark/pull/60444#discussion_r4566204246


##########
sql/core/src/main/scala/org/apache/spark/sql/execution/ColumnarEvaluatorFactory.scala:
##########
@@ -99,7 +98,7 @@ class RowToColumnarEvaluatorFactory(
           var rowCount = 0
           while (rowCount < numRows && rowIterator.hasNext) {
             val row = rowIterator.next()
-            converters.convert(row, vectors.toArray)
+            converters.convert(row, vectors)

Review Comment:
   **Finding 1.** 
`ColumnarArrowEvalPythonEvaluatorFactory.rowsToColumnarBatches` has the same 
per-row copy 
(`sql/core/src/main/scala/org/apache/spark/sql/execution/python/ColumnarArrowEvalPythonEvaluatorFactory.scala:159`
 and `:174`). It keeps the vectors in a `Seq` and calls 
`converters.convert(row, vectors.toArray)` for every row it converts back into 
a `ColumnarBatch`. The same change applies there:
   
   ```scala
       val vectors: Array[WritableColumnVector] = OnHeapColumnVector
         .allocateColumns(initialCapacity, outputSchema).toArray
       ...
             converters.convert(row, vectors)
   ```
   
   It also needs `WritableColumnVector` in the `vectorized` import. I compiled 
`sql/core` with this change.
   



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to