Yicong-Huang opened a new pull request, #53965:
URL: https://github.com/apache/spark/pull/53965

   ### What changes were proposed in this pull request?
   
   This PR extracts the column reordering logic from 
`ArrowStreamGroupUDFSerializer.dump_stream` into 
`ArrowBatchTransformer.reorder_columns`.
   
   **Changes:**
   
   1. **conversion.py**: Add `ArrowBatchTransformer.reorder_columns(batch, 
target_schema)` - a pure function that reorders a RecordBatch's columns to 
match the target schema's field order.
   
   2. **serializers.py**: Simplify `ArrowStreamGroupUDFSerializer.dump_stream` 
to use the new transformer, removing inline pyarrow code.
   
   ### Why are the changes needed?
   
   This is part of 
[SPARK-55159](https://issues.apache.org/jira/browse/SPARK-55159) to improve the 
composability of Arrow serializers by separating data transformation from 
serialization.
   
   ### Does this PR introduce _any_ user-facing change?
   
   No.
   
   ### How was this patch tested?
   
   Added `ArrowBatchTransformerTests.test_reorder_columns` covering basic 
reordering, struct columns, and empty batch handling.
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   No.
   


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