zhztheplayer commented on code in PR #13707:
URL: https://github.com/apache/gluten/pull/13707#discussion_r4668542910
##########
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:
Is this batch only closed in the task completion listener?
--
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]