allisonwang-db commented on code in PR #52320:
URL: https://github.com/apache/spark/pull/52320#discussion_r2342685695


##########
python/pyspark/sql/pandas/serializers.py:
##########
@@ -218,8 +218,10 @@ def load_stream(self, stream):
                 if i in self.table_arg_offsets:
                     struct = batch.column(i)
                     # Flatten the struct and create a RecordBatch from it
+                    flattened_arrays = struct.flatten()
+                    field_names = [field.name for field in struct.type]
                     flattened_batch = pa.RecordBatch.from_arrays(
-                        struct.flatten(), schema=pa.schema(struct.type)
+                        flattened_arrays, names=field_names

Review Comment:
   Hmm, but why it's working for Spark classic but not Spark Connect? This code 
path should be shared by both.



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

Reply via email to