Skip to content

Commit fe9f2e0

Browse files
HyukjinKwonRaphaël Luta
authored andcommitted
[SPARK-28418][PYTHON][SQL] Wait for event process in 'test_query_execution_listener_on_collect'
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. Manually. Closes apache#25177 from HyukjinKwon/SPARK-28418. Authored-by: HyukjinKwon <[email protected]> Signed-off-by: HyukjinKwon <[email protected]> (cherry picked from commit 66179fa) Signed-off-by: HyukjinKwon <[email protected]>
1 parent 5bb1d06 commit fe9f2e0

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

python/pyspark/sql/tests.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3707,6 +3707,7 @@ def test_query_execution_listener_on_collect(self):
37073707
self.spark._jvm.OnSuccessCall.isCalled(),
37083708
"The callback from the query execution listener should not be called before 'collect'")
37093709
self.spark.sql("SELECT * FROM range(1)").collect()
3710+
self.spark.sparkContext._jsc.sc().listenerBus().waitUntilEmpty(10000)
37103711
self.assertTrue(
37113712
self.spark._jvm.OnSuccessCall.isCalled(),
37123713
"The callback from the query execution listener should be called after 'collect'")
@@ -3721,6 +3722,7 @@ def test_query_execution_listener_on_collect_with_arrow(self):
37213722
"The callback from the query execution listener should not be "
37223723
"called before 'toPandas'")
37233724
self.spark.sql("SELECT * FROM range(1)").toPandas()
3725+
self.spark.sparkContext._jsc.sc().listenerBus().waitUntilEmpty(10000)
37243726
self.assertTrue(
37253727
self.spark._jvm.OnSuccessCall.isCalled(),
37263728
"The callback from the query execution listener should be called after 'toPandas'")

0 commit comments

Comments
 (0)