ueshin commented on code in PR #52320: URL: https://github.com/apache/spark/pull/52320#discussion_r2345621649
########## 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: I checked the generated schema from both with pyarrow `15.0.2` and `20.0.0`: ```py print(f"{flattened_batch.schema} <=====> {pa.schema(struct.type)}") ``` and saw from the tests: ``` id: int64 <=====> id: int64 not null ``` or ``` id: int64 <=====> id: int64 ``` Seems like the original schema is more accurate? -- 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