Repository navigation
[4.2] Fix grouped ENUM and SET numeric conversions - #32823
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? |
|
This pull request is merged. |
|
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: 09a30ea6a1b3ec972323b95aecc04b9348d7c6cf
Assessment: approve
The fix reuses existing ENUM/SET provenance, reversibility checks and conversion overloads. Recovery is limited to numeric consumers, preserves NULL/zero and string semantics, and stages subquery rewrites before publication. No actionable defect remains.
Model: gpt-6.1-sol / max
Session: 01a1a004-90c3-73b1-acc9-3d4636452003 · slot 0 · generation 0
Validation:
-
Reviewed all five changed files, the linked issue and all three discussion items; traced grouping, correlation, tuple/subquery consumers, legacy/framed encoding and ambiguous-domain controls.
-
Frozen-head/patch, diff and Go-format checks passed. The regression fixture contains five focused tests and 39 SQL statements with 26 result sets and teardown.
-
Reused the supplied author report of normal/race planner runs, 39/39 SQL BVT twice and the 137-case domain control, within its stated inputs.
Limitations:
-
Local focused planner tests did not reach compilation: the repository wrapper reported missing libmo.so and native third-party prerequisites. This is an environment diagnostic, not a product-test result.
-
Author execution reports were not independently replayed; no mixed-version execution or metadata-comparison pass is claimed.
What type of PR is this?
Which issue(s) this PR fixes:
Fixes #32819
What this PR does / why we need it:
On 4.2-dev, numeric operations on a grouped ENUM or SET can attempt to convert its display label instead of using its ordinal or bitmap. For example, grouping
ENUM('a','b')and selectinge + 0fails on the labelaeven though the corresponding row-level expression succeeds.Adapt the approach from #28751 to 4.2's existing ENUM encoding and provenance rules. Recover the stored numeric value only when the original domain is known and reversible, including numeric casts, scalar comparisons, IN/quantified subqueries, and the correlated scalar and projection forms covered by the regression tests. Keep string comparisons and ambiguous domains on their existing paths. A numeric IN list may contain NULL without losing its numeric comparison semantics.
This reuses existing conversion overloads and does not change persisted formats. Numeric operations on grouped or projected values add conversion work for those expressions only. The general correlated scalar projection path for a subquery with its own FROM remains unsupported by the existing executor; the same query shape also fails with ordinary integer columns on the exact 4.2-dev base. Legacy overload compatibility was checked against the source and serialized plans; mixed-version execution was not tested.
Validation on the 57 host (Go 1.26.4, isolated single-CN instance):
./pkg/sql/plan: full normal and race runs, plus focused race tests.gofmt,go vet, and incremental golangci-lint: passed. The 4.2-pinned molint reports five existing findings identical to the clean base.GitHub CI will provide the remaining integration checks.