Commit 81bd16d
committed
[SEA-NodeJS] Sync execute via directResults: fix CREATE, drop close-drives, keep mid-run cancel
The default sync path now calls the kernel's folded directResults `execute()`
(`Connection.executeStatement`), which returns a SINGLE `AsyncStatement` handle.
The session wraps it with the operation backend's existing `asyncStatement` arm —
no arm to feature-detect.
The returned handle always corresponds to a server-owned statement:
- fire-and-forget `CREATE`/`INSERT` commits (the server runs it inline during
the POST) — fixes the prior lazy-execute "CREATE didn't run" bug;
- `close()` is a clean release, never a drive-to-terminal — the eager-handle +
close-drives workaround is gone;
- a long query is cancellable via `op.cancel()` (`asyncStatement.cancel()`)
once the handle is held (~80-300ms), at parity with the Thrift backend;
- errors surface at `executeStatement`, matching Thrift / Python use_kernel.
On the fast path the kernel handle is seeded with the inline result, so the
first fetch/status is served with zero extra round-trips (and is 404-proof — a
terminal handle never polls a released statement). A warehouse that auto-closes
the statement (`state=CLOSED`) after delivering its inline result is handled by
the kernel mapping `CLOSED -> Succeeded`, so this path no longer throws
`OperationStateError(Closed)` on those warehouses.
Requires the kernel folded directResults execute
(databricks/databricks-sql-kernel#136). Regenerated napi router types
(`executeStatement` now returns `AsyncStatement`); fallback package names stay on
the driver's canonical `@databricks/sql-kernel-*`.
Validated e2e (pecotesting) against auto-closing AND non-auto-closing warehouses:
CREATE fire-and-forget commits (12/12 = Thrift parity), fetch-then-close (12/12),
mid-run cancel, close() cheap (~140ms) on an abandoned long query, SELECT 1 p50
179ms vs Thrift 168ms. Unit: SEA suite 247 passing; eslint clean.
Co-authored-by: Isaac
Signed-off-by: Madhavendra Rathore <madhavendra.rathore@databricks.com>1 parent 4b9e16e commit 81bd16d
3 files changed
Lines changed: 53 additions & 38 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
183 | 183 | | |
184 | 184 | | |
185 | 185 | | |
186 | | - | |
187 | | - | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
188 | 198 | | |
189 | | - | |
| 199 | + | |
190 | 200 | | |
191 | | - | |
| 201 | + | |
192 | 202 | | |
193 | | - | |
194 | | - | |
| 203 | + | |
| 204 | + | |
195 | 205 | | |
196 | 206 | | |
197 | 207 | | |
198 | 208 | | |
199 | | - | |
| 209 | + | |
200 | 210 | | |
201 | | - | |
202 | | - | |
203 | | - | |
204 | 211 | | |
205 | 212 | | |
206 | 213 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
210 | 210 | | |
211 | 211 | | |
212 | 212 | | |
213 | | - | |
214 | | - | |
215 | | - | |
216 | | - | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
217 | 217 | | |
218 | 218 | | |
219 | 219 | | |
220 | 220 | | |
221 | 221 | | |
222 | | - | |
| 222 | + | |
| 223 | + | |
223 | 224 | | |
224 | 225 | | |
225 | | - | |
226 | | - | |
227 | | - | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
228 | 232 | | |
229 | 233 | | |
230 | 234 | | |
231 | 235 | | |
232 | 236 | | |
233 | | - | |
234 | | - | |
| 237 | + | |
| 238 | + | |
235 | 239 | | |
236 | 240 | | |
237 | 241 | | |
| |||
0 commit comments