dongjoon-hyun commented on code in PR #59582:
URL: https://github.com/apache/spark/pull/59582#discussion_r4515193966
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/internal/SQLConf.scala:
##########
@@ -5754,15 +5754,12 @@ object SQLConf {
val ARROW_PYSPARK_UDF_COLUMNAR_INPUT_ENABLED =
buildConf("spark.sql.execution.arrow.pythonUDF.columnarInput.enabled")
- .doc("When true, Arrow-based Python UDFs (pandas UDFs) can accept " +
- "columnar input directly from upstream operators that produce " +
- "Arrow-backed ColumnarBatch (e.g., DataSource V2 connectors), " +
- "bypassing the ColumnarToRow and ArrowWriter conversion. " +
- "This optimization reduces data transfer overhead between " +
- "the JVM and Python worker processes. It keeps the columns that the
UDFs pass " +
- "through until the results of their batch come back from Python, so it
requires " +
- "an upstream operator whose batches stay valid until then, which a
columnar " +
- "reader does not promise.")
+ .doc("When true, Arrow-based Python UDFs (pandas UDFs) accept columnar
input " +
Review Comment:
**1. [Low] The docs of the output batch limits still say that columnar input
ignores them**
This PR removes the `-1` overrides of
`ColumnarArrowPythonWithNamedArgumentRunner`, so the results of Python are now
sliced with columnar input too. But the docs of
`spark.sql.execution.arrow.maxRecordsPerOutputBatch` (L5683-L5684) and
`spark.sql.execution.arrow.maxBytesPerOutputBatch` (L5702-L5703), which
SPARK-60367 updated when it added the overrides, still say that "Arrow Python
UDFs that take columnar input directly ignore this config". Could we drop that
case from both, e.g. "applyInPandasWithState and Arrow Python UDTFs ignore this
config."?
##########
sql/core/src/main/scala/org/apache/spark/sql/execution/python/ArrowEvalPythonExec.scala:
##########
@@ -143,6 +143,7 @@ case class ArrowEvalPythonExec(
output,
output.toStructType,
conf.arrowMaxRecordsPerBatch,
+ conf.arrowMaxBytesPerBatch,
Review Comment:
**2. [Nit] The comment above `supportsColumnar` still explains the
columnar-only output by the release of the input batches**
The comment at L116-L124 says that columnar input avoids the round trip
through ColumnarToRow and ArrowWriter, and that this node outputs only columnar
batches so that the `ColumnarToRowExec` above releases each batch. After this
PR, only the UDF inputs of Arrow-backed batches skip that round trip, the input
batches are released once they are written to Python, and the output batches
are the on-heap vectors that the evaluator reuses, whose `closeIfFreeable` does
nothing. Could we update it?
--
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]