BryanCutler commented on a change in pull request #24095: [SPARK-27163][PYTHON]
Cleanup and consolidate Pandas UDF functionality
URL: https://github.com/apache/spark/pull/24095#discussion_r266626633
##########
File path: python/pyspark/serializers.py
##########
@@ -352,28 +364,17 @@ def dump_stream(self, iterator, stream):
Make ArrowRecordBatches from Pandas Series and serialize. Input is a
single series or
a list of series accompanied by an optional pyarrow type to coerce the
data to.
"""
- import pyarrow as pa
- writer = None
- try:
- for series in iterator:
- batch = _create_batch(series, self._timezone, self._safecheck,
- self._assign_cols_by_name)
- if writer is None:
- write_int(SpecialLengths.START_ARROW_STREAM, stream)
- writer = pa.RecordBatchStreamWriter(stream, batch.schema)
- writer.write_batch(batch)
- finally:
- if writer is not None:
- writer.close()
+ batches = (_create_batch(series, self._timezone, self._safecheck,
self._assign_cols_by_name)
+ for series in iterator)
Review comment:
The only issue with this is that `createDataFrame` would need to handle
`SpecialLengths.START_ARROW_STREAM` for regular and encrypted options and I'm a
little hesitant to change that. I'll keep an option in
`ArrowStreamPandasSerializer` to not write the start stream for these cases.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]