Skip to content

cloudfetch_enabled=false sends INLINE disposition with ARROW_STREAM format; SEA rejects (must be JSON_ARRAY) — regression from #225 #238

Closed as not planned

Description

@eric-wang-1990

Summary

When ResultConfig::cloudfetch_enabled = false, the SEA ExecuteStatement request sends disposition = "INLINE" with format = "ARROW_STREAM". The Databricks SEA server rejects this combination:

HTTP 400: Incompatible parameters: The format field must be JSON_ARRAY when the disposition field is INLINE.
  error_code: INVALID_PARAMETER_VALUE

So cloudfetch_enabled = false is currently unusable on SEA — any query issued with CloudFetch disabled fails at ExecuteStatement.

This is a regression introduced by #225 (fix(cloudfetch): disable via per-statement disposition, not session conf, commit 106fb55). #225 correctly removed the old CAN_CLOUD_DOWNLOAD session-conf approach (which #196 flagged), but the replacement INLINE disposition it now sends is paired with the wrong format.

Root cause

src/client/sea.rs call_execute_api (origin/main @ 93bf97f):

// line 461
let disposition = if self.config.cloudfetch_enabled {
    "INLINE_OR_EXTERNAL_LINKS"
} else {
    "INLINE"
};
let request_body = ExecuteStatementRequest {
    ...
    disposition: disposition.to_string(),
    format: "ARROW_STREAM".to_string(),   // line 473 — always ARROW_STREAM
    ...
};

The format field is hardcoded to ARROW_STREAM for both dispositions. The server accepts ARROW_STREAM with INLINE_OR_EXTERNAL_LINKS (the CloudFetch-enabled path, which works), but requires JSON_ARRAY when the disposition is bare INLINE.

The in-code comment (sea.rs:451-455) states the intent to keep Arrow:

// `INLINE`: the server serves every result inline (Arrow bytes in
// the response `attachment`), regardless of size. `format` stays
// `ARROW_STREAM` — the kernel's inline reader consumes Arrow IPC
// from the attachment (the SEA inline-Arrow path), so unlike JDBC
// we keep Arrow rather than switching to `JSON_ARRAY`.

— but the server does not support INLINE + ARROW_STREAM, so this intent doesn't hold in practice.

The tension (why this isn't a one-line fix)

The kernel's inline reader consumes Arrow IPC from the response attachment (src/reader/mod.rs inline-Arrow path; inline_arrow_data: result.attachment). Simply switching to format = "JSON_ARRAY" for the INLINE disposition would satisfy the server but the inline reader would then receive JSON rather than Arrow and break.

So a correct fix needs one of:

  1. Server support for INLINE + ARROW_STREAM (if the inline-Arrow disposition is meant to be reachable that way), or
  2. The kernel sending a disposition/format pair the server accepts AND the reader can parse — e.g. the INLINE_OR_EXTERNAL_LINKS + ARROW_STREAM pair that already works, but constrained so results come back inline (no external links). The reference JDBC driver switches to JSON_ARRAY for INLINE; the kernel would need its reader to handle that, or a different mechanism to force inline-only while keeping Arrow.

Maintainers should decide the intended contract; this issue is to flag that the current combination is rejected by the server.

Reproduce

Against a Databricks SQL warehouse (SEA), with a kernel built from main (@ 93bf97f):

let mut rc = databricks_sql_kernel::ResultConfig::default();
rc.cloudfetch_enabled = false;
let session = /* open session with rc */;
// any query:
session.execute("SELECT 1 AS value").await
// -> Err: HTTP 400 "The format field must be JSON_ARRAY when the disposition
//         field is INLINE" (INVALID_PARAMETER_VALUE)

Observed in the databricks-driver-test kernel nightly (CLOUDFETCH-012, test_cloud_fetch_disabled_configuration), on both the dbsql and Reyden warehouses — it is not warehouse-specific. The nightly began failing 2026-07-26, immediately after #225 merged (was green through 2026-07-25).

Impact

cloudfetch_enabled = false cannot be used on SEA — the feature is currently non-functional. Any consumer disabling CloudFetch (e.g. to force inline delivery or to sidestep CloudFetch download issues) gets a hard 400 on the first statement.

Related

Activity

  1. eric-wang-1990 commented on Aug 11, 2026

    @eric-wang-1990
    CollaboratorAuthor

    Additional analysis on the fix direction — the naive "switch to JSON_ARRAY" is not viable, and the sibling ADBC driver avoids this entirely.

    The kernel has no JSON_ARRAY processor

    src/statement/spec.rs ResultFormat supports only Arrow:

    /// v0 supports `Arrow` only. The enum is `#[non_exhaustive]` so v1+ can add
    /// columnar Thrift, JSON rows, etc. without breaking wrappers. Passing a
    /// non-Arrow variant at execute time returns `ErrorCode::InvalidArgument`.
    #[non_exhaustive]
    pub enum ResultFormat { #[default] Arrow }

    Every result-decode path is Arrow-only — parse_arrow_ipc → arrow_ipc::reader::StreamReader for both CloudFetch chunks and the inline attachment (types/sea.rs:242 "Inline Arrow IPC data"). There is no JSON row decoder in src/reader/.

    So satisfying the server by sending format = "JSON_ARRAY" with the INLINE disposition would just move the failure from the request side to the read side — the kernel would have no way to parse the JSON_ARRAY response body. JSON support is explicitly a future (v1+) capability.

    How the ADBC C# driver avoids this

    The reference ADBC driver (adbc-drivers/databricks, csharp/src/StatementExecution/) does not hit this:

    • Its UseCloudFetch option on the SEA path is accepted but ignored (StatementExecutionStatement.cs:258 — "accept but ignore for now"), so there is no auto-flip to a bare INLINE disposition.
    • result_disposition and result_format are independent connection properties, defaulting to INLINE_OR_EXTERNAL_LINKS + ARROW_STREAM — the pairing the server accepts. Inline delivery of small results happens naturally through INLINE_OR_EXTERNAL_LINKS (the server returns the result inline when it fits), never through bare INLINE.
    • Its inline reader (InlineArrowStreamReader) is also Arrow-only, so ADBC would have the same read-side problem if it ever sent INLINE + JSON_ARRAY.

    Practical fix options

    1. Server-side: make SEA accept INLINE + ARROW_STREAM (the pairing the kernel wants for the inline-Arrow path), or
    2. Kernel-side: don't force bare INLINE for cloudfetch-disable. Keep INLINE_OR_EXTERNAL_LINKS + ARROW_STREAM (already valid and Arrow-parseable) and rely on the server returning small results inline — mirroring how ADBC delivers inline results without a dedicated disable toggle. If a hard "never use external links" guarantee is required, that likely needs a server-supported disposition that pairs with ARROW_STREAM.

    Investigated from databricks-driver-test while triaging the kernel Reyden/dbsql nightly (CLOUDFETCH-012). Kernel main @ 93bf97f; ADBC main @ ae4c228.

  2. github-actions commented on Sep 11, 2026

    @github-actions

    This issue has been marked as Stale because it has been open for 30 days with no activity. If you would like the issue to remain open, please remove the stale label or comment on the issue.

  3. github-actions commented on Sep 18, 2026

    @github-actions

    This issue was closed because it has been inactive for 7 days since being marked as stale.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions