zhengruifeng commented on code in PR #46397: URL: https://github.com/apache/spark/pull/46397#discussion_r1590766241
########## python/pyspark/sql/connect/group.py: ########## @@ -398,11 +398,18 @@ def applyInPandas( ) -> "DataFrame": from pyspark.sql.connect.udf import UserDefinedFunction from pyspark.sql.connect.dataframe import DataFrame + from pyspark.sql.pandas.functions import _validate_pandas_udf # type: ignore[attr-defined] + + evalType = _validate_pandas_udf( + func, + schema, + PythonEvalType.SQL_COGROUPED_MAP_PANDAS_UDF, + ) udf_obj = UserDefinedFunction( Review Comment: PySpark Classic directly uses the `pandas_udf` method which include this check https://github.com/apache/spark/blob/c74f584481d9bcefda7e8ac2a37feb2d61891fe4/python/pyspark/sql/pandas/group_ops.py#L617-L620 while in Spark Connect, it cannot use the output of `pandas_udf` method here and requires a `UserDefinedFunction` object. So I factor the check to a separate method and invoke it here. -- 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: reviews-unsubscr...@spark.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org