Repository navigation
fix(statement): populate affected-row counts on direct completion - #431
Conversation
There was a problem hiding this comment.
Verdict: 1 Low
Looks good: one low-severity concern. The fix calls the same non-consuming DML count reader and uses the same is_none() check as the synchronous execute path (mutable.rs:420-422), and the wiremock test covers SUCCEEDED and CLOSED responses, zero counts, multi-column counters, an existing status count, and a non-counter result. The one issue is how an error from the peek is propagated.
ed7d2e1 to
6806d66
Compare
There was a problem hiding this comment.
Verdict: 1 Low
Looks good overall: one low concern about how errors are handled. The change matches the existing sync execute() path, the SQL-classification check prevents treating a SELECT alias as a DML count, and both new wiremock tests also check that the counter row can still be fetched. A nit: no test covers the case where status.num_modified_rows is already set, which should skip inference.
f62ad30 to
77288a1
Compare
6806d66 to
ccdfe80
Compare
There was a problem hiding this comment.
Verdict: 1 Low
Looks good overall, with one low-severity telemetry-timing concern. The shared completed_statement helper, the buffering and replay of peek errors on all three read paths (next_batch, try_next_batch, OwnedBatchIter), and the separate error policies for execute() vs execute_direct() are consistent, and the wiremock and unit tests cover them well.
7725ab2 to
d69981c
Compare
d69981c to
91ccfd6
Compare
91ccfd6 to
23d4ac8
Compare
23d4ac8 to
1e1081e
Compare
There was a problem hiding this comment.
Verdict: 1 Low
The change looks correct: ResultStream now buffers and replays the peek outcome (batch or error) consistently across next_batch, try_next_batch, into_owned_batches and Drop telemetry, and the shared completed_statement helper keeps each API's error contract. Wiremock tests cover the DML-count, SELECT-alias, server-count and both error policies, plus unit tests for replay. The only finding is a misleading debug log message on the status path.
Signed-off-by: Aakash Saravanan <aakash.saravanan@databricks.com>
Feature or gap
When Node executes DML with
runAsync: falseand the initial response completes the statement,status().numModifiedRowsis unset even though fetching returns the correct counter row. An UPDATE affecting two rows, for example, returns{num_affected_rows: 2}without a status count.What this PR addresses
Reuse the existing non-consuming counter reader when direct execution completes without a status count. Preserve zero counts, server-provided counts, and the fetched counter row. If the optional count read fails, execution still returns its successful handle and fetching reports the read error.
The existing schema-based inference can still interpret a SELECT column named
num_affected_rowsas an affected-row count.Dependencies
None.
Tests and validation
maincommit.Five alternating measured runs per side after one warmup, using warm sessions and consuming results, met the ±10% parity threshold: