Commit b4ab849
committed
feat(sea): execute statements asynchronously (submit + poll) for Thrift parity
The SEA backend's executeStatement used the blocking napi executeStatement
(kernel polled to terminal internally), so SeaOperationBackend.status()
synthesized a constant FINISHED and a long-running query could not be
cancelled from JS until it returned. The Thrift backend always runs
async (runAsync: true): it submits, gets a pending operation handle, and
polls getOperationStatus to terminal during waitUntilReady.
This brings the SEA path to the same model:
- SeaSessionBackend.executeStatement now calls the napi submitStatement
(kernel wait_timeout=0s), receiving a pending AsyncStatement handle.
Metadata methods keep the blocking statement path (already terminal).
- SeaOperationBackend supports both shapes: for the async path,
waitUntilReady() polls status() to terminal (firing the progress
callback each tick, like the Thrift getOperationStatus loop), then
materialises the result stream via awaitResult(); status() reports the
real Pending/Running/Succeeded/Failed state; a Failed statement surfaces
the kernel's typed SQL-error envelope via awaitResult()'s rejection.
- The JS-side poll loop (not a single blocking awaitResult) keeps cancel()
responsive: the kernel AsyncStatement serialises its methods behind one
mutex, so a single in-flight awaitResult() would queue cancel() behind
it for the whole query; polling status() releases the mutex between ticks.
- SeaNativeLoader gains the typed async surface (submitStatement,
SeaNativeAsyncStatement, SeaNativeAsyncResultHandle, SeaNativeStatementStatus).
Co-authored-by: Isaac
Signed-off-by: Madhavendra Rathore <madhavendra.rathore@databricks.com>1 parent 3f1d903 commit b4ab849
7 files changed
Lines changed: 1090 additions & 129 deletions
File tree
- lib/sea
- native/sea
- tests/unit/sea
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
67 | 110 | | |
68 | 111 | | |
69 | 112 | | |
| |||
118 | 161 | | |
119 | 162 | | |
120 | 163 | | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
121 | 176 | | |
122 | 177 | | |
123 | 178 | | |
| |||
0 commit comments