Repository navigation
Expose caller-driven async statement C ABI - #356
Conversation
There was a problem hiding this comment.
Verdict: 1 Medium
Looks good — the async C ABI wiring is sound (owned result stream avoids the sync path's borrow/UAF concerns, retry-safe stream_taken, consistent null guards, close consumes the handle with Drop as a fire-and-forget backstop). One medium doc-mismatch: the rustdoc on kernel_statement_submit and its section banner still say the async path is "deferred in v0 / skeleton", contradicting the implementation this PR adds.
Addresses: - #4077996477 at src/c_abi/statement.rs:882 Signed-off-by: peco-engineer-bot[bot] <peco-engineer-bot[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Verdict: 2 Low
Solid implementation of the caller-driven async statement C ABI. Ownership and lifecycle are correct: the owned ResultStream is self-contained (so into_raw_result_stream is the right choice and close-ordering is free), the query-id CString is freed on close, the closed-swap drop semantics correctly re-fire cleanup on close failure, and the single-consumption/null guards all check out. Two low-severity notes only: (F1) get_result_stream is non-blocking and needs the caller to poll to terminal first — undocumented in the header; (F2) the one-shot status Cancelled arm drops the SEA extended-status fields the sync path carries. Nit: ExecutedAsyncHandle.stream_taken is a plain bool while the sync ExecutedHandle.stream_taken is an AtomicBool — harmless given same-handle calls aren't concurrency-safe anyway, but worth aligning.
Addresses: - #4078118799 at include/databricks_kernel.h:878 - #4078118801 at src/c_abi/statement.rs:946 Signed-off-by: peco-engineer-bot[bot] <peco-engineer-bot[bot]@users.noreply.github.com>
Addresses: - #4078384352 at src/c_abi/statement.rs:924 Signed-off-by: peco-engineer-bot[bot] <peco-engineer-bot[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Verdict: 1 Medium
Solid, well-tested addition — the async C ABI wiring is sound: null guards, out-param sentinels, catch_ffi panic barriers around the sync prologue/epilogue, single-consumption stream guard, and detached-canceller ownership all look correct, and the wiremock tests cover submit/poll/materialise plus the Failed/Cancelled/non-terminal/double-take paths. One medium maintainability concern: the Cancelled status arm hand-duplicates the extended-status carry-over instead of sharing carry_extended_status, which will drift from the Failed arm if a field is added.
There was a problem hiding this comment.
Verdict: 1 Low
Solid, well-tested PR that un-defers the async statement C ABI. FFI safety is handled correctly (every sync prologue/epilogue is under catch_ffi, out-pointers are pre-written, close consumes the handle on all paths, and the status enum discriminants match the C header 1:1); the wiremock tests cover submit→poll→materialise plus the Failed/Cancelled/pre-terminal/double-take guards. One low-severity test-coverage gap noted inline. Nit (not in diff, so summary-only): the KernelStatementStatusKind header comment at include/databricks_kernel.h:157 still reads "Reserved for the async submit path" — stale now that the path is implemented; the PR updated the sibling handle-typedef comment (line 204) but missed this one.
Signed-off-by: Jay Xiao <jay.xiao@databricks.com>
Addresses: - #4077996477 at src/c_abi/statement.rs:882 Signed-off-by: peco-engineer-bot[bot] <peco-engineer-bot[bot]@users.noreply.github.com>
Addresses: - #4078118799 at include/databricks_kernel.h:878 - #4078118801 at src/c_abi/statement.rs:946 Signed-off-by: peco-engineer-bot[bot] <peco-engineer-bot[bot]@users.noreply.github.com>
Addresses: - #4078194838 at tests/v0_c_abi_canceller_wiremock.rs:82 Signed-off-by: peco-engineer-bot[bot] <peco-engineer-bot[bot]@users.noreply.github.com>
Addresses: - #4078323347 at src/c_abi/statement.rs:1116 - #4078323354 at include/databricks_kernel.h:879 Signed-off-by: peco-engineer-bot[bot] <peco-engineer-bot[bot]@users.noreply.github.com>
Addresses: - #4078384352 at src/c_abi/statement.rs:924 Signed-off-by: peco-engineer-bot[bot] <peco-engineer-bot[bot]@users.noreply.github.com>
Addresses: - #4078447417 at src/c_abi/statement.rs:976 Signed-off-by: peco-engineer-bot[bot] <peco-engineer-bot[bot]@users.noreply.github.com>
Addresses: - #4078534358 at src/c_abi/statement.rs:1045 Signed-off-by: peco-engineer-bot[bot] <peco-engineer-bot[bot]@users.noreply.github.com>
Summary
kernel_statement_submitentry pointTesting
cargo test --lib c_abi::statement::testscargo test --test v0_c_abi_canceller_wiremock async_c_abi_submit_poll_and_materialiseinclude/databricks_kernel.has C11 with warnings as errors