Repository navigation
Expose Volume completion through the C ABI, ADBC, NAPI and PyO3 - #513
Conversation
There was a problem hiding this comment.
🔀 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)
| AnyInner::Metadata(stream) => stream, | ||
| }; | ||
| stream | ||
| .complete_volume_operation(&options, None) |
There was a problem hiding this comment.
🟡 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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
06a005a to
0aca707
Compare
f012fcb to
4c70863
Compare
There was a problem hiding this comment.
🔀 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_errorandlocal_path, not the local error kind that NAPI and ADBC expose. Add alocal_error_kindattribute, 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(orBound<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>
4c70863 to
3f2b9d8
Compare
There was a problem hiding this comment.
🔀 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.
| &mut self, | ||
| py: Python<'_>, | ||
| allowed_paths: Vec<String>, | ||
| remove_not_found_is_success: bool, |
There was a problem hiding this comment.
🔵 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
| } | ||
| "SocketTimeout" => self.http.request_timeout = duration(value, key, false)?, | ||
| "SocketTimeout" => { | ||
| let timeout = duration(value, key, false)?; |
There was a problem hiding this comment.
🟡 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
| 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))?; |
There was a problem hiding this comment.
🔵 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
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_pathsis set and keeps the instruction rows readable.execute_updaterequires that option for a Volume statement;[]is enough for REMOVE. NAPI result handles require their parentAsyncStatementto 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
socketTimeoutMsto 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.