Skip to content

Commit 66179fa

Browse files
committed
[SPARK-28418][PYTHON][SQL] Wait for event process in 'test_query_execution_listener_on_collect'
## What changes were proposed in this pull request? It fixes a flaky test: ``` ERROR [0.164s]: test_query_execution_listener_on_collect (pyspark.sql.tests.test_dataframe.QueryExecutionListenerTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/jenkins/python/pyspark/sql/tests/test_dataframe.py", line 758, in test_query_execution_listener_on_collect "The callback from the query execution listener should be called after 'collect'") AssertionError: The callback from the query execution listener should be called after 'collect' ``` Seems it can be failed because the event was somehow delayed but checked first. ## How was this patch tested? Manually. Closes apache#25177 from HyukjinKwon/SPARK-28418. Authored-by: HyukjinKwon <[email protected]> Signed-off-by: HyukjinKwon <[email protected]>
1 parent 2ddeff9 commit 66179fa

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

python/pyspark/sql/tests/test_dataframe.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -750,6 +750,7 @@ def test_query_execution_listener_on_collect(self):
750750
self.spark._jvm.OnSuccessCall.isCalled(),
751751
"The callback from the query execution listener should not be called before 'collect'")
752752
self.spark.sql("SELECT * FROM range(1)").collect()
753+
self.spark.sparkContext._jsc.sc().listenerBus().waitUntilEmpty(10000)
753754
self.assertTrue(
754755
self.spark._jvm.OnSuccessCall.isCalled(),
755756
"The callback from the query execution listener should be called after 'collect'")
@@ -764,6 +765,7 @@ def test_query_execution_listener_on_collect_with_arrow(self):
764765
"The callback from the query execution listener should not be "
765766
"called before 'toPandas'")
766767
self.spark.sql("SELECT * FROM range(1)").toPandas()
768+
self.spark.sparkContext._jsc.sc().listenerBus().waitUntilEmpty(10000)
767769
self.assertTrue(
768770
self.spark._jvm.OnSuccessCall.isCalled(),
769771
"The callback from the query execution listener should be called after 'toPandas'")

0 commit comments

Comments
 (0)