HyukjinKwon commented on a change in pull request #24734:
[SPARK-27870][SQL][PySpark] Flush batch timely for pandas UDF (for improving
pandas UDFs pipeline)
URL: https://github.com/apache/spark/pull/24734#discussion_r291797082
##########
File path: python/pyspark/tests/test_serializers.py
##########
@@ -225,6 +225,16 @@ def test_chunked_stream(self):
# ends with a -1
self.assertEqual(dest.buffer[-4:], write_int(-1))
+ def test_chunked_stream_flush(self):
+ wrapped = ByteArrayOutput()
+ stream = serializers.ChunkedStream(wrapped, 10)
+ stream.write(bytearray([0]))
+ self.assertEqual(len(wrapped.buffer), 0, "small write should be
buffered")
+ stream.flush()
+ # Expect buffer size 4 bytes + buffer data 1 byte.
+ self.assertEqual(len(wrapped.buffer), 5, "flush should work")
+ stream.close()
Review comment:
try / finally
----------------------------------------------------------------
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]