Repository navigation
feat(statement): support native parameter-set execution - #479
aakash-saravanan-db wants to merge 9 commits into
Conversation
56eb54f to
594171d
Compare
There was a problem hiding this comment.
🔀 Cross-reviewed: two independent reviews (Claude Opus 5.5 · GPT-6.1 Terra), checked by a judge model (Claude Sonnet 5.5).
Verdict: 2 High · 2 Medium · 3 Low · 1 Nit
Looks solid. I found 1 medium and 2 low concerns. Serialization, the zero-based ordinals and the no-replay error handling are well covered by the wiremock tests. The remaining gaps are binding coverage and some edge cases in count decoding.
This overview is Claude Opus 5.5's initial take; some of its points were set aside by the cross-check judge and GPT-6.1 Terra added findings it doesn't mention — see the findings below.
Other findings
- 🟠 High — Disputed by the cross-check judge (it quotes
RequestType::ExecuteStatement,); a human should decide. Original finding: Batch execution still uses the ordinary execute retry policy, which resubmits the POST on 429 and 503 with Retry-After despite the promised no-replay guarantee. Disable HTTP-level retries for parameter-set submissions and test those responses with a one-request assertion. (Found by GPT-6.1 Terra · disputed by the judge) - 🟡 Medium — Async polling and reader-construction errors occur before this batch decoder and retain their original retryable flag, unlike synchronous batch errors, even though the write may already have committed. Apply the batch non-retryable classification to errors from
status,await_result, andfetch_resultas well. (Found by GPT-6.1 Terra · the judge couldn't confirm it) - 🟡 Medium — The new protocol and aggregate-count behavior is only covered by synthetic wiremock responses, so the manually verified warehouse behavior cannot be rerun as a repository regression test. Add an ignored live-warehouse test covering native batch values, atomic failures, and affected counts. (Found by GPT-6.1 Terra · the judge couldn't confirm it)
- ⚪ Nit — The check
batch.schema().fields() != schema.fields()compares nullability and field metadata, so a reader whose advertised (manifest or logical) schema differs only in nullability from the attachment batches would turn a committed batch into a DataLoss error. Compare only the names and data types of the count columns, or add a test where the manifest nullability differs. (Found by Claude Opus 5.5 · the judge couldn't confirm it)
🔀 1 finding considered and dismissed by the judge
- 🟡 Medium
src/statement/spec.rs:257— Native parameter sets are exposed only through Rust and the C ABI; the napi, PyO3 and ADBC wrappers still have no way to snapshot a set, so ADBC bulk binds stil
Judge's evidence:pub fn add_parameter_set(&mut self) -> &mut Self {
|
The latest aggregate-cache finding is fixed in 2aa0924, with an individual reply and a red-before/green-after paged-count regression. The other inline findings now have individual dispositions. The repeated HTTP retry concern retains the previous disposition: the existing execute policy treats 429 and 503 with Retry-After as safe admission retry signals for this API. It does not retry ambiguous transport-read or result-decoding failures. Retrying status or result reads uses the existing statement ID and does not submit another INSERT. No retry-policy change is included. All 1,102 unit tests and 57 execution wire tests pass, and all-target clippy passes with warnings denied. ODBC #510 pins this correction. |
There was a problem hiding this comment.
🔀 Cross-reviewed: two independent reviews (Claude Opus 5.5 · GPT-6.1 Terra), checked by a judge model (Claude Sonnet 5.5).
Verdict: 2 High · 1 Medium · 1 Nit
Looks good: 1 medium and 1 low concern. Count decoding, the no-replay error paths, and the snapshot/reset semantics are careful and well covered by wiremock. The new wire behaviour has no live-warehouse test in the repo.
This overview is Claude Opus 5.5's initial take; GPT-6.1 Terra added findings it doesn't mention — see the findings below.
Other findings
- 🟠 High — Disputed by the cross-check judge (it quotes
let response = self.http_client.execute(request, request_type).await?;); a human should decide. Original finding: Batch POSTs still use the normal execute retry policy, so a 429, a 503 with Retry-After, or a configured retryable 500 resubmits the entire write despite the no-replay guarantee. Dispatch batch POSTs with retries disabled and test these responses through the HTTP client. (Found by GPT-6.1 Terra · disputed by the judge) - ⚪ Nit —
add_parameter_setis exposed onStatementSpecand the C ABI only. The CHANGELOG mentions that scope but nothing says the napi and PyO3 wrappers lack it. State the difference explicitly in the docs, or wire it through the wrappers. (Found by Claude Opus 5.5 · confirmed by the judge) - 🟠 High — Disputed by the cross-check judge (it quotes
error.retryable = false;); a human should decide. Original finding: After submit returns a batch handle, polling and result-materialization transport errors can still escape as retryable even though the write may have committed, inviting callers to submit it again. Apply the batch no-replay error policy to asynchronous status and result failures too. (Found by GPT-6.1 Terra · disputed by the judge)
Signed-off-by: Aakash Saravanan <aakash.saravanan@databricks.com>
Signed-off-by: Aakash Saravanan <aakash.saravanan@databricks.com>
Signed-off-by: Aakash Saravanan <aakash.saravanan@databricks.com>
Signed-off-by: Aakash Saravanan <aakash.saravanan@databricks.com>
2aa0924 to
fe6423e
Compare
|
Rebased onto main. The current revision retains known statement IDs on batch failures and adds an owning-kernel live regression; the open inline findings have individual replies. The CHANGELOG explicitly scopes snapshots to Rust and the C ABI. The HTTP retry finding does not apply to the reachable batch configuration. Session builds its own client in build_retry_configs_for_session; HttpConfig exposes retry budgets and attempt counts, but no override_retryable_codes setting. That field stays at RetryConfig::default() for statement execution, and Session exposes no custom transport/client injection. A configured-500 counterexample against the low-level HTTP client therefore cannot be constructed through StatementSpec batch execution. The existing non-idempotent policy allows safe 429/503-with-Retry-After admission retries and excludes ambiguous read/decode failures. The existing HTTP tests and batch one-POST failure tests cover these boundaries. Async status and result operations use the existing statement ID. Retrying those reads does not resubmit an INSERT; their retry flags retain the same meaning as ordinary asynchronous execution. No retry-policy change is needed. The test audit retained distinct compatibility, count, schema, failure, C ABI and driver-manager boundaries, while combining overlapping fixtures and removing redundant assertions. All 1,110 unit tests and 57 wire tests pass, along with clippy and the named live kernel regression. |
Signed-off-by: Aakash Saravanan <aakash.saravanan@databricks.com>
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 one medium and two low concerns. The wire shape, binding reset and reporting of server limits look correct and are well tested. The main risk is how failures to read the batch's affected-row count are handled after the server has already committed the batch.
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 1 low concern. Wire shape, SQL reset and C ABI plumbing are well tested. The direct-execute path can return an error for a committed batch when reading the optional affected-row count fails.
This overview is Claude Opus 5.5's initial take; GPT-6.1 Sol added findings it doesn't mention — see the findings below.
Signed-off-by: Aakash Saravanan <aakash.saravanan@databricks.com>
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 Low
Looks good overall, with 1 medium concern. Scalar and batch wire separation, zero-based ordinals, reset semantics and the C ABI entry point all look consistent and well tested. The one concern is that in the direct path a failed count read turns a successful batch into an error.
This overview is Claude Opus 5.5's initial take; some of its points were set aside by the cross-check judge and GPT-6.1 Sol added findings it doesn't mention — see the findings below.
🔀 1 finding considered and dismissed by the judge
- 🟡 Medium
src/statement/mutable.rs:684— In theexecute_directCompleted arm, the batch branch passesread_batch_affected_rowserrors up with?, while the scalar branch right below discards count
Judge's evidence:error.retryable = false;
Signed-off-by: Aakash Saravanan <aakash.saravanan@databricks.com>
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 High
Looks good — 1 low concern. The wire shape, SQL-reset semantics, non-retryable failure marking and aggregate counting are consistent across the sync, direct and async paths, with wiremock, C ABI and e2e coverage.
This overview is Claude Opus 5.5's initial take; some of its points were set aside by the cross-check judge and GPT-6.1 Sol added findings it doesn't mention — see the findings below.
🔀 1 finding considered and dismissed by the judge
- 🔵 Low
src/statement/spec.rs:282—add_parameter_setis exposed through Rust and the C ABI, but neither the PyO3 nor the napi wrapper exposes it, so Python and Node hosts can't use native batch
Judge's evidence:pub fn add_parameter_set(&mut self) -> &mut Self {
…ails Signed-off-by: Aakash Saravanan <aakash.saravanan@databricks.com>
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).
✅ No issues identified.
🔀 3 findings considered and dismissed by the judge
- 🟡 Medium
src/statement/mutable.rs:690— Inexecute_direct, the batch branch reads the count withread_batch_affected_rows(...).await?. If that peek fails, a batch the server already committed come
Judge's evidence:error.retryable = false; - 🔵 Low
src/statement/mutable.rs:443— When parameter sets are present,status.num_modified_rowsis always replaced by the batch read, even when the server's status already carries a count. When th
Judge's evidence:if parameter_set_count != 0 { status.num_modified_rows = crate::statement::dml_count::read_batch_affected_rows( - 🔵 Low
src/statement/spec.rs:284—add_parameter_setis exposed through Rust and the C ABI only. The PyO3 and napi wrappers get no equivalent and nothing documents the gap, so binding users can
Judge's evidence:pub fn add_parameter_set(&mut self) -> &mut Self {
Signed-off-by: Aakash Saravanan <aakash.saravanan@databricks.com>
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 Low
Looks solid, with 1 medium and 1 low concern. The wire shape, ordinal rebasing, the SQL reset and marking failures non-retryable are all well tested across the sync, async, direct and C ABI paths. The main gap: in the direct path, a failed count read can turn a batch the server already committed into an error.
This overview is Claude Opus 5.5's initial take; some of its points were set aside by the cross-check judge and GPT-6.1 Sol added findings it doesn't mention — see the findings below.
🔀 2 findings considered and dismissed by the judge
- 🔵 Low
src/c_abi/statement.rs:210—add_parameter_setis exposed through Rust and the C ABI, but the diff adds nothing to the PyO3 or napi wrappers, so Python and JS hosts can't submit native ba
Judge's evidence:stmt.spec().add_parameter_set(); - 🟡 Medium
src/statement/mutable.rs:685— Inexecute_direct's Completed arm, the batch branch propagatesread_batch_affected_rows(...).await?, so a failure peeking the count batch fails the whole ca
Judge's evidence:error.retryable = false;
Feature or gap
Statements can snapshot ordered parameter sets and submit atomic parameterized INSERT batches in one request.
What this PR addresses
Adds
StatementSpec::add_parameter_setandkernel_statement_add_parameter_set, sendsparameter_setsseparately from scalarparameters, and reports aggregate affected counts when available. SQL reset clears snapshots. Server limits propagate without client chunking.Tests and validation
56 execution wire tests pass, along with formatting and warnings-denied Clippy on that target. Live aggregate counts, exact values and atomic failure pass on a DBSQL warehouse.