Repository navigation
perf(sql): bound local set/window parallelism and batch hash-join projection - #31998
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: 27db8652dfa710de46c0c96d60aef84ed12e833b
Assessment: request_changes
The new parallel execution topologies require a design review that is not established by the supplied evidence. This is a design-gate finding, not a demonstrated runtime defect.
Model: gpt-6-astra / xhigh
Session: 01a1869d-820c-7212-9788-aecfb86a4141 · slot 0 · generation 2
- P2
pkg/sql/compile/parallel_union_distinct.go:85: The PR introduces multiple local owners for UNION DISTINCT, INTERSECT/EXCEPT and Window, changing compiler/executor ownership, concurrency and threshold allocation.
Impact: These changes trigger the repository's mandatory design-first contract. Implementation approval cannot proceed without a reviewed design covering routing invariants, resource bounds and terminal cleanup for the new topologies.
Evidence: .agents/skills/mo-dev/references/feature-design-review.md sections 1–2 require a versioned design and traceable review decision for these complexity triggers. The existing analytics RFC explicitly excludes new parallel UNION DISTINCT ownership at line 161; the Window hash-partition design covers the existing coordinator flow. The PR and supplied discussion identify no applicable reviewed revision. Extend an existing design with these changes, link its exact revision and record the design decision; a separate RFC is unnecessary.
Validation:
-
Read the complete 17-file delta, both discussion entries, and linked issue #26768 with its two comments. Saved review-plan.md, change-map.json and discussion-assessment.json.
-
Verified clean frozen source, patch identity, complete discussion coverage and that the design contract predates this PR. Static audit passed: checks/1793593773334668414-4.json and review-audit-final.log.
-
Inspected frozen CI metadata: 13 successful, 14 skipped and 2 neutral checks. Skipped checks were not treated as passes.
Limitations:
-
Detailed implementation validation stopped at the mandatory design gate; no local product tests were run.
-
The PR's reported race, public-SQL and performance results were not independently reproduced; local_validation is empty and supporting raw logs were not supplied.
27db865 to
dbbdf2e
Compare
|
Addressed the missing public design/evidence link from this review.
The design can now be reviewed first and implementation review continued within this PR. The prior head's CI Required, UT, SCA, coverage and selected BVT jobs passed; skipped jobs are not counted as passes, and the rebased head will have its own CI results. Re-review is requested through GitHub's review-request API as well. |
|
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: dbbdf2e9cbfb17a939a574c72be972146e5dba52
Assessment: request_changes
The design addendum resolves the previous design-gate finding. Implementation review found no demonstrated runtime defect, but validation of the new parallel execution graphs remains incomplete.
Model: gpt-6-astra / xhigh
Session: 01a1869d-820c-7212-9788-aecfb86a4141 · slot 0 · generation 2
- P2
pkg/sql/compile/parallel_partition_window_test.go:80: Single-CN, non-prepared AP execution with sufficient explicit spill thresholds selects the new parallel Window, UNION DISTINCT and membership graphs.
Impact: The new compiler tests only construct and inspect these graphs. They do not establish runtime result preservation or cancellation/cleanup across the newly connected owners. This is a validation gap, not a demonstrated production failure.
Evidence: The Window test at line 80, distinct_set_merge_test.go:79 and parallel_set_membership_test.go:86 never execute their constructed scopes. Component tests cover individual operators; existing SQL cases and successful multi-CN CI do not establish selection of these local branches. The reported SQL/cancellation runs have no inspectable selections or terminal logs in the supplied evidence; local_validation is empty. Under validation-evidence.md sections 2/4, provide matching records from those existing runs, or run small single-CN cases asserting parallel selection, results against serial controls, and cancellation/error cleanup. No full benchmark rerun is needed.
Validation:
-
Reviewed the complete 17-file delta, affected owners/consumers, all five discussion entries, and linked issue context.
-
Verified the pinned design addendum checksum and recorded design acceptance and discussion dispositions.
-
Inspected frozen CI: 13 successful, 14 skipped and 2 neutral checks; skipped checks were not treated as passes.
-
Static audit passed: review-audit.log and checks/1793603855878591663-5.json confirm frozen head, clean source, patch identity and complete discussion coverage.
Limitations:
- No local product tests or benchmarks were run. Reported public-SQL, cancellation and performance results were not independently verified.
dbbdf2e to
fe9736f
Compare
|
Published the retained execution records requested by this review in an immutable runtime-evidence bundle, also linked from the PR body.
The bundle contains actual output/stack/terminal records, original artifact SHA-256s, binary/source manifests, and 13 passing artifact rechecks. It explicitly distinguishes older executions from current-head tests. The UNION cancellation was synchronized to registration, not active Group computation; the membership cancellation snapshot is EXCEPT, not a separately captured INTERSECT run. No broader phase coverage is claimed. Rebased onto latest main |
|
mo-bot review · Commit: Review discussion changed before publication; a fresh contextual review is queued. |
aunjgr
left a comment
There was a problem hiding this comment.
Design review: PASS for revision 1 (SHA-256 b9918c0abe9918ecbb1f2dc7950ac541936aa3d13acb34f7c37b2e7e00cc8bf7). I independently accept the bounded local-only topology: equality owners preserve the full kernel comparison, Window partitions remain indivisible, fanout is capped, and explicit thresholds are divided rather than treated as hard reservations. Automatic, prepared, and multi-CN paths remain unchanged.
Implementation review at fe9736f: read all changed hunks and traced compiler placement, feeder/receiver ownership, whole-partition Window consumption, canonical tuple hashing, scratch cleanup, vector metadata/admission and scalar fallback. No blocking issue found. I also checked the pinned runtime-evidence index: actual branch selection and result comparison are distinguished from graph-only tests, with the cancellation and measurement limitations stated accurately. Reused the reported package/race/runtime evidence and green exact-head CI; no new local test run.
|
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: fe9736f2617e7c70a597ca97e1c5d83fe0ba9568
Assessment: approve
The reviewed design and inspectable runtime evidence resolve the earlier findings. Full assessment of the implementation and current discussion found no actionable defects.
Model: gpt-6-astra / xhigh
Session: 01a1869d-999c-7481-b340-ae4a63e8cee4 · slot 1 · generation 2
Validation:
-
Covered all 17 changed files and ten discussion entries, reusing review coverage verified against identical source.
-
Fresh audit passed: 56 payload hashes, seven source-hash claims, six UNION results against an independent arithmetic oracle, paired result manifests and terminal samples.
-
Reused pinned runtime, cancellation, package/race and integration-test records. Frozen CI reports 13 successful, 14 skipped and two neutral checks.
-
Discussion coverage, clean source and command/source/exit/log reconciliation passed; evidence is retained in the diagnostic directory.
Limitations:
-
No new Go tests or SQL benchmarks were run; retained executions were assessed through source correspondence and artifact provenance.
-
UNION cancellation covers registration only; no separate INTERSECT cancellation capture is supplied.
-
Large supplementary tuple/frame datasets remain manifest-backed author evidence; stack and budget excerpts were not verified as complete original files.
🚫 Left the queue · pull request branch update failed36 min in the queue, with no time running CI. So far
Reason The pull request can't be updated
Hint You should update or rebase your pull request manually. If you do, this pull request will automatically be requeued once the queue conditions match again. Tick the box to put this pull request back in the merge queue (same as
Times in UTC · dashboard · how the merge queue works |
What type of PR is this?
Which issue(s) this PR fixes:
Related to #26768.
What this PR does / why we need it:
Remove serial execution bottlenecks in eligible local set/window stages and reduce per-row copying overhead in duplicate-key hash joins. This PR contains four commits; it does not change cardinality estimation, join ordering, automatic spill policy, or merge defaults.
Design review
Design addendum, revision 1 and its author design-review record cover routing invariants, bounded fanout/memory, ownership, success/error/cancel/reset cleanup, alternatives and validation. They explicitly extend the earlier analytics RFC scope for this PR; that RFC's older exclusion of parallel UNION DISTINCT is not used as approval of this change. The immutable document SHA-256 is
b9918c0abe9918ecbb1f2dc7950ac541936aa3d13acb34f7c37b2e7e00cc8bf7. Author review is recorded as PASS for this bounded scope; external design/implementation review remains requested in this same PR. Design/evidence files stay outside the implementation diff.Measured benefits
TPC-DS 1 TB, host 129: 64 logical CPUs, approximately 251 GiB RAM, one local CN, 192 GiB cgroup limit, swap disabled, automatic merge disabled for testing. Settings were unchanged between each pair:
max_dop=0,agg_spill_mem=4294967296,join_spill_mem=0,sort_spill_mem=536870912,GOGC=200.These are retained, per-feature on/off comparisons on the same data and settings (October 31–November 1), not a single full-suite comparison against today's main. Q75 and Q51 report the mean of two runs per variant; Q38, Q87 and the Q4 row report individual paired runs. All listed pairs passed output comparison; the Q4 improvement is modest.
With all four commits together, the November 1 full run completed 99/99 query files (103 statements):
The 50-minute result already includes these four commits. It is not a baseline from which their individual savings should be subtracted again. Its source was
defe806fe9d123285449cc8db406c85dcbc31b9a; this PR rebases the same four patches onto87fe4e0c3ac3f9a98b308f8931fd3f8be345b076with all four entries unchanged ingit range-diff.Implementation and safety boundaries
UnionOne.The three new parallel compiler paths require a single coordinator-local CN, non-prepared AP execution and an explicit positive spill threshold. Worker counts respect CPU/session DOP and a 128 MiB-per-owner threshold floor; membership adds an eight-owner ceiling. UNION/Window divide the existing threshold rather than multiplying it. Membership kernels do not gain spill support: their setting only bounds fanout, and shared allocation admission remains authoritative. Automatic mode and unsupported paths retain existing behavior.
The implementation reuses existing Shuffle/Dispatch/Merge/Group/Window/set operators and cancellation protocols. Each feeder has one owner; native hash scratch is mpool-backed and freed on reset/free. Local-only routing metadata is copied on operator duplication and rejected at remote serialization. No persisted or wire-format change is introduced. Parallelism can increase exchange memory: for example Q75's observed RSS peak rose from roughly 26 to 30 GiB while staying within the unchanged limits.
Validation
molintandgolangci-lint: 0 issues.Inspectable runtime evidence, pinned revision now publishes executed UNION physical graphs, active Window/Minus stack blocks, complete paired Q75/Q51/Q38/Q87 outputs, cancellation records, terminal resource ledgers and package-test logs. A 13-check artifact revalidation binds those retained executions to the current routing implementation; source hashes and rebase differences are included. These are October 30–November 1 execution records, not a claimed fresh SQL rerun at the current head. UNION cancellation was checked at query registration; Window and EXCEPT cancellation were checked in active operator phases. Compiler graph-construction tests and multi-CN CI are not presented as proof of local parallel execution.
Raw benchmark records, fixture data, experimental planner changes and the subsequent Q23 unique-projection optimization remain outside this PR.