LuciferYang commented on code in PR #13707:
URL: https://github.com/apache/gluten/pull/13707#discussion_r4675111084
##########
backends-velox/src/main/scala/org/apache/spark/api/python/ColumnarArrowEvalPythonExec.scala:
##########
@@ -114,9 +126,14 @@ class ColumnarArrowPythonRunner(
if (reader != null && batchLoaded) {
batchLoaded = reader.loadNextBatch()
if (batchLoaded) {
- val batch = new ColumnarBatch(vectors)
- batch.setNumRows(root.getRowCount)
- batch
+ // The reader loads every batch into the vectors of `root`. Move
the buffers to new
+ // vectors, so that each batch owns its data and closing it
frees only that batch.
+ val numRows = root.getRowCount
+ val vectors =
root.getFieldVectors.asScala.map(ArrowColumnVectors.adopt(_, allocator))
+ unclaimed = new ColumnarBatch(
+ ArrowColumnVectors.wrap(vectors.asJava).toArray[ColumnVector],
Review Comment:
No. On the normal path, `next()` clears `unclaimed`, and `doExecuteColumnar`
puts the batch's columns into the joined batch. `recyclePayload(_.close())`
closes the joined batch, and with it these columns, the next time the consumer
calls `hasNext()`. The listener only handles a batch that `hasNext()` read
ahead but `next()` never returned, which can only happen if the task stops
between the two calls, e.g. on failure.
--
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]