Repository navigation
[4.2-dev] fix DISTINCT inserts for ENUM and SET - #32808
Conversation
|
This pull request is merged. |
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: dbbcded0cc2c57b0d91162cf010acd2081813f26
Assessment: approve
No actionable defects found. The fix preserves visible DISTINCT keys and reuses existing provenance, materialization and codec owners with bounded local state.
Model: gpt-6.1-sol / max
Session: 01a1a004-90c3-73b1-acc9-3d4636452003 · slot 0 · generation 0
Validation:
-
Go 1.26.4 focused planner/function tests passed; receipt checks/1794823324771438223-2.json and focused-tests-official.jsonl.
-
Both owning packages passed -short -vet=all: 9,781 test/subtest passes and 3 skips; receipt checks/1794823396453383304-2.json and owning-tests.jsonl.
-
All 14 reviewer planner probes passed on the candidate and failed for hidden DISTINCT keys with exact-baseline Go overlays; receipts checks/1794823381817315353-2.json and checks/1794823460350514759-2.json.
-
Formatting, frozen-source checks, discussion coverage and an independent oracle for all 15 added SQL result blocks passed; receipt checks/1794823012783555143-2.json and source-audit.json.
-
Final receipt/log/source reconciliation passed; receipt checks/1794823712920047119-2.json, validation-audit.json and validation-manifest.json.
Limitations:
-
No fresh live-service SQL or race run. The author's reported SQL and race runs have no retained raw receipts in the supplied evidence.
-
Hosted CI had five checks in progress in the supplied snapshot.
QA challenge —
|
|
mo-bot review · Commit: New discussion was assessed; the previous review remains unchanged. |
|
mo-bot review · Commit: New discussion was assessed; the previous review remains unchanged. |
What type of PR is this?
Which issue(s) this PR fixes:
Related to #30771. Follow-up to #32723 on
4.2-dev.What this PR does / why we need it:
An
INSERT ... SELECT DISTINCTcan write two rows when the SELECT returns one: ENUM error ordinal 0 and a declared empty member display identically, but a hidden ordinal was added to the DISTINCT key. Hidden SET bitmaps could split the same visible tuple as well.Keep hidden storage out of ambiguous DISTINCT keys and recover a canonical value from the visible result after duplicate elimination. ENUM recovery uses exact member bytes, including framed domains and case-distinct members. Plain projections and the non-DISTINCT branches of
UNION ALLretain their stored ordinals; incompatible SET domains fall back to visible-value conversion.When a DISTINCT result cannot distinguish error ordinal 0 from a declared empty ENUM member, recovery chooses the declared empty member. This follows the existing visible-value semantics at set-operation boundaries; an ENUM domain without an empty member retains ordinal 0.
Validation
4.2-devbase2bc965d972e3, macOS arm64, Go 1.26.4:pkg/sql/planandpkg/sql/plan/functionshort UT passed withmatrixone_test.-race.enum_domain_roundtripSQL case passed twice on an isolated localmo-service: 137/137 statements each time, with no ignored or abnormal statements. Coverage includes direct/derived/CTE DISTINCT, self-UNION, mixed UNION ALL, NULL, case-distinct/framed ENUM members, domain remapping, and combined ENUM/SET keys.gofmt,go vet,golangci-lint, andgit diff --checkpassed. Hosted CI is separate.