LuciferYang opened a new pull request, #13707:
URL: https://github.com/apache/gluten/pull/13707

   ## What changes are proposed in this pull request?
   
   Since #13280, `ColumnarArrowEvalPythonExec` fails with `Cannot retain a 
released vector` once a partition sends more than one batch to Python, i.e. has 
more than `spark.gluten.sql.columnar.maxBatchSize` rows (4096 by default). The 
reader returned every output batch over the same vectors, so closing one batch 
released the next.
   
   - Each output batch now owns its vectors: the reader moves the buffers out 
of the stream's root without copying. An output batch that never reaches its 
consumer is closed.
   - Scalar iterator UDFs fall back to Spark, as on the Bolt backend. Their 
output batches can differ in size from the input batches, and the 
batch-by-batch join then gives wrong rows: a UDF that merged pairs of batches 
returned 4 of 8 rows.
   
   This reproduces on v1.8.0-rc1 with default settings (a pandas UDF over one 
10,000-row partition), so it should block 1.8.0. Draft #13419 also rewrites 
this reader.
   
   Fixes #13706.
   
   ## How was this patch tested?
   
   - `ArrowEvalPythonExecSuite`: `several batches in one partition` runs a 
pandas UDF over one partition in 16-row batches and checks it produced more 
than one output batch. It fails without the fix on Spark 3.5 and 4.0, and 
passes on the parent of #13280.
   - New `ColumnarArrowEvalPythonExecSuite`: scalar iterator UDFs fail 
validation, and UDFs that merge or split batches return every row through 
Spark's `ArrowEvalPythonExec`.
   
   ## Was this patch authored or co-authored using generative AI tooling?
   
   Yes. Generated-by: Claude Opus.
   


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