Skip to content

Expose Volume completion through the C ABI, ADBC, NAPI and PyO3 - #513

Open
aakash-saravanan-db wants to merge 3 commits into
aakash-saravanan_data/feat/volume-core-20261130from
aakash-saravanan_data/feat/volume-bindings-20261130
Open

aakash-saravanan-db wants to merge 3 commits into
aakash-saravanan_data/feat/volume-core-20261130from
aakash-saravanan_data/feat/volume-bindings-20261130

Conversation

@aakash-saravanan-db

@aakash-saravanan-db aakash-saravanan-db commented Nov 30, 2026 •

Copy link
Copy Markdown
Collaborator

Description

The Rust core can complete Volume file transfers, but applications using the language bindings also need access to that operation. Expose completion through the C ABI, ADBC, NAPI and PyO3, including the Volume flag, completion outcome, allowed local roots and local filesystem error details. PyO3 also accepts caller-supplied bytes for stream PUT.

ADBC runs the transfer when adbc.databricks.statement.staging_allowed_local_paths is set and keeps the instruction rows readable. execute_update requires that option for a Volume statement; [] is enough for REMOVE. NAPI result handles require their parent AsyncStatement to stay alive until the transfer finishes.

Preserve the core's 15-minute default Volume idle limit when no storage override is set. The C ABI storage-timeout setter uses zero for no limit. NAPI forwards a positive socketTimeoutMs to both the SQL request timeout and the Volume idle limit; zero disables the Volume limit while keeping the SQL request default. PyO3 keeps the 15-minute Volume default when its socket timeout is unset or zero.

Split from #465. This PR is stacked on core PR #512, which supplies the Rust transfer implementation; the diff here contains the binding adapters.

Testing

Source-built local checks pass: the full Rust test suite (1,382 passed, 65 ignored), strict all-target root Clippy, 97 ADBC unit tests, and formatting. C ABI tests verify that zero disables the storage limit and unrelated HTTP overrides preserve the default. The NAPI timeout table verifies omitted, zero and positive values.

The native PyO3 build and pytest run pass 24 tests, including GET, stream PUT and local-file error details; 37 live tests are skipped. The Node native build, generated binding files, typecheck and 160 focused unit tests pass. Go's source-built native suite and tagged vet pass; ODBC's rebuilt unit suite passes 956 tests with one fixture skip.

Additional notes

Merge after the core PR. Once core lands, rebase this branch onto main and retarget this PR. Most kernel CI workflows run only for PRs targeting main, so those checks start after retargeting.

Driver releases require compatible published native packages and corresponding dependency metadata, followed by installed-driver validation. Source pins alone do not select released packages.

@oss-reviewer-bot oss-reviewer-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔀 Cross-reviewed: two independent reviews (Claude Opus 5.5 · GPT-6.1 Sol), checked by a judge model (Claude Sonnet 5.5).

Verdict: 1 Medium · 2 Low · 1 Nit

Looks good: 3 low concerns. The Volume binding adapters are consistent across the C ABI, ADBC and NAPI. Remaining gaps are PyO3 error-kind parity, PyO3 test coverage, and explicit statement close on ADBC error paths.

This overview is Claude Opus 5.5's initial take; GPT-6.1 Sol added findings it doesn't mention — see the findings below.

Other findings

  • ⚪ Nit — The PyO3 error exposes local_os_error and local_path but not the error kind. NAPI and ADBC both expose the kind, so Python callers lose it when raw_os_error is None. Add a local_error_kind attribute. (Found by Claude Opus 5.5 · confirmed by the judge)

Comment thread adbc/src/statement.rs Resolved
Comment thread pyo3/src/result_stream.rs Resolved
Comment thread napi/src/statement.rs
AnyInner::Metadata(stream) => stream,
};
stream
.complete_volume_operation(&options, None)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Medium — The Node socketTimeoutMs option sets only request_timeout, which does not apply to Volume transfers. storage_read_timeout stays None, so a stalled transfer can hang. ADBC and PyO3 set storage_read_timeout in this PR, but napi does not. Set storage_read_timeout from socket_timeout_ms in napi/src/database.rs.

🔀 Found by GPT-6.1 Sol · confirmed by the judge

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Answered on #465 (#465 (comment)): deliberate. Node Thrift's staging requests have no effective timeout, so NAPI sets none. Python Thrift applies its socket timeout to them, so PyO3 does. ADBC has no Thrift backend and applies SocketTimeout to both.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still open at 4c70863: the Node parity reason is fine, but the socketTimeoutMs doc (napi/src/database.rs:456-465) never says Volume transfers get no timeout.

@oss-reviewer-bot oss-reviewer-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔀 Cross-reviewed: two independent reviews (Claude Opus 5.5 · GPT-6.1 Sol), checked by a judge model (Claude Sonnet 5.5).

Verdict: 2 Nit

Looks good, with 2 low-severity concerns, both in the PyO3 binding. The C ABI, ADBC and NAPI adapters wire Volume completion, cancellation and the local error details consistently with the core state, and the tests cover every execution path.

Other findings

  • ⚪ Nit — PyO3 attaches only local_os_error and local_path, not the local error kind that NAPI and ADBC expose. Add a local_error_kind attribute, or document that it is left out on purpose. (Found by Claude Opus 5.5 · confirmed by the judge)
  • ⚪ Nit — input_bytes: Option<Vec<u8>> makes PyO3 extract the bytes one element at a time through the sequence protocol. That is slow for large PUT payloads, and it also accepts any sequence of ints. Take &[u8]/PyBackedBytes (or Bound<PyBytes>) and copy it once into the kernel call. (Found by Claude Opus 5.5 · the judge couldn't confirm it)

…and PyO3

Signed-off-by: Aakash Saravanan <aakash.saravanan@databricks.com>
Signed-off-by: Aakash Saravanan <aakash.saravanan@databricks.com>
…d timeouts

Signed-off-by: Aakash Saravanan <aakash.saravanan@databricks.com>
@aakash-saravanan-db
aakash-saravanan-db force-pushed the aakash-saravanan_data/feat/volume-bindings-20261130 branch from 4c70863 to 3f2b9d8 Compare November 30, 2026 21:09

@oss-reviewer-bot oss-reviewer-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔀 Cross-reviewed: two independent reviews (Claude Opus 5.5 · GPT-6.1 Sol), checked by a judge model (Claude Sonnet 5.5).

Verdict: 1 Medium · 2 Low

Mostly solid, with 1 medium and 2 low concerns. The bindings consistently wire Volume completion, cancellation and local-error details. The main problem is that ADBC's README says SocketTimeout=0 disables the Volume idle limit, but the parser rejects 0.

Comment thread pyo3/src/result_stream.rs
&mut self,
py: Python<'_>,
allowed_paths: Vec<String>,
remove_not_found_is_success: bool,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Low — input_bytes: Option<Vec<u8>> makes PyO3 extract the bytes object as a generic sequence, one element at a time. That is slow for large uploads and also accepts lists of ints. Take Option<Cow<'_, [u8]>> or PyBackedBytes to get a direct buffer copy, and change the same parameter in ExecutedStatement::complete_volume_operation.

🔀 Found by Claude Opus 5.5 · the judge couldn't confirm it

Comment thread adbc/src/config.rs
}
"SocketTimeout" => self.http.request_timeout = duration(value, key, false)?,
"SocketTimeout" => {
let timeout = duration(value, key, false)?;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Medium — SocketTimeout is parsed with duration(value, key, false), which rejects 0. The ADBC README says 0 disables the Volume idle limit, so that setting returns InvalidArguments. Accept 0 and map it to storage_read_timeout = None while keeping the SQL default, as NAPI does, or fix the README. Add a test.

🔀 Found by both reviewers · confirmed by the judge

Comment thread pyo3/src/errors.rs
error_details_json: Option<&str>,
local: Option<&databricks_sql_kernel::kernel_error::LocalFileError>,
) -> PyResult<()> {
bound.setattr("local_os_error", local.and_then(|e| e.raw_os_error))?;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Low — PyO3 exposes local_os_error and local_path but not the local error kind, which NAPI and ADBC both expose. Without it, Python callers on non-OS errors (raw_os_error None) can't tell what failed. Add a local_error_kind attribute so the bindings match, or document why it is left out.

🔀 Found by Claude Opus 5.5 · the judge couldn't confirm it

This branch was previously deployed

1 inactive deployment
azure-prod — 3f2b9d85 Deployed Nov 30, 2026 by oss-reviewer-bot[bot] via followup #4503
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant