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? |
|
Independent GPT-6 (medium-effort) review of current PR head Conclusion: REQUEST_CHANGES (GitHub cannot create a formal request-changes review from the PR author account, so this is recorded as a comment).
Please also link the approved design/validation document in the PR body (this is a >500 production-LOC hot-path/state-representation change), and update the claimed evidence after these fixes. |
|
修复已推送( 根因:固定宽度 修复:
本地最终验证:
两组均通过。 |
|
Follow-up closure (e49b831, rebased on the latest PR branch):
Validation on the rebased tree:
No CI wait was used. |
|
Rebased the PR branch onto the latest The previous failed run
Therefore no unrelated snapshot/CI workaround was added to this PR. Rebased-head local validation remains: All passed. The aggexec changes and boundary/mixed-representation regression tests are unchanged in behavior; only the base was refreshed. |
|
Final re-review on rebased head APPROVE (advisory; author account cannot submit a formal approval). GPT-6 re-checked the complete fixed-width DISTINCT change, including fixed/legacy admission, both merge directions, spill/serialization, BulkFill chunking, bounded probing, and allocation boundaries. No reproducible blocker belonging to this PR was found; The previous failed run was unrelated to this change: UT Coverage failed in unchanged SNAPSHOT issue tests, pessimistic BVT completed SQL execution but failed finalizing a coverage artifact (403, then duplicate-artifact 409), and the aggregate coverage job was correctly blocked by missing producer profiles. The rebased-head CI run is allowed to proceed independently; no test skip/retry workaround or unrelated product-code change was added. |
XuPeng-SH
left a comment
There was a problem hiding this comment.
GPT-6 Astra, medium-effort review of ecaaf64176cb2e2f1edc818c991f63b4cef9869f, against base/merge-base 9f87b6249889107c3c108c133a4c3c8f3bc273ee.
Recommendation: REQUEST_CHANGES — mandatory design evidence is still missing. This is a normal COMMENT because this is XuPeng-SH's own PR.
The remaining blocker is the design gate already raised in the earlier review. This change replaces the authoritative saved-argument representation with an open-addressed membership table and per-group log, adds a retained preflight/publication plan, and changes merge, spill and allocation fallback behavior. It is a core-state/hot-path refactor, well above the 500-production-line trigger. The repository's design-review contract at this head explicitly says: “The implementation PR must link the exact reviewed revision”. The current PR body, review/comment history and #27672 provide implementation/performance evidence, but no such design revision and approval record. docs/design/exact_distinct_key_local_prededup.md covers #27790's planner/shuffle topology and explicitly introduces no new aggregate state; it does not cover this representation change.
Please link the reviewed design revision and its approval, covering representation eligibility (including the other DISTINCT aggregates that share aggExec), exact key/type identity, admission and fallback, merge/serialization compatibility, retained-memory limits, and performance acceptance. If that artifact does not exist, provide and review it before implementation approval. The later advisory implementation approval and green CI do not supply the missing design record.
Implementation inspection completed for all 14 changed files, grouped into index/key identity, fill/preflight, merge/serialization/spill, shared DISTINCT consumers, and tests. The earlier reported >UnitLimit fill, admission-map and mixed-representation merge issues have corresponding fixes and focused regression cases at this head. I found no additional verified runtime blocker in this inspection; this is not an implementation approval while the upstream design gate remains open.
| Unhappy-path closure | Inspected result |
|---|---|
| Q1: ownership | Index-column partial-allocation rollback, growth replacement, state Free, drain commit/abort, rehome and decoder error cleanup were traced. |
| Q2: termination | Batch and resident lookup/insert probes are bounded; the change adds no goroutine, lock or external wait. Group retries repeat preflight before publication. |
| Q3: bounds | Batch scratch is UnitLimit-bounded; retained index/log columns use the allocation account and participate in DISTINCT retained-byte reporting. Only unpublished empty indexes may fall back. |
Evidence: CI run 34259004738 is completed/success and its API head SHA exactly matches the reviewed commit. Shared build, Linux UT, arm64 SCA, UT coverage, proxy BVT and pessimistic multi-CN BVT are successful. Skipped Darwin/upgrade lanes are not treated as passed compatibility evidence. The author also recorded normal/race aggexec passes for this rebased head. git diff --check passes. Performance numbers remain author-reported measurements on the documented 55 fixture, with the surrogate/full-Q10 distinction preserved; they are not an independent before/after benchmark from this review.
Reviewed in a clean detached worktree; no source/test changes or new local test run. Head was rechecked immediately before this COMMENT. No CI polling requested or performed.
XuPeng-SH
left a comment
There was a problem hiding this comment.
Implementation review is clear: no new confirmed runtime blocker was found, and the three previously reported code issues are fixed. The only remaining advisory gate is the missing exact approved design revision/approval record for the core DISTINCT representation change. As this is self-authored, GitHub permits COMMENT only; this is not a code-level request for changes.
…8431) ## What type of PR is this? - [ ] API-change - [ ] BUG - [x] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: issue matrixorigin#27672 ## What this PR does / why we need it: ClickBench Q10 is dominated by exact COUNT(DISTINCT) state maintenance. The old path probed an arena-backed ordered skiplist for every candidate and rebuilt that representation during state merges. This change keeps the existing skiplist wire/compatibility path for legacy and variable-width states, while adding an exact columnar open-addressing membership/index for one fixed-width DISTINCT argument. The index stores complete (group, value) keys, so hash collisions cannot change results. Batch preflight performs bounded local deduplication and reserves the exact index/log capacity before publication; BatchFill reuses that admission decision. Fixed-state merges import keys directly, including cross-state-chunk groups, and spill/recovery preserves the fixed-width payload contract. Empty optional indexes can fall back before publication under a tight hard account; published states never switch representation silently. Malformed payloads and corrupt full-table probes fail with bounded invariant errors. Signed zero remains canonicalized and NaN payload identity remains unchanged from the existing aggregate key contract. ## Test plan - `make -j12` - `GOWORK=off .agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=300s ./pkg/sql/colexec/aggexec ./pkg/sql/colexec/group` - `GOWORK=off .agents/skills/mo-dev/scripts/mo-cgo-test -race -count=1 -timeout=300s ./pkg/sql/colexec/aggexec ./pkg/sql/colexec/group` - Focused tests cover batch-local duplicates, cross-state-chunk group identity, merge deduplication, fixed-state serialization round-trip, NaN/plus-or-minus-zero equivalence with the legacy path, mismatched spill payload rejection, empty fixed rows, and a full malformed index probe. - On 10.222.1.55, latest binary was run against 42,203,164 rows: `RegionID + COUNT(DISTINCT UserID)` completed in 0.844--0.875s (three runs); text-group surrogate completed in 1.077--1.109s; the existing composite SUM/COUNT/AVG/DISTINCT query completed in 1.842--2.047s. - The official DuckDB Q10 is `MobilePhoneModel + COUNT(DISTINCT UserID)`; the checked-in 55 fixture has no `MobilePhoneModel`, so the text surrogate is reported separately rather than presented as an apples-to-apples result.
…8431) ## What type of PR is this? - [ ] API-change - [ ] BUG - [x] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: issue matrixorigin#27672 ## What this PR does / why we need it: ClickBench Q10 is dominated by exact COUNT(DISTINCT) state maintenance. The old path probed an arena-backed ordered skiplist for every candidate and rebuilt that representation during state merges. This change keeps the existing skiplist wire/compatibility path for legacy and variable-width states, while adding an exact columnar open-addressing membership/index for one fixed-width DISTINCT argument. The index stores complete (group, value) keys, so hash collisions cannot change results. Batch preflight performs bounded local deduplication and reserves the exact index/log capacity before publication; BatchFill reuses that admission decision. Fixed-state merges import keys directly, including cross-state-chunk groups, and spill/recovery preserves the fixed-width payload contract. Empty optional indexes can fall back before publication under a tight hard account; published states never switch representation silently. Malformed payloads and corrupt full-table probes fail with bounded invariant errors. Signed zero remains canonicalized and NaN payload identity remains unchanged from the existing aggregate key contract. ## Test plan - `make -j12` - `GOWORK=off .agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=300s ./pkg/sql/colexec/aggexec ./pkg/sql/colexec/group` - `GOWORK=off .agents/skills/mo-dev/scripts/mo-cgo-test -race -count=1 -timeout=300s ./pkg/sql/colexec/aggexec ./pkg/sql/colexec/group` - Focused tests cover batch-local duplicates, cross-state-chunk group identity, merge deduplication, fixed-state serialization round-trip, NaN/plus-or-minus-zero equivalence with the legacy path, mismatched spill payload rejection, empty fixed rows, and a full malformed index probe. - On 10.222.1.55, latest binary was run against 42,203,164 rows: `RegionID + COUNT(DISTINCT UserID)` completed in 0.844--0.875s (three runs); text-group surrogate completed in 1.077--1.109s; the existing composite SUM/COUNT/AVG/DISTINCT query completed in 1.842--2.047s. - The official DuckDB Q10 is `MobilePhoneModel + COUNT(DISTINCT UserID)`; the checked-in 55 fixture has no `MobilePhoneModel`, so the text surrogate is reported separately rather than presented as an apples-to-apples result.
…8431) ## What type of PR is this? - [ ] API-change - [ ] BUG - [x] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: issue matrixorigin#27672 ## What this PR does / why we need it: ClickBench Q10 is dominated by exact COUNT(DISTINCT) state maintenance. The old path probed an arena-backed ordered skiplist for every candidate and rebuilt that representation during state merges. This change keeps the existing skiplist wire/compatibility path for legacy and variable-width states, while adding an exact columnar open-addressing membership/index for one fixed-width DISTINCT argument. The index stores complete (group, value) keys, so hash collisions cannot change results. Batch preflight performs bounded local deduplication and reserves the exact index/log capacity before publication; BatchFill reuses that admission decision. Fixed-state merges import keys directly, including cross-state-chunk groups, and spill/recovery preserves the fixed-width payload contract. Empty optional indexes can fall back before publication under a tight hard account; published states never switch representation silently. Malformed payloads and corrupt full-table probes fail with bounded invariant errors. Signed zero remains canonicalized and NaN payload identity remains unchanged from the existing aggregate key contract. ## Test plan - `make -j12` - `GOWORK=off .agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=300s ./pkg/sql/colexec/aggexec ./pkg/sql/colexec/group` - `GOWORK=off .agents/skills/mo-dev/scripts/mo-cgo-test -race -count=1 -timeout=300s ./pkg/sql/colexec/aggexec ./pkg/sql/colexec/group` - Focused tests cover batch-local duplicates, cross-state-chunk group identity, merge deduplication, fixed-state serialization round-trip, NaN/plus-or-minus-zero equivalence with the legacy path, mismatched spill payload rejection, empty fixed rows, and a full malformed index probe. - On 10.222.1.55, latest binary was run against 42,203,164 rows: `RegionID + COUNT(DISTINCT UserID)` completed in 0.844--0.875s (three runs); text-group surrogate completed in 1.077--1.109s; the existing composite SUM/COUNT/AVG/DISTINCT query completed in 1.842--2.047s. - The official DuckDB Q10 is `MobilePhoneModel + COUNT(DISTINCT UserID)`; the checked-in 55 fixture has no `MobilePhoneModel`, so the text surrogate is reported separately rather than presented as an apples-to-apples result.
… (#32646) ## What type of PR is this? - [ ] API-change - [ ] BUG - [x] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: Related to #27672. Backports #27693 (`dfef35f7dd94de507d40dd18082b64e7f4b84e40`) and #28431 (`98171c28dbeb7ad1291ce9b0eb5beff7a84cbc32`) together to `4.2-dev`. ## What this PR does / why we need it: On 4.2, mixed aggregates containing COUNT(DISTINCT) are forced through one worker/CN, while fixed-width DISTINCT values use ordered skiplist lookups and repeated arena rebuilding. This adapts the two source optimizations to the existing 4.2 aggregate owners: - Allow COUNT-only DISTINCT to merge across workers/CNs, cost retained distinct arguments when selecting group shuffle, and bypass normal shuffle only when there is one physical group owner. Other DISTINCT aggregates and ordered GROUP_CONCAT retain their conservative execution path. - Add an exact fixed-width `(group, value)` index and direct merge with MPool-backed arrays, finite probing, checked growth, coherent partial-error state, and deterministic cleanup. Keep the existing aggregate wire format and legacy representation fallback. - Include the prerequisites needed on this branch: cached-Inserter successor equality, safe arena relocation/growth, signed-zero canonicalization, and state reuse after Free. Restrict JOIN-to-GROUP shuffle reuse to INNER joins so NULL extension cannot split one logical group between owners. The [versioned design](https://github.com/XuPeng-SH/matrixone/blob/a717091e1d8437911f8e90a17463d18ea668ee5a/docs/design/4.2-count-distinct-backport.md) records the ownership, compatibility, failure and resource contracts. The design-only phase was approved at `98387de8fc82d834188df5d42eb84d057cedeecc` before implementation. Final implementation: `a717091e1d8437911f8e90a17463d18ea668ee5a` against base `db0a7e76881bba94c2a86504ed8e3b2463fc6835`. **Validation:** Linux amd64, Go 1.26.4, CGO, `GOAMD64=v1`, `GOMAXPROCS=4`; native libraries built in this worktree. Repository `mo-cgo-test` wrapper, `-mod=readonly -p=2 -parallel=2 -short -tags=matrixone_test -count=1`: - Full arena, aggregate execution, Group, planner and compiler packages passed normally and under `-race`; the planner retains three existing unrelated skipped subtests. The final compiler runs selected 1,514 tests/subtests each with no skips. - Real three-CN `TestDistinctBackportMultiCN` passed normally and under `-race`: exact optimized/no-shuffle result equality, executed shuffle on multiple CNs, DOP 1, duplicate/NULL/tuple and non-COUNT controls, and LEFT JOIN NULL-group correctness. - Deterministic failure controls reproduce the missing cached-successor check and unsafe outer-join reuse; corrected tests pass. Coverage includes fixed/legacy merges, cross-chunk group identity, old wire readers, signed zeros/NaN payloads, allocation failure, partial merge state and cleanup/reuse. - Configured golangci-lint 2.6.2: zero issues across the six affected packages/consumers. Configured molint vet: exit 0, no introduced warnings (nine existing recover diagnostics match the base). Formatting and `git diff --check` passed. - Compiler Parquet fixture failures were traced to hidden `.codex` in GOTMPDIR, which the existing file enumerator skips. Both full compiler modes passed after setting TMPDIR and GOTMPDIR to a nonhidden disk directory; no tests were skipped or unrelated source changed. Paired local executor benchmark, identical 65,536 values/128 groups, `-benchmem -benchtime=3x -count=3` (median): | Operation | 4.2 base | This PR | | --- | ---: | ---: | | fill | 46.86 ms | 4.99 ms | | merge 16 states | 43.10 ms | 4.29 ms | This is a small warm microbenchmark on a shared host, not a production SQL latency claim. Go allocations fell from roughly 65–68k to 17 per operation; benchmem excludes MPool off-heap memory. **Branch limits:** DISTINCT spill and later-main aggregate preflight/accounting are outside this backport. Existing operator-pool/shared-global allocation limits remain authoritative; parallel non-shuffle states and a live merge destination can increase peak memory. No per-query or tenant-isolated memory bound is added. Upgrade remains a full shutdown. **Review:** `gpt-6.1-terra` with `max` reasoning approved the design before implementation and the complete committed change at `a717091e1d8437911f8e90a17463d18ea668ee5a` before push. Final review: PASS, no unresolved material blocker. Base-to-head binary diff SHA-256: `90694283dab3dd1847d4a7e13d095027f5dc14934c64b782899896ed4f4b1c22`. GitHub CI has not been verified; local validation does not imply CI success.
What type of PR is this?
Which issue(s) this PR fixes:
issue #27672
What this PR does / why we need it:
ClickBench Q10 is dominated by exact COUNT(DISTINCT) state maintenance. The old path probed an arena-backed ordered skiplist for every candidate and rebuilt that representation during state merges. This change keeps the existing skiplist wire/compatibility path for legacy and variable-width states, while adding an exact columnar open-addressing membership/index for one fixed-width DISTINCT argument.
The index stores complete (group, value) keys, so hash collisions cannot change results. Batch preflight performs bounded local deduplication and reserves the exact index/log capacity before publication; BatchFill reuses that admission decision. Fixed-state merges import keys directly, including cross-state-chunk groups, and spill/recovery preserves the fixed-width payload contract. Empty optional indexes can fall back before publication under a tight hard account; published states never switch representation silently. Malformed payloads and corrupt full-table probes fail with bounded invariant errors. Signed zero remains canonicalized and NaN payload identity remains unchanged from the existing aggregate key contract.
Test plan
make -j12GOWORK=off .agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=300s ./pkg/sql/colexec/aggexec ./pkg/sql/colexec/groupGOWORK=off .agents/skills/mo-dev/scripts/mo-cgo-test -race -count=1 -timeout=300s ./pkg/sql/colexec/aggexec ./pkg/sql/colexec/groupRegionID + COUNT(DISTINCT UserID)completed in 0.844--0.875s (three runs); text-group surrogate completed in 1.077--1.109s; the existing composite SUM/COUNT/AVG/DISTINCT query completed in 1.842--2.047s.MobilePhoneModel + COUNT(DISTINCT UserID); the checked-in 55 fixture has noMobilePhoneModel, so the text surrogate is reported separately rather than presented as an apples-to-apples result.