Repository navigation
fix(kernel): honor Node.js Arrow compression options #652
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
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 @@ | ||
| 5c3a909771f749174567af074bfe18c24a335f5c | ||
| 4691f70cda81ad2b22c419d876d7aebbdbf878fe |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -144,23 +144,22 @@ export default class KernelSessionBackend implements ISessionBackend { | |
| * never forwarded to the kernel and never applied as a client-side | ||
| * deadline — see the note in `executeStatement`; | ||
| * - `rowLimit` → `rowLimit` (kernel-only server-side row cap); | ||
| * - `useLZ4Compression` → `lz4Compression`, with the client setting as the default; | ||
| * - `queryTags` → serialised into the conf overlay's reserved | ||
| * `query_tags` key (the same wire shape Thrift's `serializeQueryTags` | ||
| * produces), merged with any explicit `statementConf`. | ||
| * | ||
| * 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 | ||
| * the facade at fetch time, so it is intentionally not handled here. | ||
| * The kernel backend logs a warning when a statement supplies `useCloudFetch` | ||
| * or `stagingAllowedLocalPath` and ignores those hints. The session controls | ||
| * CloudFetch through `ResultConfig`. The facade applies `maxRows` at fetch time. | ||
| */ | ||
| public async executeStatement(statement: string, options: ExecuteStatementOptions): Promise<IOperationBackend> { | ||
| this.failIfClosed(); | ||
|
|
||
| // 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 | ||
| // kernel governs internally (useCloudFetch) or a feature | ||
| // it doesn't expose yet (staging); ignoring them cannot change query results. | ||
| // NB: parameter binding (compound/BINARY) is deliberately NOT no-op'd — a | ||
| // dropped param would silently change results, so it still throws. | ||
|
|
@@ -172,14 +171,6 @@ export default class KernelSessionBackend implements ISessionBackend { | |
| 'kernel executeStatement: ignoring per-statement `useCloudFetch` — result fetching is governed by the kernel result configuration (no-op on kernel).', | ||
| ); | ||
| } | ||
| if (options.useLZ4Compression !== undefined) { | ||
| this.context | ||
| .getLogger() | ||
| .log( | ||
| LogLevel.warn, | ||
| 'kernel executeStatement: ignoring per-statement `useLZ4Compression` — result compression is governed by the kernel (no-op on kernel).', | ||
| ); | ||
| } | ||
| if (options.stagingAllowedLocalPath !== undefined) { | ||
| this.context | ||
| .getLogger() | ||
|
|
@@ -224,6 +215,7 @@ export default class KernelSessionBackend implements ISessionBackend { | |
| // execution. So `queryTimeout` is neither forwarded to the kernel nor used as | ||
| // a client-side deadline. | ||
|
|
||
| const execOptions = this.buildExecuteOptions(options); | ||
| if (!runAsync) { | ||
| // DEFAULT — directResults (the Thrift/JDBC model). The kernel's | ||
| // `executeStatementDirect` runs ExecuteStatement with a bounded server | ||
|
|
@@ -234,13 +226,9 @@ export default class KernelSessionBackend implements ISessionBackend { | |
| // query stays cancellable via `op.cancel()` and `close()` is a clean | ||
| // release (no client-side drive-to-terminal). Fire-and-forget DDL/DML | ||
| // commits because the server runs it inline during the POST. | ||
| const execOptions = this.buildExecuteOptions(options); | ||
| let direct: KernelStatement | KernelNativeAsyncStatement; | ||
| try { | ||
| direct = | ||
| execOptions === undefined | ||
| ? await this.connection.executeStatementDirect(statement) | ||
| : await this.connection.executeStatementDirect(statement, execOptions); | ||
| direct = await this.connection.executeStatementDirect(statement, execOptions); | ||
| } catch (err) { | ||
| throw this.logAndMapError('executeStatement', err); | ||
| } | ||
|
|
@@ -264,13 +252,9 @@ export default class KernelSessionBackend implements ISessionBackend { | |
|
|
||
| // Async path: submit (`wait_timeout=0s`) returns a pending handle the | ||
| // backend polls. (`queryTimeout` is a no-op on kernel — see the note above.) | ||
| const execOptions = this.buildExecuteOptions(options); | ||
| let asyncStatement; | ||
| try { | ||
| asyncStatement = | ||
| execOptions === undefined | ||
| ? await this.connection.submitStatement(statement) | ||
| : await this.connection.submitStatement(statement, execOptions); | ||
| asyncStatement = await this.connection.submitStatement(statement, execOptions); | ||
| } catch (err) { | ||
| throw this.logAndMapError('executeStatement', err); | ||
| } | ||
|
|
@@ -283,12 +267,7 @@ export default class KernelSessionBackend implements ISessionBackend { | |
| }); | ||
| } | ||
|
|
||
| /** | ||
| * Translate the public `ExecuteStatementOptions` into the kernel napi | ||
| * `ExecuteOptions`, returning `undefined` when nothing is set so the | ||
| * no-options call shape (`executeStatement(sql)`) is preserved. | ||
| */ | ||
| private buildExecuteOptions(options: ExecuteStatementOptions): KernelNativeExecuteOptions | undefined { | ||
| private buildExecuteOptions(options: ExecuteStatementOptions): KernelNativeExecuteOptions { | ||
| // Positional (`?`) and named (`:name`) parameters are mutually exclusive — | ||
| // the kernel binds one placeholder style per statement. Use the SAME error | ||
| // type and message as the Thrift backend (`ThriftSessionBackend`) so a | ||
|
|
@@ -299,7 +278,9 @@ export default class KernelSessionBackend implements ISessionBackend { | |
| throw new ParameterError('Driver does not support both ordinal and named parameters.'); | ||
| } | ||
|
|
||
| const execOptions: KernelNativeExecuteOptions = {}; | ||
| const execOptions: KernelNativeExecuteOptions = { | ||
| lz4Compression: options.useLZ4Compression ?? this.context.getConfig().useLZ4Compression, | ||
|
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. 🟠 High — The driver now sends 🔀 Found by both reviewers · 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. This is the same open supporting-native-package prerequisite acknowledged above and documented under Dependencies. The PR remains blocked until a supporting package is published and its assigned version is pinned; no version is assigned yet. Kernel PR: databricks/databricks-sql-kernel#511. 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 9fb2352: CHANGELOG.md:5 claims kernel |
||
| }; | ||
| // Raw binding preserves qualified SQL types such as INTERVAL MONTH. | ||
| const rawParams = positionalParams ?? namedParams; | ||
| if (rawParams !== undefined) { | ||
|
|
@@ -328,7 +309,7 @@ export default class KernelSessionBackend implements ISessionBackend { | |
| } | ||
| } | ||
|
|
||
| return Object.keys(execOptions).length > 0 ? execOptions : undefined; | ||
| return execOptions; | ||
| } | ||
|
|
||
| /** Wrap a napi metadata `Statement` (already terminal) as an operation backend. */ | ||
|
|
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟠 High — The backend now always sends
lz4Compression, but the kernel platform packages are still pinned to 1.5.0. Only KERNEL_REV and the type declaration changed, so installed binaries probably ignore the field and the option has no effect. Publish and pin native packages that support it, or document the dependency.🔀 Found by both reviewers · confirmed by the judge
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The supporting native package requirement is documented in this PR’s Dependencies section and linked to kernel PR databricks/databricks-sql-kernel#511. Published 1.5.0 does not provide the opt-out, so this PR remains blocked until a supporting native package is published and the platform package pins are updated to its assigned version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still open at bcdd5a1: platform packages stay pinned to 1.5.0, which doesn't support lz4Compression. Pins need updating once a supporting package is published.