zhengruifeng commented on code in PR #53992:
URL: https://github.com/apache/spark/pull/53992#discussion_r2734629445


##########
python/pyspark/worker.py:
##########
@@ -439,16 +431,19 @@ def verify_result_length(result, length):
             )
         return result
 
+    def to_output_format(result):
+        # Convert Series of dicts/Rows to DataFrame for struct types
+        if isinstance(return_type, StructType):
+            return pd.DataFrame(list(result))
+        return result

Review Comment:
   ```suggestion
       if isinstance(return_type, StructType):
           # Convert Series of dicts/Rows to DataFrame for struct types
           def to_output_format(result):
               return pd.DataFrame(list(result))
       else:
           def to_output_format(result):
               return result
   ```



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