You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "ueshin (via GitHub)" <gi...@apache.org> on 2023/07/07 17:57:52 UTC

[GitHub] [spark] ueshin commented on a diff in pull request #41867: [SPARK-43964][SQL][PYTHON] Support arrow-optimized Python UDTFs

ueshin commented on code in PR #41867:
URL: https://github.com/apache/spark/pull/41867#discussion_r1256223855


##########
python/pyspark/sql/pandas/serializers.py:
##########
@@ -388,13 +388,7 @@ def _create_batch(self, series):
 
         arrs = []
         for s, t in series:
-            if self._struct_in_pandas == "dict" and t is not None and pa.types.is_struct(t):
-                if not isinstance(s, pd.DataFrame):
-                    raise PySparkValueError(
-                        "A field of type StructType expects a pandas.DataFrame, "
-                        "but got: %s" % str(type(s))
-                    )
-
+            if t is not None and pa.types.is_struct(t) and isinstance(s, pd.DataFrame):

Review Comment:
   The changes cause a breaking change on Pandas UDF.
   
   Pandas UDF should return `pd.DataFrame` when the return type is a struct type.
   If it returns a `pd.Series`, it should fail with the error: `A field of type StructType expects a pandas.DataFrame`, but the changes make it allowed.



-- 
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-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org