Skip to content

fix: preserve expression result metadata and coercion contracts - #28941

Merged
XuPeng-SH merged 6 commits into
matrixorigin:mainfrom
XuPeng-SH:codex/issue-cluster-g12-20260915
Sep 17, 2026
Merged

XuPeng-SH merged 6 commits into
matrixorigin:mainfrom
XuPeng-SH:codex/issue-cluster-g12-20260915

Conversation

@XuPeng-SH

@XuPeng-SH XuPeng-SH commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

What type of PR is this?

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

Which issue(s) this PR fixes:

Fixes #28902
Fixes #28901
Fixes #28897
Fixes #28896
Fixes #28894
Fixes #28892
Fixes #28886

What this PR does / why we need it:

  • Restores bounded expression result metadata and numeric coercion contracts.
  • Fixes COALESCE common-type inference for CHAR/VARCHAR and BINARY/VARBINARY in
    both operand orders, including the mixed CHAR/VARCHAR set-operation path.
  • Preserves CHAR set-operation visible semantics while keeping PAD SPACE
    equality keys separate from result metadata.
  • Keeps LEAST/GREATEST metadata conservative when bounded VARCHAR widths differ.
  • Fixes the CI regression where the bounded conditional string protocol test
    still expected the old version text after production moved to the new gate.
  • Uses MORPC v83 for the bounded conditional string-domain feature. fix: support Decimal256 RANGE window bounds #28825 owns
    MORPC v82 for exact plain DECIMAL256 literals, so fix: support Decimal256 RANGE window bounds #28825 should land first (or
    this PR must be rebased after that change); the two features must not share a
    protocol version.

Test plan

  • Rebased onto main=8e90e412647eee460772068efa127daa23d09828.
  • go test -count=1 ./pkg/pb/plan ./pkg/sql/plan ./pkg/sql/compile — PASS.
  • gofmt and git diff --check — PASS.
  • Official CI will run for the pushed head; it is not claimed as passed here.

No slow BVT or heavyweight fixture was added.

@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 →

@matrix-meow matrix-meow added the size/XL Denotes a PR that changes [1000, 1999] lines label Sep 15, 2026
@mergify mergify Bot added the kind/bug Something isn't working label Sep 15, 2026
@XuPeng-SH
XuPeng-SH force-pushed the codex/issue-cluster-g12-20260915 branch from 843cef6 to af33d50 Compare September 15, 2026 12:12
@XuPeng-SH

Copy link
Copy Markdown
Contributor Author

Rebased onto latest main at 1d7d425f6c and force-updated the personal-fork feature ref (default branch untouched). The legacy INT64 result-width compatibility fix is now included in af33d509df. GPT-6 medium incremental re-review ACCEPT: the batch OID dispatch preserves legacy serialized plans without changing current INT32 behavior. Existing focused normal/race/SCA evidence remains valid; no remote CI wait.

@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.

Reviewed exact head f5af39fcc8051e3d831c53aa2cc9b0f3cb8d4eba with GPT-6 medium deep review. COMMENT-only because this is the author PR.

P2: pkg/sql/compile/bounded_conditional_string_protocol_test.go:89-92 still expects "version 81", but the receiver guard in pkg/sql/compile/remoterun.go:2190-2194 correctly returns "bounded conditional string domains require MORPC protocol version 82". This is a deterministic test failure for the new COALESCE overload 31 path. Please update the assertion to v82 and rerun the affected validation.

No additional concrete P1/P2 blocker found across the 19-file diff: the COALESCE overload identities, feature traversal, worker placement/destination checks, persisted-expression admission, CHAR/VARCHAR order-independent metadata, CHAR PAD SPACE equality keys, and metadata BVT refresh are aligned.

CI is not green at this head: Ubuntu UT timed out with exit 124, and Coverage produced no verdict because a required producer profile was incomplete. Build, SCA, and the two multi-CN BVT checks passed; upgrade compatibility checks were skipped. Please fix the assertion and refresh the relevant CI before merge.

@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.

Force deep self-review of current head 9f5cdc5.

  • The previous protocol-test blocker is closed: the bounded COALESCE overloads are consistently gated at MORPC v83 in feature detection, placement, destination validation, persisted-expression admission, and the receiver check.
  • Audited the complete 19-file diff: bounded CHAR/VARCHAR and BINARY/VARBINARY inference, CHAR PAD SPACE equality keys for set operations, conservative LEAST/GREATEST metadata, overload registration/IDs, and remote-worker downgrade/recheck paths are aligned.
  • The current required CI contexts are green (UT, SCA, coverage, shared build, CPU/multi-CN BVT); Upgrade/3.0 checks are skipped.
  • No evidence-backed P0/P1/P2 finding.

Non-blocking dependency note: this branch intentionally uses MORPC v83 while #28825 owns the separate v82 contract; keep the dependency ordering/rebase requirement from the PR description.

Decision: no blocker; comment-only because this is my own PR.

This branch was previously deployed

1 inactive deployment
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 kind/enhancement kind/test-ci size/L Denotes a PR that changes [500,999] lines

Projects

None yet

2 participants