Repository navigation
perf(thrift): bind scalar readers once per Arrow batch - #602
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>
Keep both Thrift scanner and complex-rendering changelog entries. Co-authored-by: Isaac <no-reply@databricks.com> Signed-off-by: Vu Anh Phung <vu.phung@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>
Signed-off-by: Vu Anh Phung <vu.phung@databricks.com> Co-authored-by: Isaac <no-reply@databricks.com>
Keep the scanner review notes and upstream kernel port changelog entry. 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 Low
Looks good, with one low concern. The per-record reader binding, the bitmap shortcut and the lifecycle handling look correct, and tests cover them well. The one gap is the CHANGELOG: it leaves out one of the user-visible behavior changes.
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 issues. I checked that the bitmap offset matches arrow-go's IsNull, how UnknownNullCount is handled, that each holder's IsNull follows the same top-level validity, the colInfo/holder sizing, and that the sticky error and closed state are correct; the three behavior changes are in CHANGELOG.
Other findings
- ⚪ Nit —
readers := ars.rowValues.readers[:len(destination)]in ScanRow re-slices to a length the check just above already guarantees. The re-slice can be dropped, or kept with a comment saying it is there only to let the compiler skip bounds checks. (Found by Claude Opus 5.5 · the judge disputed it but couldn't back that up, so it's kept)
|
The re-slice is intentional bounds-check-elimination scaffolding from the accepted performance fix, so I’m keeping it unchanged. Go 1.27.3 SSA diagnostics on ce04b64 confirm no check at the reader access (line 230); the preceding length guard still handles mismatched destinations. This comment was generated with GitHub MCP. |
Resolve the main changes by merging (no force-push). 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 findings. Reader binding matches the old per-cell IsNull/decimal/interval logic. The bitmap offset handling matches arrow-go's IsNull. The three behavior changes are tested and recorded in CHANGELOG.
Other findings
- ⚪ Nit — In ScanRow,
readers := ars.rowValues.readers[:len(destination)]is redundant after the exact-length check above it; indexingars.rowValues.readersdirectly (or a plain local alias) would read more clearly. (Found by Claude Opus 5.5 · the judge disputed it but couldn't back that up, so it's kept)
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 issues. Every bound reader returns the same NULLs and values as the holder path it replaces. Each audited holder's IsNull reads the same ArrayData as the bitmap shortcut, the holders keep the bitmap buffers alive after sar.Release, and colInfo is the same length as the holders. The behavior changes are listed in CHANGELOG and have tests.
Other findings
- ⚪ Nit —
readers := ars.rowValues.readers[:len(destination)]repeats a length check that already ran on the line above. If the reslice is there to help the compiler drop bounds checks, add a comment saying so; otherwise indexars.rowValues.readersdirectly. (Found by Claude Opus 5.5 · the judge disputed it but couldn't back that up, so it's kept)
The Thrift catalog-sales profile spends 54.9% of CPU in
ScanRow, including 14.9% in null checks and 2.4% in interval checks. These decisions are invariant within an Arrow record.Bind concrete scalar reads, validity handling and decimal/interval decisions once per record. Only audited holders read the top-level bitmap directly; the row loop indexes a destination-sized reader slice. Overlap: #597 and #605 (merged) are separate; kernel work is #601.
Behavior changes (in CHANGELOG): a closed scanner returns an explicit error, without an ERROR log, instead of stale values; a destination whose column count differs from the Arrow holders errors instead of filling leading columns or NULL-padding; a column-value setup failure is logged once and stops scanning instead of being ignored.
Live medians, main → PR, eight fresh processes per side, rotated ABBA, warmups discarded:
SELECT 1andLIMIT 10000are flat. These runs are from the first reviewed head (9e1dc50). The review fixes keep the gain: per-cell micro versus current main is −23% to −52%, and live CPU ata2159a8matches9e1dc50within A/A noise (catalog total 5.365→5.320 s, boolean 6.815→6.755 s). 15 live checksum cases match main, all 12 guard mutants fail, and lint, unit and race checks pass.Adversarial review: converged after two takeover rounds; no open high findings.
This pull request and its description were written by Isaac.