Repository navigation
perf: reduce aggregate key retention and preflighted string copies - #31061
Conversation
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
|
mo-bot review · Commit: Review completed. Read the assessment. |
XuPeng-SH
left a comment
There was a problem hiding this comment.
mo-bot review · mo-bot-local · review
Commit: 148af35c5446186a074c56536f301851b12e31a3
Assessment: approve
Reviewed the complete 14-file delta and affected consumers. The design reuses existing aggregate-retention and vector-copy owners, preserves sorted equality keys and preflight admission limits, and demonstrates measurable benefit. No actionable defects remain.
Model: gpt-6-astra / xhigh
Session: 01a13dcf-1517-7f90-b3f9-c5f9f9e7031b · slot 0 · generation 1
Validation:
-
Passed 53 focused tests, 6,399 normal tests across five affected packages, and 10 focused race tests. Incremental gofmt, go vet and diff checks passed.
-
Exact SQL BVT passed normal mo-tester comparison twice: 35/35 statements each, with ISCP readiness and database teardown verified.
-
Public SQL probes passed mixed-key grouping, DISTINCT, prepared reuse and ROLLUP; actual spill was verified at DOP 1/2/4.
-
Independent ABBA SQL comparison: mixed-key median 92.29→77.92 ms; EXPLAIN aggregate memory 142.91→110.29 MiB, not RSS. Plain-key control showed no measured regression.
-
Vector comparison: all-selected publication 2544.5→956.4 ns; sparse control 1351.5→1363 ns, with zero allocations.
-
Verified native provenance and reconciled 24 completed command/source/exit receipts with retained logs. Evidence: /home/xupeng/.local/state/mo-bot/jobs/ebcfee29ce904a5528267747/attempt-1/validation-audit.json and review-notes.json. Source remains unchanged.
Limitations:
-
Author ClickBench/DuckDB raw artifacts were unavailable. Independent Linux synthetic measurements do not verify those specific numbers or full-scale ClickBench performance.
-
Repository-wide CI and golangci-lint/molint were not independently verified; local functional, race, BVT and vet results establish the reviewed scope.
What type of PR is this?
Which issue(s) this PR fixes:
Related to #27665. This is a bounded aggregation improvement; it does not close the ClickBench umbrella issue.
What this PR does / why we need it:
Mixed PAD SPACE grouping currently retains a second copy of every key when only some keys require a distinct equality representation. Q40 therefore retains ten columns for five logical keys. A shared aggregate-retention helper reuses only structurally identical same-ordinal keys, preserves the visible prefix, appends transformed keys, and produces the executor's existing sorted physical-key subset. It is used by GROUP BY, DISTINCT rewriting, and dependent UNION DISTINCT. Complete set-operation equality tuples stay intact.
Preflighted all-selected string publication now reuses the existing contiguous-copy path. It copies only the exact admitted live-byte span within reserved capacity and preserves selection flags for row metadata; sparse, reordered and gapped inputs use the existing fallback. Admission, growth and spill policies are preserved.
Design and measured validation.
Local results on Apple M4 / 16 GiB / macOS arm64, Go 1.27.1, four threads, source-built DuckDB
cc9648d736fd:dae02bbaaaa1DuckDB remains faster: Q40 1M is 18.50 ms; Q34 10M is 160.36 ms. Q34's automatic-spill paired difference is only ~4%, not claimed as a robust SQL latency gain. MO and DuckDB memory limits have different scopes. The 10M fixture projects 18 columns and has no CounterID=62, so positive Q40 evidence uses the full-width 1M fixture. These samples are not a full 100M benchmark.
Validation:
gpt-6.1-sol/xhighdesign gate passed and final overall review approved with zero unresolved material blockers. Reviewed source/test fingerprint:e68a4bf508f9a28c493268e63e5a998254fd384377a70f12f05f88acb943c897; delivered commit:4cc97247f5c9.Normal set-operation merge factories and sparse-span coalescing remain outside this measured change. CI is pending.