Yicong-Huang commented on code in PR #55613:
URL: https://github.com/apache/spark/pull/55613#discussion_r3185218880
##########
python/pyspark/worker.py:
##########
@@ -3122,6 +3086,87 @@ def func(split_index: int, data:
Iterator[pa.RecordBatch]) -> Iterator[pa.Record
# profiling is not supported for UDF
return func, None, ser, ser
+ if eval_type == PythonEvalType.SQL_SCALAR_PANDAS_UDF:
+ import pandas as pd
+ import pyarrow as pa
+
+ # --- UDF preparation ---
+ udf_infos = []
+ for udf_func, udf_args_offsets, udf_kwargs_offsets, udf_return_type in
udfs:
+ wrapped_func, args_kwargs_offsets = wrap_kwargs_support(
+ udf_func, udf_args_offsets, udf_kwargs_offsets
+ )
+ udf_infos.append((wrapped_func, args_kwargs_offsets,
udf_return_type))
+ col_names = [f"_{i}" for i in range(len(udfs))]
+ return_schema = StructType(
+ [StructField(name, info[2]) for name, info in zip(col_names,
udf_infos)]
Review Comment:
Thanks, applied!
--
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]