Repository navigation
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: f02f94fd5cc67512bfa3db19c786ad888f529724
Assessment: approve
Reviewed the complete six-file delta and affected callers. Reusing the existing typed shuffle kernel preserves vector ownership, allocation, metadata and ordering contracts without adding state or allocations. No actionable blocker remains for this scoped optimization.
Model: gpt-6-astra / xhigh
Session: 01a13dcf-1517-7f90-b3f9-c5f9f9e7031b · slot 0 · generation 1
Validation:
-
Verified the clean frozen head, supplied patch and native-library provenance against 192 matching native input files. Isolation preflight passed.
-
Full vector, batch, hashjoin and hashbuild suites passed. Shuffle compiled and was exercised through vector tests. Focused race/checkptr checks passed for selection copying, metadata, join boundaries, reset/reuse and allocation rejection.
-
Formatting, whitespace, go vet, pinned molint and golangci-lint checks passed. Molint reported only two unchanged baseline test-file notes.
-
Ran 28 baseline/candidate component cases with six counterbalanced pairs each, followed by seven longer controls and two additional nullable controls. Wide selections improved 62.1–76.7%; Decimal128 join projection improved 68.2% for one source and 10.2% for alternating sources. Measured hot paths retained zero allocations.
-
Reconciled commands, source fingerprints, exit receipts, binary hashes and retained logs in /home/xupeng/.local/state/mo-bot/jobs/cddbb1e79aaa008c21b18a13/attempt-1/evidence-audit.json. Audit receipt: checks/1792912150250330791-4.json, exit 0.
Limitations:
-
Longer tiny-input controls measured approximately 0.8–1.1% increases. Nullable timestamp measurements were noisy; a second-core confirmation measured +0.37%. These component results do not establish universal performance improvement.
-
Validation used Linux/amd64 with Go 1.27.1. Frozen relevant CI remained in progress; full BVT, arm64 execution and query-level workload acceptance were not established. The broader linked issues remain open as declared by the PR.
What type of PR is this?
Which issue(s) this PR fixes:
Related to #30838 and #30845. This delivers one shared copy-kernel optimization; both issues remain open for query-level and complete workload acceptance.
What this PR does / why we need it:
Vector.Union/UnionInt32use dynamic-lengthcopyonce per selected wide fixed-width value. A baseline profile of the existing hashjoin projection consumer with Decimal128 payloads attributes 38.68% of samples toruntime.memmove.shuffle.FixedLengthShuffleloop for physical widths 12/16/20/24/32, allowing either int32 or int64 selections. The compiler emits fixed-size assignments.There are no query identifiers, selection-length thresholds, new caches, ownership transfers, configuration or persisted-format changes. Time remains O(selected rows), with the same copied byte count and no additional allocations.
Design and review
See the versioned design. Design and implementation were reviewed using
gpt-6.1-solwithxhighreasoning. The design and code review found no implementation blockers. The final two-offset refinement was also independently reviewed; performance evidence is reported separately below.Production: +40/-5 lines across two files. Tests/benchmarks: +246/-21 lines, extending the existing real hashbuild/probe fixture and adding a four-row independent byte oracle. Design: +98 lines. Review logs and temporary performance probes are not part of the patch.
Validation
Passed locally with Go 1.27.1 on Linux/amd64 and the repository CGo wrapper:
pkg/container/vector,pkg/sql/colexec/hashjoin,pkg/container/batchandpkg/sql/colexec/hashbuild;pkg/vectorize/shufflecompiles and is exercised through vector tests.-race/checkptr checks for both index widths, physical representations, prefix/empty/repeated/reversed selections, borrowed windows, forced self-append growth, metadata, reset/reuse and real hashjoin projection/error paths.553bf39dbb. Its new temporary-DDL changes do not change the tested dependency closure; the final offset refinement is revalidated below on that base.No new SQL semantics or topology are introduced; existing consumer tests cover this boundary. A full BVT, full repository CI and TPC-H SF10/SF100 campaigns have not been claimed as locally passed.
Performance
Linux/amd64, Intel i7-11700, Go 1.27.1, one pinned CPU (6),
GOMAXPROCS=1. Freeze the benchmark sources and binaries, exclude a cold warmup, then run six baseline/candidate pairs serially and adjacent per case, with the same fixed iteration count per pair. The initial matrix kept a fixed within-case order (66 cases each way); the longer independent control confirmation below uses three baseline-first and three candidate-first pairs for each of its eight cases. No own build or UT runs overlap scoring. Baseline production isaeaa273daf; the relevant source and dependency closure is unchanged at the rebased main553bf39dbb. Final candidate source matchesf02f94fd5cc6.All 132 cases retain 0 B/op and 0 allocs/op in the reused-capacity hot path. Copied byte count and output ownership do not change. This is a CPU/copy-dispatch optimization, not a claim of reduced materialized bytes or application-wide peak memory.
Controls and uncertainty: narrow widths, one-row/empty outputs, NULL/constant columns, varlen projections and alternating sources are included. An earlier candidate had repeatable 2–4% NULL-control regressions and was rejected. The final full matrix has positive control median differences up to 1.48%; a separate longer, within-case counterbalanced six-pair run covering every positive control plus the previously suspected Decimal128 NULL control has positive median differences up to 1.25%, with mixed pair signs and no confirmed stable slowdown. The TS nullable control that originally measured +1.48% is +0.16% in that confirmation. Those small differences remain measurement uncertainty; non-significance does not establish universal zero regression. Full workload no-regression acceptance remains open in the linked issues.
The final code keeps the demonstrated wide-copy gain and removes duplicate nullable offset multiplication. No source changes were made between final scoring, UT/race/SCA and this commit.
Longer independent control confirmation: three AB and three BA pairs per case (ns/op)
Complete component measurements: six paired samples per case (ns/op)
V = BenchmarkUnionFixedSelection; J = BenchmarkHashJoinUniqueProjection. Baseline and candidate were run serially and adjacent for each case with cold warmup excluded. This first matrix kept a fixed within-case order (66 cases each way); the separate longer eight-control confirmation counterbalances order within every case. These are component timings, not SQL/query measurements.
Kernel/projection timings are not end-to-end SQL speedups. The remaining multi-source gather/materialization work and full Q1–Q22 acceptance in #30845 remain open.