fix(athena-driver): propagate query cancellation to Athena via StopQueryExecution#10861
fix(athena-driver): propagate query cancellation to Athena via StopQueryExecution#10861igorlukanin wants to merge 3 commits into
Conversation
|
Claude finished @igorlukanin's task in 2m 49s —— View job Code Review: Athena Query Cancellation
Overall: This is a well-executed PR. The cancellation pattern is applied consistently across all entry points, follows the established Code Quality & CorrectnessStrengths:
Minor observations (non-blocking, left as inline comments):
SecurityNo concerns. PerformanceNet positive. Previously, cancelled/timed-out queries continued running (and billing) on Athena. Now they're stopped promptly. The only added overhead is one TestingThe two integration tests are well-designed:
One scenario not tested: cancellation during SummarySolid, focused change. The inline comments are all non-blocking suggestions. Looks good to merge once CI is green. |
…opQueryExecution, use QueryExecutionState enum
…ypes through outer saveCancelFn
Codecov Report✅ All modified and coverable lines are covered by tests.
Additional details and impacted files@@ Coverage Diff @@
## master #10861 +/- ##
===========================================
- Coverage 78.86% 58.36% -20.50%
===========================================
Files 470 216 -254
Lines 92289 16939 -75350
Branches 3435 3435
===========================================
- Hits 72784 9887 -62897
+ Misses 19003 6550 -12453
Partials 502 502
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Summary
StopQueryExecution, so when Cube cancelled or timed out a query the underlying Athena execution kept running (and billing) on AWS. The driver now participates in Cube's existing cancellation infrastructure viacancelCombinator.query,memory,stream) and each internal helper that issues an Athena query (loadPreAggregationIntoTable,unloadWithSql,unloadWithTable,queryColumnTypes) returns a promise whose.cancelcallsStopQueryExecutionfor the in-flightQueryExecutionId. Thestream()releasecallback (previously a no-op marked with a TODO) now does the same.console.warnand never bubbles back to the caller — the query is already being abandoned.Test plan
packages/cubejs-athena-driver/test/AthenaDriver.test.ts(CI has Athena credentials): one forquery, one forstream. Both kick off a deliberately slow Athena query, call.cancel()on the returned promise, and then pollGetQueryExecutiondirectly to assert Athena ended up inCANCELLED/FAILED(neverSUCCEEDED/RUNNING/QUEUED).yarn tsc --noEmitclean inpackages/cubejs-athena-driver.yarn lintclean inpackages/cubejs-athena-driver.