Repository navigation
Run Volume PUT, GET and REMOVE through the kernel backend #613
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
4f92055
14c1e67
ed47e19
4d0f6fd
9705b74
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| a29235cbea9532efa5572ebff010045583a19cbe | ||
| d18b044bdd8d6a3ef7c7dd763a5f38c1532a213f |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -84,7 +84,7 @@ export type KernelOperationStatement = KernelStatementHandle & Partial<KernelSta | |
| * (`KernelResultsProvider` → `ArrowResultConverter` → `ResultSlicer`) consumes | ||
| * either interchangeably. | ||
| */ | ||
| type KernelFetchHandle = Pick<KernelStatement, 'fetchNextBatch' | 'schema'>; | ||
| type KernelFetchHandle = Pick<KernelStatement, 'fetchNextBatch' | 'schema' | 'isVolumeOperation'>; | ||
|
|
||
| /** | ||
| * The rich operation-status surface the kernel exposes on a terminal sync | ||
|
|
@@ -170,6 +170,8 @@ export interface KernelOperationBackendOptions { | |
| id?: string; | ||
| /** Row shape returned by `fetchChunk`; defaults to `'object'`. */ | ||
| rowMode?: RowMode; | ||
| /** Whether the statement ran with Volume options. */ | ||
| volume?: boolean; | ||
| } | ||
|
|
||
| export default class KernelOperationBackend implements IOperationBackend { | ||
|
|
@@ -207,6 +209,8 @@ export default class KernelOperationBackend implements IOperationBackend { | |
|
|
||
| private readonly rowMode?: RowMode; | ||
|
|
||
| private readonly volume: boolean; | ||
|
|
||
| private resultSlicer?: ResultSlicer<any>; | ||
|
|
||
| private resultsProvider?: KernelResultsProvider; | ||
|
|
@@ -236,6 +240,7 @@ export default class KernelOperationBackend implements IOperationBackend { | |
| context, | ||
| id, | ||
| rowMode, | ||
| volume, | ||
| }: KernelOperationBackendOptions) { | ||
| // Exactly one of the three handle kinds must be supplied. | ||
| const providedCount = | ||
|
|
@@ -250,6 +255,7 @@ export default class KernelOperationBackend implements IOperationBackend { | |
| this.asyncStatement = asyncStatement; | ||
| this.cancellableExecution = cancellableExecution; | ||
| this.blockingStatement = statement; | ||
| this.volume = volume ?? false; | ||
| // Lifecycle surface. The async/metadata handles expose both cancel/close. | ||
| // The sync-execute path uses a composite: `cancel()` always routes to the | ||
| // cancellable execution (lock-free, interrupts a running `result()` | ||
|
|
@@ -328,6 +334,9 @@ export default class KernelOperationBackend implements IOperationBackend { | |
| return []; | ||
| } | ||
| try { | ||
| if (await this.transferredVolume()) { | ||
| return []; | ||
| } | ||
| const slicer = await this.getResultSlicer(); | ||
| if (isClosed?.()) { | ||
| return []; | ||
|
|
@@ -338,9 +347,20 @@ export default class KernelOperationBackend implements IOperationBackend { | |
| } | ||
| } | ||
|
|
||
| /** | ||
| * The kernel ran the transfer of a Volume result inside execute. As on | ||
| * Thrift, which reads the instruction row to run it, such a result has no rows. | ||
| */ | ||
| private async transferredVolume(): Promise<boolean> { | ||
| return this.volume && (await this.getFetchHandle()).isVolumeOperation; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔵 Low — The package.json pins still point at native 1.5.0, which ignores 🔀 Found by Claude Opus 5.5 · confirmed by the judge
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same release gate as #613 (comment): the fix is bumping the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Still open at 9705b74: package.json:95-102 still pins every kernel platform at 1.5.0; keeping this open until the pins are bumped. |
||
| } | ||
|
|
||
| public async hasMore(): Promise<boolean> { | ||
| failIfNotActive(this.lifecycle); | ||
| try { | ||
| if (await this.transferredVolume()) { | ||
| return false; | ||
| } | ||
| // `hasMore()` prefetches the next batch, so it fails like `fetchChunk()`. | ||
| const slicer = await this.getResultSlicer(); | ||
| return await slicer.hasMore(); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -146,22 +146,22 @@ export default class KernelSessionBackend implements ISessionBackend { | |
| * - `rowLimit` → `rowLimit` (kernel-only server-side row cap); | ||
| * - `queryTags` → serialised into the conf overlay's reserved | ||
| * `query_tags` key (the same wire shape Thrift's `serializeQueryTags` | ||
| * produces), merged with any explicit `statementConf`. | ||
| * produces), merged with any explicit `statementConf`; | ||
| * - `stagingAllowedLocalPath` → the Volume options, so the kernel runs the | ||
| * file transfer of a Volume PUT, GET or REMOVE inside execute. | ||
| * | ||
| * Still rejected (genuinely unsupported on kernel, rather than silently | ||
| * dropped): `useCloudFetch` (governed by the kernel `ResultConfig`, not a | ||
| * per-statement knob), `useLZ4Compression` (kernel owns result compression), | ||
| * and `stagingAllowedLocalPath` (volume operations). `maxRows` is applied by | ||
| * `useCloudFetch` and `useLZ4Compression` are logged and ignored because the | ||
| * kernel owns result fetching and compression. `maxRows` is applied by | ||
| * the facade at fetch time, so it is intentionally not handled here. | ||
| */ | ||
| public async executeStatement(statement: string, options: ExecuteStatementOptions): Promise<IOperationBackend> { | ||
| this.failIfClosed(); | ||
| const volume = options.stagingAllowedLocalPath !== undefined; | ||
|
|
||
| // Per-statement options the kernel backend doesn't honour are treated as | ||
| // NO-OPs (logged at warn), not errors — so call sites written for the Thrift | ||
| // backend are drop-in on the kernel path. These are perf/format hints the | ||
| // kernel governs internally (useCloudFetch / useLZ4Compression) or a feature | ||
| // it doesn't expose yet (staging); ignoring them cannot change query results. | ||
| // kernel governs internally (useCloudFetch / useLZ4Compression). | ||
| // NB: parameter binding (compound/BINARY) is deliberately NOT no-op'd — a | ||
| // dropped param would silently change results, so it still throws. | ||
| if (options.useCloudFetch !== undefined) { | ||
|
|
@@ -180,15 +180,6 @@ export default class KernelSessionBackend implements ISessionBackend { | |
| 'kernel executeStatement: ignoring per-statement `useLZ4Compression` — result compression is governed by the kernel (no-op on kernel).', | ||
| ); | ||
| } | ||
| if (options.stagingAllowedLocalPath !== undefined) { | ||
| this.context | ||
| .getLogger() | ||
| .log( | ||
| LogLevel.warn, | ||
| 'kernel executeStatement: ignoring `stagingAllowedLocalPath` — volume/staging operations are not yet supported on the kernel backend (no-op).', | ||
| ); | ||
| } | ||
|
|
||
| // `runAsync` selects the kernel execution path. NOTE: this is a kernel- | ||
| // specific use of the option — the Thrift backend hardcodes `runAsync: true` | ||
| // on the wire and never reads `options.runAsync`, so the field is a no-op | ||
|
|
@@ -257,9 +248,14 @@ export default class KernelSessionBackend implements ISessionBackend { | |
| // Feature-detect the arm via a type guard: only the Running `AsyncStatement` | ||
| // exposes `awaitResult`; the terminal `Statement` (Completed arm) does not. | ||
| if (isKernelAsyncStatement(direct)) { | ||
| return new KernelOperationBackend({ asyncStatement: direct, context: this.context, rowMode: options.rowMode }); | ||
| return new KernelOperationBackend({ | ||
| asyncStatement: direct, | ||
| context: this.context, | ||
| rowMode: options.rowMode, | ||
| volume, | ||
| }); | ||
| } | ||
| return new KernelOperationBackend({ statement: direct, context: this.context, rowMode: options.rowMode }); | ||
| return new KernelOperationBackend({ statement: direct, context: this.context, rowMode: options.rowMode, volume }); | ||
| } | ||
|
|
||
| // Async path: submit (`wait_timeout=0s`) returns a pending handle the | ||
|
|
@@ -280,6 +276,7 @@ export default class KernelSessionBackend implements ISessionBackend { | |
| asyncStatement: asyncStatement!, | ||
| context: this.context, | ||
| rowMode: options.rowMode, | ||
| volume, | ||
| }); | ||
| } | ||
|
|
||
|
|
@@ -328,6 +325,16 @@ export default class KernelSessionBackend implements ISessionBackend { | |
| } | ||
| } | ||
|
|
||
| if (options.stagingAllowedLocalPath !== undefined) { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 Medium — The platform packages remain pinned at 1.5.0 while only KERNEL_REV changed. A binding without ExecuteOptions.volume would silently run no transfer, and the old warning was removed. Keep a warning or fail until the binding is detected to support Volume options, or bump the package pins in this PR. 🔀 Found by Claude Opus 5.5 · confirmed by the judge
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same release gate as #613 (comment). databricks/databricks-sql-kernel#520 and #521 are merged (KERNEL_REV now pins d18b044b), but the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Still open at 4d0f6fd: platform package pins are still 1.5.0, and there is no warning or capability check until a kernel release ships. |
||
| execOptions.volume = { | ||
| allowedPaths: Array.isArray(options.stagingAllowedLocalPath) | ||
| ? options.stagingAllowedLocalPath | ||
| : [options.stagingAllowedLocalPath], | ||
| // Node Thrift REMOVE treats a missing object as success. | ||
| removeNotFoundIsSuccess: true, | ||
| }; | ||
| } | ||
|
|
||
| return Object.keys(execOptions).length > 0 ? execOptions : undefined; | ||
| } | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.