Yicong-Huang commented on code in PR #54125:
URL: https://github.com/apache/spark/pull/54125#discussion_r2800826789
##########
python/pyspark/sql/pandas/serializers.py:
##########
@@ -816,17 +626,24 @@ def dump_stream(self, iterator, stream):
"""
import pyarrow as pa
- def create_batches():
- for packed in iterator:
- if len(packed) == 2 and isinstance(packed[1], pa.DataType):
- # single array UDF in a projection
- arrs = [self._create_array(packed[0], packed[1],
self._arrow_cast)]
- else:
- # multiple array UDFs in a projection
- arrs = [self._create_array(t[0], t[1], self._arrow_cast)
for t in packed]
- yield pa.RecordBatch.from_arrays(arrs, ["_%d" % i for i in
range(len(arrs))])
+ def create_batch(
+ packed: Union[
+ Tuple["pa.Array", "pa.DataType"],
+ List[Tuple["pa.Array", "pa.DataType"]],
Review Comment:
Same as above — added a local `normalize` helper so `create_batch` always
receives a list of `(arr, type)` tuples. Unifying the callsites to always
produce the multi-UDF form will be done when we extract the logic to each eval
type.
--
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]