aminghadersohi opened a new pull request, #44737: URL: https://github.com/apache/superset/pull/44737
### SUMMARY Keep SQL Lab's Impala cancel/progress loop active while the async operation is pending, not just initialized/running. Honor the persisted stopped/timed-out state as well as early-cancel intent, and let SQL Lab Stop use the worker's live cursor. Before `execute_async` returns, an operation handle is not yet published (and the cursor can still reference a previous `USE` operation). Only read progress logs for RUNNING operations. Ignore logs without a progress match rather than exiting the polling loop via an unbound `progress` variable. ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF Backend-only. Live Apache Impala 4.5.2, impyla 0.24.0, SQLAlchemy 2.0.52: - Before: Run then immediate Stop returns HTTP 200 and the SQL Lab row says stopped, but the pending operation receives no cursor cancel. The server finishes the query after 18.7 seconds, fetching one row. - After: one real cancel RPC while PENDING; server profile says Cancelled, zero rows, SQL Lab stays stopped. Duration is 8.7 seconds because the deliberately injected admission sleep runs for 8 seconds; the 10-second query body never executes. ### TESTING INSTRUCTIONS - `pytest tests/unit_tests/db_engine_specs/test_impala.py tests/unit_tests/db_engine_specs/test_impala_pending.py`: 19 pass; the new regression file has 6 failures / 4 passes before the fix. - Live reproduction: use `SELECT sleep(10000) FROM (SELECT 1 AS x) t` with query option `DEBUG_ACTION=AC_BEFORE_ADMISSION:SLEEP@8000` on a disposable Impala cluster. Pause the client immediately after server submission and before `execute_async` returns; send SQL Lab's Stop request, then release it. Compare the actual operation in `/queries?json` and its query profile. This controls race timing, not cursor states or RPC results. - Verify pending -> initialized -> running -> finished still polls, only running updates progress, and non-progress logs do not abort polling. - Pre-commit (including mypy, pylint and engine-spec metadata validation) passes. ### ADDITIONAL INFORMATION - [ ] Has associated issue: - [ ] Required feature flags: - [ ] Changes UI - [ ] Includes DB Migration - [ ] Introduces new feature or API - [ ] Removes existing feature or API -- 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]
