zhengruifeng opened a new pull request, #56109:
URL: https://github.com/apache/spark/pull/56109

   ### What changes were proposed in this pull request?
   
   Add `AnalysisException` to the `expected_exceptions` of the `@eventually` 
decorator wrapping `load_event` in `test_listener_events_spark_command`, so the 
polling loop retries while the listener-written table does not yet exist.
   
   ### Why are the changes needed?
   
   [SPARK-54957](https://issues.apache.org/jira/browse/SPARK-54957) replaced a 
blunt `time.sleep(60)` before reading the listener-written tables with 
`@eventually(timeout=60, catch_assertions=True)`. `eventually` only retries 
`AssertionError` by default. `spark.read.table()` on a missing table raises 
`AnalysisException` (`TABLE_OR_VIEW_NOT_FOUND`), which is not in the caught 
set, so the decorator aborts on the first attempt instead of polling for 60 s.
   
   The `onQueryTerminated` callback fires asynchronously after `q.stop()`, so 
the `listener_terminated_events` table is sometimes not yet written when the 
test first reads it. This makes the test flaky; it has failed on the `Build / 
Python-only (master, Python 3.12, MacOS26)` scheduled workflow on:
   
   - 2026-05-23 — 
https://github.com/apache/spark/actions/runs/26346300968/job/77556662680
   - 2026-05-25 — 
https://github.com/apache/spark/actions/runs/26423905857/job/77783724134
   
   Both failed with the same exception at the same line 
(`load_event("terminated_event", "listener_terminated_events")`).
   
   ### Does this PR introduce _any_ user-facing change?
   
   No, test-only change.
   
   ### How was this patch tested?
   
   Existing test 
`pyspark.sql.tests.connect.streaming.test_parity_listener.StreamingListenerParityTests.test_listener_events_spark_command`.
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   Generated-by: Claude Opus 4.7


-- 
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]

Reply via email to