xinrong-meng commented on code in PR #41125:
URL: https://github.com/apache/spark/pull/41125#discussion_r1191560291
##########
python/pyspark/sql/udf.py:
##########
@@ -623,25 +623,31 @@ def register(
f = cast("UserDefinedFunctionLike", f)
if f.evalType not in [
PythonEvalType.SQL_BATCHED_UDF,
+ PythonEvalType.SQL_ARROW_BATCHED_UDF,
PythonEvalType.SQL_SCALAR_PANDAS_UDF,
PythonEvalType.SQL_SCALAR_PANDAS_ITER_UDF,
PythonEvalType.SQL_GROUPED_AGG_PANDAS_UDF,
]:
raise PySparkTypeError(
error_class="INVALID_UDF_EVAL_TYPE",
message_parameters={
- "eval_type": "SQL_BATCHED_UDF, SQL_SCALAR_PANDAS_UDF, "
- "SQL_SCALAR_PANDAS_ITER_UDF or
SQL_GROUPED_AGG_PANDAS_UDF"
+ "eval_type": "SQL_BATCHED_UDF, SQL_ARROW_BATCHED_UDF, "
+ "SQL_SCALAR_PANDAS_UDF, SQL_SCALAR_PANDAS_ITER_UDF or "
+ "SQL_GROUPED_AGG_PANDAS_UDF"
},
)
- register_udf = _create_udf(
+ source_udf = _create_udf(
f.func,
returnType=f.returnType,
name=name,
evalType=f.evalType,
deterministic=f.deterministic,
- )._unwrapped # type: ignore[attr-defined]
- return_udf = f
+ )
+ if f.evalType == PythonEvalType.SQL_ARROW_BATCHED_UDF:
+ register_udf = _create_arrow_py_udf(source_udf)._unwrapped
Review Comment:
That line is critical.
--
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]