Skip to content

fix compatibility for concat, prepared elt, and string numeric results - #28915

Merged
XuPeng-SH merged 36 commits into
mainfrom
codex/issue-28904-28908-28909-compat
Sep 16, 2026
Merged

XuPeng-SH merged 36 commits into
mainfrom
codex/issue-28904-28908-28909-compat

Conversation

@XuPeng-SH

@XuPeng-SH XuPeng-SH commented Sep 15, 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:

issue #28904
issue #28908
issue #28909

What this PR does / why we need it:

This is the string-compatibility successor to #28885 and is delivered with #28940 as a real protocol-admission prerequisite. The branch keeps the aggregate protocol allocation from #28885 (v75-v78), the durable persisted-expression read/authoring/generation fence from #28940, and adds the disjoint v79 string-numeric result contract. The prerequisite commits are kept as separate ancestry so the PR is safe before either predecessor is merged; after they land, the review diff collapses to the v79 adaptation.

  • Accept one-argument CONCAT while retaining zero-argument rejection and correct NULL/value behavior.
  • Preserve the execution-bound occurrence when rebinding prepared ELT indexes. Runtime decimal rounding, numeric prefixes, NULL, out-of-range values, and explicit DOUBLE casts keep their intended results without mutating the cached plan.
  • Correct result metadata and execution domains for FIND_IN_SET, STRCMP, CHAR_LENGTH/LENGTH_UTF8, UNCOMPRESSED_LENGTH, and CRC32, while retaining legacy wrappers for older protocol consumers.
  • Gate sender placement, receiver validation, persisted expression admission, VIEW authoring/read/regeneration/restore, and generation/pending transitions at MORPC v79 so an older CN cannot decode or rebind the new result domain.

Test plan

  • Combined affected-package normal tests: pkg/sql/plan, pkg/sql/plan/function, pkg/sql/compile, pkg/frontend, pkg/hakeeper, pkg/cnservice, and pkg/logservice.
  • Focused protocol/admission -race -count=1 tests, including HAKeeper member capability/pending reconciliation, VIEW restore, sender/receiver placement, prepared ELT, wrappers, and one-argument CONCAT.
  • go list -mod=readonly, CGo-aware go vet, git diff --check, and make build-with-prebuilt-native all pass on the combined candidate.
  • On 10.222.1.55 using the combined candidate binary, func_bounded_result_metadata passed 63/63 statements, 0 failures in 0.462s. It covers direct/prepared CONCAT, prepared ELT decimal/prefix/NULL/out-of-range/DOUBLE, VIEW/CTAS metadata, and the corrected legacy metadata cells.
  • No new row-execution hot-path cache or unbounded state is introduced; version detection runs at plan/DDL/metadata boundaries. Official repository CI remains authoritative and is intentionally not awaited here.

@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/M Denotes a PR that changes [100,499] lines label Sep 15, 2026
@XuPeng-SH
XuPeng-SH force-pushed the codex/issue-28904-28908-28909-compat branch from 6ae9c8b to 6e7da94 Compare September 15, 2026 13:05
@matrix-meow matrix-meow added size/L Denotes a PR that changes [500,999] lines and removed size/M Denotes a PR that changes [100,499] lines labels Sep 15, 2026
@XuPeng-SH

Copy link
Copy Markdown
Contributor Author

Fixed and rebased onto current main. New head: 6e7da94745f7239e8c9ee4237b39a3c8f6c7d2d8.

Changes:

  • preserve the EXECUTE-bound occurrence during deferred numeric rebinding so unsupported text such as foo still follows MySQL numeric-prefix conversion instead of resurrecting the raw prepare-time cast;
  • materialize BOOL numeric sidecar values as INT64 0/1, keeping the direct-result text domain independent;
  • keep the legacy UINT64 LENGTH_UTF8/MORPC v58 contract covered, while fencing corrected INT32/INT64/UINT64 string-numeric result contracts at MORPC v73;
  • add an actual sender-side downgrade check for a v72 target CN.

Validation:

  • targeted plan tests: PASS;
  • TestBinaryStringRemoteProtocolValidationAtSenderAndReceiver: PASS, including legacy v58, v72 rejection, v73 sender/receiver paths;
  • targeted -cover: pkg/sql/plan 8.9%, pkg/sql/compile 1.7%;
  • go vet and incremental golangci-lint from merge-base: 0 issues.

The three known frontend/issues execution paths were not rerun locally because this worktree lacks the matching cgo/libmo.dylib; no BVT or full slow UT was added or run. Official CI should provide the native integration evidence.

@XuPeng-SH

Copy link
Copy Markdown
Contributor Author

CI triage and repair update (2026-09-15): this was PR-owned, not a base/runner failure. The failed Ubuntu UT and UT Coverage jobs reproduced four deterministic planner regressions: prepared Boolean arithmetic hit invalid argument cast to int, bad value true; ROUND/TRUNCATE precision rebinding lost the expected CAST(TRUE AS INT64) node; CHAR Boolean binding lost its outer INT64 cast. The coverage failure was downstream from the same UT failures (PREREQUISITES_READY=false), not an independent coverage/base issue.\n\nFix: restored preparedSQLExecuteNumericParamExpr Boolean handling to preserve CAST(BOOL literal AS INT64), so cache restoration remains TEXT -> BOOL -> INT64 and TRUE/FALSE are decoded as Boolean before numeric conversion. No changes to generic rebind, string, BIT, NULL, or explicit-cast paths.\n\nThe branch was rebased without conflict onto current upstream main 6753979f5bcd749e37ce0e1409caef218ccc7894 and pushed as 5e1242941299d6600b6ee22d4a79215467ea651b. Local focused planner tests all pass, incremental coverage is 7.7%, go vet ./pkg/sql/plan passes, and incremental golangci-lint reports 0 issues. No BVT, full UT, or slow embedded integration test was run; the new CI run is queued/pending for end-to-end confirmation.

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

Deep review 结果(当前 head fd3561c):

在已检查代码中未发现 confirmed actionable defect。numeric result changes 保持 overload IDs 和 legacy wrappers;新 result types 在 placement、sender、receiver、persisted-expression admission 处使用 MORPC v80 fence。prepared ELT rebinding 保留全部参数和 execution-bound values,已有测试覆盖 decimal rounding、numeric prefixes、NULL、invalid index 和 cached-plan immutability。

Exact-head CI 报告 Linux UT、coverage、multi-CN BVT 通过,但 upgrade jobs skipped;本轮未运行额外 local tests,完整 prerequisite/lifecycle review 未完成。因此本次只记录为无已确认 defect 的部分审查,不作为 approve 或完整 clean deep-review 结论。

@XuPeng-SH
XuPeng-SH merged commit 8a4c84f into main Sep 16, 2026
36 checks passed
@XuPeng-SH
XuPeng-SH deleted the codex/issue-28904-28908-28909-compat branch September 16, 2026 08:11
@aptend aptend mentioned this pull request Sep 16, 2026
1 of 7 tasks
@aptend aptend mentioned this pull request Sep 16, 2026
2 of 7 tasks
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
matrixorigin#28915)

## What type of PR is this?

- [ ] API-change
- [x] BUG
- [x] Improvement
- [ ] Documentation
- [ ] Feature
- [x] Test and CI
- [ ] Code Refactoring

## Which issue(s) this PR fixes:

issue matrixorigin#28904
issue matrixorigin#28908
issue matrixorigin#28909

## What this PR does / why we need it:

This is the string-compatibility successor to matrixorigin#28885 and is delivered
with matrixorigin#28940 as a real protocol-admission prerequisite. The branch keeps
the aggregate protocol allocation from matrixorigin#28885 (v75-v78), the durable
persisted-expression read/authoring/generation fence from matrixorigin#28940, and
adds the disjoint v79 string-numeric result contract. The prerequisite
commits are kept as separate ancestry so the PR is safe before either
predecessor is merged; after they land, the review diff collapses to the
v79 adaptation.

- Accept one-argument `CONCAT` while retaining zero-argument rejection
and correct NULL/value behavior.
- Preserve the execution-bound occurrence when rebinding prepared `ELT`
indexes. Runtime decimal rounding, numeric prefixes, NULL, out-of-range
values, and explicit `DOUBLE` casts keep their intended results without
mutating the cached plan.
- Correct result metadata and execution domains for `FIND_IN_SET`,
`STRCMP`, `CHAR_LENGTH`/`LENGTH_UTF8`, `UNCOMPRESSED_LENGTH`, and
`CRC32`, while retaining legacy wrappers for older protocol consumers.
- Gate sender placement, receiver validation, persisted expression
admission, VIEW authoring/read/regeneration/restore, and
generation/pending transitions at MORPC v79 so an older CN cannot decode
or rebind the new result domain.

## Test plan

- Combined affected-package normal tests: `pkg/sql/plan`,
`pkg/sql/plan/function`, `pkg/sql/compile`, `pkg/frontend`,
`pkg/hakeeper`, `pkg/cnservice`, and `pkg/logservice`.
- Focused protocol/admission `-race -count=1` tests, including HAKeeper
member capability/pending reconciliation, VIEW restore, sender/receiver
placement, prepared `ELT`, wrappers, and one-argument `CONCAT`.
- `go list -mod=readonly`, CGo-aware `go vet`, `git diff --check`, and
`make build-with-prebuilt-native` all pass on the combined candidate.
- On 10.222.1.55 using the combined candidate binary,
`func_bounded_result_metadata` passed `63/63` statements, `0` failures
in 0.462s. It covers direct/prepared `CONCAT`, prepared `ELT`
decimal/prefix/NULL/out-of-range/`DOUBLE`, VIEW/CTAS metadata, and the
corrected legacy metadata cells.
- No new row-execution hot-path cache or unbounded state is introduced;
version detection runs at plan/DDL/metadata boundaries. Official
repository CI remains authoritative and is intentionally not awaited
here.
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
matrixorigin#28915)

## What type of PR is this?

- [ ] API-change
- [x] BUG
- [x] Improvement
- [ ] Documentation
- [ ] Feature
- [x] Test and CI
- [ ] Code Refactoring

## Which issue(s) this PR fixes:

issue matrixorigin#28904
issue matrixorigin#28908
issue matrixorigin#28909

## What this PR does / why we need it:

This is the string-compatibility successor to matrixorigin#28885 and is delivered
with matrixorigin#28940 as a real protocol-admission prerequisite. The branch keeps
the aggregate protocol allocation from matrixorigin#28885 (v75-v78), the durable
persisted-expression read/authoring/generation fence from matrixorigin#28940, and
adds the disjoint v79 string-numeric result contract. The prerequisite
commits are kept as separate ancestry so the PR is safe before either
predecessor is merged; after they land, the review diff collapses to the
v79 adaptation.

- Accept one-argument `CONCAT` while retaining zero-argument rejection
and correct NULL/value behavior.
- Preserve the execution-bound occurrence when rebinding prepared `ELT`
indexes. Runtime decimal rounding, numeric prefixes, NULL, out-of-range
values, and explicit `DOUBLE` casts keep their intended results without
mutating the cached plan.
- Correct result metadata and execution domains for `FIND_IN_SET`,
`STRCMP`, `CHAR_LENGTH`/`LENGTH_UTF8`, `UNCOMPRESSED_LENGTH`, and
`CRC32`, while retaining legacy wrappers for older protocol consumers.
- Gate sender placement, receiver validation, persisted expression
admission, VIEW authoring/read/regeneration/restore, and
generation/pending transitions at MORPC v79 so an older CN cannot decode
or rebind the new result domain.

## Test plan

- Combined affected-package normal tests: `pkg/sql/plan`,
`pkg/sql/plan/function`, `pkg/sql/compile`, `pkg/frontend`,
`pkg/hakeeper`, `pkg/cnservice`, and `pkg/logservice`.
- Focused protocol/admission `-race -count=1` tests, including HAKeeper
member capability/pending reconciliation, VIEW restore, sender/receiver
placement, prepared `ELT`, wrappers, and one-argument `CONCAT`.
- `go list -mod=readonly`, CGo-aware `go vet`, `git diff --check`, and
`make build-with-prebuilt-native` all pass on the combined candidate.
- On 10.222.1.55 using the combined candidate binary,
`func_bounded_result_metadata` passed `63/63` statements, `0` failures
in 0.462s. It covers direct/prepared `CONCAT`, prepared `ELT`
decimal/prefix/NULL/out-of-range/`DOUBLE`, VIEW/CTAS metadata, and the
corrected legacy metadata cells.
- No new row-execution hot-path cache or unbounded state is introduced;
version detection runs at plan/DDL/metadata boundaries. Official
repository CI remains authoritative and is intentionally not awaited
here.

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/XXL Denotes a PR that changes 2000+ lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants