Repository navigation
perf(kernel): read buffered result batches without a runtime hop - #600
vuanhphung wants to merge 8 commits into
Conversation
Signed-off-by: Vu Anh Phung <vu.phung@databricks.com> Co-authored-by: Isaac <no-reply@databricks.com>
Signed-off-by: Vu Anh Phung <vu.phung@databricks.com> Co-authored-by: Isaac <no-reply@databricks.com>
Signed-off-by: Vu Anh Phung <vu.phung@databricks.com> Co-authored-by: Isaac <no-reply@databricks.com>
Signed-off-by: Vu Anh Phung <vu.phung@databricks.com> Co-authored-by: Isaac <no-reply@databricks.com>
Signed-off-by: Vu Anh Phung <vu.phung@databricks.com> Co-authored-by: Isaac <no-reply@databricks.com>
Signed-off-by: Vu Anh Phung <vu.phung@databricks.com> Co-authored-by: Isaac <no-reply@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 Nit
Looks good, no blocking concerns. The header says try_next_batch leaves the Arrow outputs untouched while the batch is pending, so the fallback is safe, and error eviction and cancellation are unchanged. The new E2E test is already picked up by the nightly TestKernelE2E prefix filter.
Other findings
- ⚪ Nit — The kernelRows type doc (and the "next_batch does the per-batch network/decode work" line) names only kernel_result_stream_next_batch. nextBatch now tries kernel_result_stream_try_next_batch first and uses next_batch only as the blocking fallback. Update the comment to say so. (Found by Claude Opus 5.5 · confirmed by the judge)
Signed-off-by: Vu Anh Phung <vu.phung@databricks.com> Co-authored-by: Isaac <no-reply@databricks.com>
|
Fixed the documentation nit in 207423b: the This comment was generated with GitHub MCP. |
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 Nit
Looks good, no blocking findings. The non-blocking-first nextBatch keeps the existing error, eviction, EOF and import handling, and the tests cover the buffered, pending, error, cancel and close-during-fallback paths. I couldn't confirm that the pinned v1.5.0 bindings header exports try_next_batch, because the header isn't vendored here.
Other findings
- ⚪ Nit — TestKernelRowsTryNextError asserts the kernel's native message text ('try_next_batch: pointers must not be null'), so the test is tied to that upstream wording. Asserting only the code and the
kernel: next_batchwrapper would make it less brittle. (Found by Claude Opus 5.5 · the judge disputed it but couldn't back that up, so it's kept)
|
Keeping the native-message assertion intentionally: it was requested to distinguish the two C APIs. Both return InvalidArgument and the same This comment was generated with GitHub MCP. |
Signed-off-by: Vu Anh Phung <vu.phung@databricks.com> Co-authored-by: Isaac <no-reply@databricks.com>
The kernel result path used a blocking runtime hop even when an Arrow batch was buffered. The boolean profile attributes .27s of 5.37s CPU samples to
nextBatch. Avoiding the hop cuts an 80M-row boolean scan (19,533 batches) by 11.8% live, versus 0.8% A/A drift. The buffered-batch benchmark saves ~28.5µs/batch, predicting ~.56s against the 6.79s main query.Try the non-blocking API first and block only when it reports pending. Both calls retain the existing thread-local error wrapper, eviction, cancellation, Arrow ownership, logging and telemetry. Kernel only; Thrift is untouched. Overlap: #599 adds a separate reset in
nextBatch; #514 changes the Arrow IPC surface.Verification: default/tagged unit suites, 20 native race repetitions, live result/lifecycle tests, typed row-count/multiset checksums, and default lint. Extra tagged-lint/generated-format findings match main. Live query+drain seconds use eight fresh processes per side, rotated ABBA, warmups excluded; p95=p99 at this sample size:
Boolean user/system CPU medians: 5.175/.280s → 4.800/.045s. Double is inconclusive; tiny/wide-query percentage changes are not attributable to this patch (one batch saves tens of µs; 1,132 wide batches predict ~32ms).
Adversarial review: converged after two takeover rounds; requested test fixes verified, with no open high findings.
This pull request and its description were written by Isaac.