chaoqin-li1123 commented on code in PR #46306:
URL: https://github.com/apache/spark/pull/46306#discussion_r1585867083
##########
python/pyspark/sql/tests/test_python_streaming_datasource.py:
##########
@@ -136,6 +137,33 @@ def streamWriter(self, schema, overwrite):
return TestDataSource
+ def _get_simple_data_source(self):
Review Comment:
Sounds good.
##########
python/pyspark/sql/tests/test_python_streaming_datasource.py:
##########
@@ -150,6 +178,20 @@ def check_batch(df, batch_id):
q.awaitTermination
self.assertIsNone(q.exception(), "No exception has to be propagated.")
+ def test_simple_stream_reader(self):
+ self.spark.dataSource.register(self._get_simple_data_source())
+ df = self.spark.readStream.format("SimpleDataSource").load()
+
+ def check_batch(df, batch_id):
+ assertDataFrameEqual(df, [Row(batch_id * 2), Row(batch_id * 2 +
1)])
+
+ q = df.writeStream.foreachBatch(check_batch).start()
+ while len(q.recentProgress) < 10:
+ time.sleep(0.2)
+ q.stop()
+ q.awaitTermination
Review Comment:
Nice catch!
--
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]