zeruibao commented on code in PR #52391:
URL: https://github.com/apache/spark/pull/52391#discussion_r2396352075


##########
python/pyspark/worker.py:
##########
@@ -2577,11 +2577,17 @@ def read_udfs(pickleSer, infile, eval_type):
             )
             arrow_max_records_per_batch = int(arrow_max_records_per_batch)
 
+            arrow_max_bytes_per_batch = runner_conf.get(
+                "spark.sql.execution.arrow.maxBytesPerBatch", 2**31 - 1
+            )
+            arrow_max_bytes_per_batch = int(arrow_max_bytes_per_batch)
+
             ser = TransformWithStateInPandasSerializer(
                 timezone,
                 safecheck,
                 _assign_cols_by_name,
                 arrow_max_records_per_batch,
+                arrow_max_bytes_per_batch,
                 
int_to_decimal_coercion_enabled=int_to_decimal_coercion_enabled,
             )
         elif eval_type == 
PythonEvalType.SQL_TRANSFORM_WITH_STATE_PANDAS_INIT_STATE_UDF:

Review Comment:
   `SQL_TRANSFORM_WITH_STATE_PANDAS_INIT_STATE_UDF` follows a separate 
execution path. Each Arrow batch contains rows with the same key, which allows 
us to directly convert the batch into a Pandas DataFrame and yield it. Since 
the Arrow batch size is already subject to a byte-size limit, the resulting 
Pandas DataFrame also inherently respects this constraint.



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