Repository navigation
[GLUTEN-13706][VL] Fix pandas UDFs on partitions with more than one batch - #13707
Conversation
|
@FelixYBW @jinchengchenghh @zhztheplayer @zhouyuan This is a regression from #13280, which is in v1.8.0-rc1 but not in v1.7.0. With default settings, a pandas UDF over a partition with more rows than |
|
Thank you @zhouyuan |
| unclaimed = new ColumnarBatch( | ||
| ArrowColumnVectors.wrap(vectors.asJava).toArray[ColumnVector], |
There was a problem hiding this comment.
Is this batch only closed in the task completion listener?
There was a problem hiding this 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.
What changes are proposed in this pull request?
Since #13280,
ColumnarArrowEvalPythonExecfails withCannot retain a released vectoronce a partition sends more than one batch to Python, i.e. has more thanspark.gluten.sql.columnar.maxBatchSizerows (4096 by default). The reader returned every output batch over the same vectors, so closing one batch released the next.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 partitionruns 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 [GLUTEN-13140][VL] Replace ArrowWritableColumnVector with Spark's ArrowColumnVector and ArrowWriter #13280.ColumnarArrowEvalPythonExecSuite: scalar iterator UDFs fail validation, and UDFs that merge or split batches return every row through Spark'sArrowEvalPythonExec.Was this patch authored or co-authored using generative AI tooling?
Yes. Generated-by: Claude Opus.