HyukjinKwon commented on code in PR #46002:
URL: https://github.com/apache/spark/pull/46002#discussion_r1562000962


##########
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:
   Could we remove `print` in the test?



-- 
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: reviews-unsubscr...@spark.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to