Repository navigation
fix(cloudfetch): disable via per-statement disposition, not session conf - #225
Merged
Merged
Conversation
Setting `ResultConfig::cloudfetch_enabled = false` made the session unusable: the kernel synthesised a `CAN_CLOUD_DOWNLOAD=false` SEA session conf at CreateSession, which the server accepts at session create but then rejects at the first ExecuteStatement with `[CONFIG_NOT_AVAILABLE] ... SQLSTATE: 42K0I`. SEA has no such session conf. Both the JDBC and Thrift reference drivers control cloud-fetch per request, never via session conf — JDBC's SEA path (`DatabricksSdkClient.getRequest`) picks `disposition = cloudFetch ? INLINE_OR_EXTERNAL_LINKS : INLINE`, and `CAN_CLOUD_DOWNLOAD` appears nowhere in either driver. This change mirrors that: - Thread `cloudfetch_enabled` onto `TransportConfig` (a connection-level setting, read once at `Session::open`). - In `call_execute_api`, select `disposition = INLINE` when disabled, `INLINE_OR_EXTERNAL_LINKS` when enabled. `format` stays `ARROW_STREAM` (the kernel's inline reader consumes Arrow IPC from the response attachment). - Remove the `can_cloud_download` session-conf synthesis in `Session::open` entirely. - Drop `CAN_CLOUD_DOWNLOAD` from the session-conf allowlist so a stray caller-supplied value is filtered out (with a warn) rather than forwarded to the wire where it would poison the session. The result-reader factory already dispatches on what the server returns (attachment -> inline reader), so no reader change is needed. Tests: - New execute-path wiremock tests assert the disposition per `cloudfetch_enabled` (INLINE vs INLINE_OR_EXTERNAL_LINKS); the disabled case is the reproduction that failed before the fix. - Session-path wiremock tests rewritten to assert no `can_cloud_download` ever reaches CreateSession (default, disabled, and stray-user-supplied). - New `filter_session_conf` unit tripwire: `can_cloud_download` is dropped under any casing. Closes #196 Co-authored-by: Isaac Signed-off-by: Vikrant Puppala <vikrant.puppala@databricks.com>
vikrantpuppala
temporarily deployed
to
azure-prod
August 10, 2026 08:52 — with
GitHub Actions
Inactive
vikrantpuppala
temporarily deployed
to
azure-prod
August 10, 2026 08:52 — with
GitHub Actions
Inactive
vikrantpuppala
temporarily deployed
to
azure-prod
August 10, 2026 08:52 — with
GitHub Actions
Inactive
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #196. Setting
ResultConfig::cloudfetch_enabled = falsemade the session unusable: the kernel synthesised aCAN_CLOUD_DOWNLOAD=falseSEA session conf atCreateSession, which the server accepts at session-create but then rejects at the firstExecuteStatementwith[CONFIG_NOT_AVAILABLE] ... SQLSTATE: 42K0I. SEA has no such session conf.Root cause & reference verification
I verified the correct behaviour empirically against the OSS JDBC reference driver (
~/databricks-jdbc) rather than trusting the issue's stated "expected":CAN_CLOUD_DOWNLOAD/can_cloud_downloadappears nowhere in the JDBC (or Thrift) driver source.EnableQueryResultDownloadis documented as "Use EnableQueryResultDownload=0 for JSON inline results with SEA" and drives a per-statementdisposition, not a session conf:DatabricksSdkClient.getRequestsetsdisposition = cloudFetch ? INLINE_OR_EXTERNAL_LINKS : INLINE.setCanDownloadResult).So the kernel was using the wrong wire mechanism entirely.
Fix
Mirror the reference drivers — control cloud-fetch per statement via the SEA
disposition:cloudfetch_enabledontoTransportConfig(a connection-level setting, read once atSession::open).SeaRestTransport::call_execute_api, selectdisposition = INLINEwhen disabled,INLINE_OR_EXTERNAL_LINKSwhen enabled.formatstaysARROW_STREAM(the kernel's inline reader consumes Arrow IPC from the responseattachment).can_cloud_downloadsession-conf synthesis inSession::open.CAN_CLOUD_DOWNLOADfrom the session-conf allowlist, so a stray caller-supplied value is filtered out (with awarn) rather than forwarded to the wire where it would poison the session.The result-reader factory already dispatches on what the server returns (
attachment→ inline reader), so no reader change was needed.Test plan
tests/v0_execute_wiremock.rs):execute_with_cloudfetch_enabled_sends_inline_or_external_links_dispositionexecute_with_cloudfetch_disabled_sends_inline_disposition— this is the reproduction; it assertsdisposition = INLINEand a successful inline result. It failed before the fix (disposition was hardcodedINLINE_OR_EXTERNAL_LINKS) and passes after.tests/v0_session_wiremock.rs) rewritten: the old tests asserted the (bogus)CAN_CLOUD_DOWNLOADsynthesis; they now assert nocan_cloud_downloadever reachesCreateSessionon the default, disabled, and stray-user-supplied paths.filter_session_confunit tripwire (src/config.rs):can_cloud_downloadis dropped under any casing — flips RED if it's re-added to the allowlist.cargo test,cargo clippy --all-targets -- -D warnings, andcargo fmtall clean (run with--no-default-features --features tls-rustlsin this env due to a local OpenSSL 3.x /native-tlslinker mismatch unrelated to this change).Notes
databricks-driver-testCLOUDFETCH-012, a#[should_panic]xfail) lives in a separate repo and will flip RED once this lands, as intended.Closes #196
This pull request and its description were written by Isaac.