Yicong-Huang commented on code in PR #58751:
URL: https://github.com/apache/spark/pull/58751#discussion_r4010967174


##########
python/pyspark/sql/conversion.py:
##########
@@ -410,105 +402,168 @@ def convert_column(
                     assign_cols_by_name=assign_cols_by_name,
                     
int_to_decimal_coercion_enabled=int_to_decimal_coercion_enabled,
                     
ignore_unexpected_complex_type_values=ignore_unexpected_complex_type_values,
-                    is_legacy=is_legacy,
+                    use_legacy_error_handling=use_legacy_error_handling,
                 )
                 # Wrap the nested RecordBatch as a single StructArray column
-                return 
ArrowBatchTransformer.wrap_struct(nested_batch).column(0)
+                
converted.append(ArrowBatchTransformer.wrap_struct(nested_batch).column(0))
+            elif isinstance(col, pd.Series):
+                converted.append(
+                    cls._convert_column(
+                        col,
+                        field,
+                        timezone=timezone,
+                        safecheck=safecheck,
+                        arrow_cast=arrow_cast,
+                        prefers_large_types=prefers_large_types,
+                        
int_to_decimal_coercion_enabled=int_to_decimal_coercion_enabled,
+                        
ignore_unexpected_complex_type_values=ignore_unexpected_complex_type_values,
+                        use_legacy_error_handling=use_legacy_error_handling,
+                    )
+                )
+            else:
+                raise PySparkTypeError(
+                    errorClass="UDF_RETURN_TYPE",

Review Comment:
   This is kind of a historical issue in PySpark, many error classes are not 
picked/designed carefully. I also wanted to revise the error class, that to be 
said,  I’d suggest doing that separately in a new PR if possible, to maintain 
no behavioral change for this PR. 



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

Reply via email to