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: [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]