Skip to content

[4.2] Fix grouped ENUM and SET numeric conversions - #32823

Merged
XuPeng-SH merged 2 commits into
matrixorigin:4.2-devfrom
XuPeng-SH:codex/issue-32819-grouped-enum-42
Nov 17, 2026
Merged

XuPeng-SH merged 2 commits into
matrixorigin:4.2-devfrom
XuPeng-SH:codex/issue-32819-grouped-enum-42

Conversation

@XuPeng-SH

@XuPeng-SH XuPeng-SH commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

What type of PR is this?

  • API-change
  • BUG
  • Improvement
  • Documentation
  • Feature
  • Test and CI
  • Code Refactoring

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 selecting e + 0 fails on the label a even 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.
  • New SQL BVT: 39/39 twice, with teardown verified; existing ENUM domain BVT: 137/137. The normal mo-tester comparison ignores result metadata.
  • 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.

@XuPeng-SH
XuPeng-SH requested a review from aunjgr as a code owner November 16, 2026 17:51
@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@mergify mergify Bot added the kind/bug Something isn't working label Nov 16, 2026
@mergify

mergify Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

This pull request is merged.

@XuPeng-SH

XuPeng-SH commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor Author

mo-bot review · mo-bot-local · done

Commit: 09a30ea6a1b3ec972323b95aecc04b9348d7c6cf

Review completed. Read the assessment.

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

This branch was previously deployed

1 inactive deployment
ci — 09a30ea6 Deployed Nov 16, 2026 by XuPeng-SH
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/bug Something isn't working size/L Denotes a PR that changes [500,999] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants