Repository navigation
feat(c-abi): wire async submit/poll/cancel + init_logging - #161
Closed
mani-mathur-arch wants to merge 1 commit into
Closed
mani-mathur-arch wants to merge 1 commit into
mani-mathur-arch wants to merge 1 commit into
Conversation
Implement the async statement path over the C ABI, previously a stub returning InvalidArgument: - kernel_statement_submit: submit for async execution, return an ExecutedAsyncStatement-backed handle. - kernel_executed_async_statement_status: poll server-side status, mapping StatementStatus to KernelStatementStatusKind; a Failed status stores the underlying error for kernel_get_last_error while the poll call itself returns Success. - kernel_executed_async_statement_get_result_stream: fetch the result once terminal-succeeded, returned as a new OwnedLazy result-stream variant that owns the ResultStream and drives it one batch per next_batch call, so CloudFetch chunks stream on demand rather than materialising up front (unlike the metadata Owned path). - kernel_executed_async_statement_cancel / _close. This is the path a host driver (Go database/sql) uses to honor caller-side context cancellation/deadlines, giving parity with the Thrift backend's poll + CancelOperation. Also wire crate::logging::init_logging into the C-ABI runtime() funnel: RUST_LOG was a no-op for C-ABI (Go/ODBC) consumers that install no Rust-side subscriber, since they never call the Rust-native init path. Update include/databricks_kernel.h with the four new declarations and correct the stale "deferred in v0" comments. Add null-guard unit tests for each async entry point; the server-driven paths are covered by the e2e/wiremock integration tests. Signed-off-by: Mani Kaustubh Mathur <mani.mathur@databricks.com>
mani-mathur-arch
temporarily deployed
to
azure-prod
July 5, 2026 20:10 — with
GitHub Actions
Inactive
mani-mathur-arch
temporarily deployed
to
azure-prod
July 5, 2026 20:10 — with
GitHub Actions
Inactive
Contributor
Author
|
superseded |
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.
What
Implements the async statement path over the C ABI, which PR #158 left as a stub returning
InvalidArgument. Rust-crate consumers (PyO3/napi) already driveStatement::submit+ExecutedAsyncStatementdirectly; this exposes the same lifecycle to C-ABI consumers (Go'sdatabase/sql, ODBC) that cannot link the Rust crate.New C entry points (declared in
include/databricks_kernel.h):kernel_statement_submit— submit for async execution, returns anExecutedAsyncStatement-backed handle.kernel_executed_async_statement_status— poll server-side status, mappingStatementStatus→KernelStatementStatusKind. AFailedstatus stores the underlying error forkernel_get_last_errorwhile the poll call itself returnsSuccess.kernel_executed_async_statement_get_result_stream— fetch the result once terminal-succeeded, returned as a newOwnedLazyresult-stream variant that owns theResultStreamand drives it one batch pernext_batch, so CloudFetch chunks stream on demand rather than materialising up front (unlike the bounded metadataOwnedpath, which pre-drains).kernel_executed_async_statement_cancel/_close.This is the path a host driver uses to honor caller-side context cancellation/deadlines — the consumer polls status while sleeping between polls (holding no server-side worker thread) and calls
_cancelon the caller's cancel/deadline signal, giving parity with a Thrift backend's poll +CancelOperation.Also wires
crate::logging::init_logginginto the C-ABIruntime()funnel.RUST_LOGwas previously a no-op for C-ABI consumers, since they install no Rust-side subscriber and never reach the Rust-native init path;runtime()is the funnel every async entry point passes through, so initialising there (idempotent via the logging module'sOnceLock) surfacesRUST_LOG=databricks_sql_kernel=debugfor Go/ODBC.Testing
cargo test— 676 lib tests pass, 0 failed.cargo clippy --all-targets -- -D warnings— clean.cargo +stable fmt --all -- --check— clean.InvalidArgument, never a crash/deref); the server-driven happy paths are covered by the existing e2e/wiremock integration tests.next_batch/get_schemasignatures are unchanged, so this is ABI-compatible with the sync path.