grundprinzip commented on code in PR #46002:
URL: https://github.com/apache/spark/pull/46002#discussion_r1562001832
##########
python/pyspark/sql/tests/connect/streaming/test_parity_foreach_batch.py:
##########
@@ -30,33 +30,73 @@ def
test_streaming_foreach_batch_propagates_python_errors(self):
def test_streaming_foreach_batch_graceful_stop(self):
super().test_streaming_foreach_batch_graceful_stop()
+ def test_nested_dataframes(self):
+ def curried_function(df):
+ def inner(batch_df, batch_id):
+ df.createOrReplaceTempView("updates")
+ batch_df.createOrReplaceTempView("batch_updates")
+
+ return inner
+
+ try:
+ df =
self.spark.readStream.format("text").load("python/test_support/sql/streaming")
+ other_df = self.spark.range(100)
+ q = df.writeStream.foreachBatch(curried_function(other_df)).start()
+ q.processAllAvailable()
+ collected = self.spark.sql("select * from batch_updates").collect()
+ self.assertTrue(len(collected), 2)
+ self.assertEqual(100, self.spark.sql("select * from
updates").count())
+ finally:
+ if q:
+ q.stop()
+
+ def test_pickling_error(self):
+ class NoPickle:
+ def __reduce__(self):
+ raise ValueError("No pickle")
+
+ no_pickle = NoPickle()
+
+ def func(df, _):
+ print(no_pickle)
Review Comment:
The print is never called because it fails serializing the object.
--
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]