Skip to content

fix: preserve decimal prefix cast boundaries - #27440

Merged
mergify[bot] merged 8 commits into
matrixorigin:mainfrom
ck89119:issue-27088-cast-main
Aug 21, 2026
Merged

mergify[bot] merged 8 commits into
matrixorigin:mainfrom
ck89119:issue-27088-cast-main

Conversation

@ck89119

@ck89119 ck89119 commented Aug 21, 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 #27088

What this PR does / why we need it:

This is the first independently mergeable split from #27093.

  • Preserve MySQL numeric-prefix semantics without saturating oversized Decimal256 inputs to unrelated maximum values.
  • Canonicalize leading-zero decimal prefixes before parsing.
  • Keep exact Decimal256 boundaries and fall back consistently when the prefix exceeds the exact domain.
  • Add focused vector and cast regression tests for prefix, precision, scale, and overflow boundaries.

Validation:

  • .agents/skills/mo-dev/scripts/mo-cgo-test ./pkg/container/vector ./pkg/sql/plan/function -count=1
  • git diff --check

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Reviewed exact head dda088e.

The decimal-prefix scanners bound extreme exponent work, canonicalize leading-zero inputs, preserve half-up underflow boundaries, and keep Decimal256 fallback inside the intended 65-digit input domain when the later common domain is wider. The FunctionResult reset change correctly converts a previously folded constant vector back to flat storage before reuse and refreshes the fixed-column view.

I treated this as the independently mergeable foundation split described by the PR; the planner wiring that produces the private coercion marker belongs to the subsequent split and is not required for this change to remain behavior-preserving on its own.

Validation:

  • full pkg/container/vector and pkg/sql/plan/function suites; passed.
  • focused decimal-prefix and folded-result reuse tests under -race, count=5; passed.
  • git diff --check passed and review worktree is clean.

No blocking correctness, overflow, or reuse issue found.

@mergify

mergify Bot commented Aug 21, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • ✅ Entered queue — 2026-08-21 16:50 UTC · Rule: main · triggered by rule Automatic queue on approval for main
  • ✅ Checks passed · in-place
  • ✅ Merged — 2026-08-21 19:53 UTC · at 7f080b8a34eb42551418e4ab5c208560bdd774af · squash

This pull request spent 3 hours 2 minutes 56 seconds in the queue, including 46 minutes 44 seconds running CI.

Required conditions to merge
  • #review-threads-unresolved = 0 [🛡 GitHub branch protection]
  • github-review-approved [🛡 GitHub branch protection]
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone CI / UT Test on Ubuntu/x86
    • check-neutral = Matrixone CI / UT Test on Ubuntu/x86
    • check-skipped = Matrixone CI / UT Test on Ubuntu/x86
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone CI / SCA Test on Linux/arm64
    • check-neutral = Matrixone CI / SCA Test on Linux/arm64
    • check-skipped = Matrixone CI / SCA Test on Linux/arm64
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone Compose CI / multi cn e2e bvt test docker compose(PROXY)
    • check-neutral = Matrixone Compose CI / multi cn e2e bvt test docker compose(PROXY)
    • check-skipped = Matrixone Compose CI / multi cn e2e bvt test docker compose(PROXY)
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone Utils CI / Coverage
    • check-neutral = Matrixone Utils CI / Coverage
    • check-skipped = Matrixone Utils CI / Coverage
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone UT Coverage / UT Coverage on Ubuntu/x86
    • check-neutral = Matrixone UT Coverage / UT Coverage on Ubuntu/x86
    • check-skipped = Matrixone UT Coverage / UT Coverage on Ubuntu/x86
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone Standlone CI / multi CN e2e BVT Test on Linux/x64(COMPOSE, PESSIMISTIC)
    • check-neutral = Matrixone Standlone CI / multi CN e2e BVT Test on Linux/x64(COMPOSE, PESSIMISTIC)
    • check-skipped = Matrixone Standlone CI / multi CN e2e BVT Test on Linux/x64(COMPOSE, PESSIMISTIC)

@mergify
mergify Bot merged commit 37c75ed into matrixorigin:main Aug 21, 2026
26 of 27 checks passed
@mergify mergify Bot removed the queued label Aug 21, 2026
@ck89119
ck89119 deleted the issue-27088-cast-main branch August 22, 2026 06:40
XuPeng-SH pushed a commit that referenced this pull request Aug 26, 2026
## What type of PR is this?

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

## Which issue(s) this PR fixes:

issue #27088

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

This PR implements the common-type planner split after #27440:

- Reuses the CAST numeric-prefix API to classify prepared string
parameters only in decimal-aware common-type contexts.
- Specializes isolated execution-plan copies for both COM_STMT_EXECUTE
and SQL EXECUTE without mutating cached prepared plans or cached
compiles.
- Preserves exact decimal domains across comparisons, IN/NOT IN,
BETWEEN, COALESCE, GREATEST, and LEAST, including values above 2^53.
- Keeps row-dependent BETWEEN bounds row-dependent and preserves
all-string behavior as a control boundary.
- Introduces the MORPC v27 capability boundary for planner-generated
numeric-prefix casts and rejects those plans on older remote workers.

Testing:

- GOWORK=off go list, go build, and go vet for all changed owning
packages.
- Full CGo-backed tests for defines, pb/plan, sql/plan/function,
sql/plan, and frontend.
- Focused CGo-backed MORPC v26/v27 remote protocol validation in
sql/compile.
- Embedded-engine regression through real COM_STMT and SQL PREPARE
execution paths.
- Changed executable statement coverage: 406/495 (82.0%).

---------

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
This is the first independently mergeable split from matrixorigin#27093.

- Preserve MySQL numeric-prefix semantics without saturating oversized Decimal256 inputs to unrelated maximum values.
- Canonicalize leading-zero decimal prefixes before parsing.
- Keep exact Decimal256 boundaries and fall back consistently when the prefix exceeds the exact domain.
- Add focused vector and cast regression tests for prefix, precision, scale, and overflow boundaries.

Validation:

- `.agents/skills/mo-dev/scripts/mo-cgo-test ./pkg/container/vector ./pkg/sql/plan/function -count=1`
- `git diff --check`

Approved by: @XuPeng-SH
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
## What type of PR is this?

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

## Which issue(s) this PR fixes:

issue matrixorigin#27088

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

This PR implements the common-type planner split after matrixorigin#27440:

- Reuses the CAST numeric-prefix API to classify prepared string
parameters only in decimal-aware common-type contexts.
- Specializes isolated execution-plan copies for both COM_STMT_EXECUTE
and SQL EXECUTE without mutating cached prepared plans or cached
compiles.
- Preserves exact decimal domains across comparisons, IN/NOT IN,
BETWEEN, COALESCE, GREATEST, and LEAST, including values above 2^53.
- Keeps row-dependent BETWEEN bounds row-dependent and preserves
all-string behavior as a control boundary.
- Introduces the MORPC v27 capability boundary for planner-generated
numeric-prefix casts and rejects those plans on older remote workers.

Testing:

- GOWORK=off go list, go build, and go vet for all changed owning
packages.
- Full CGo-backed tests for defines, pb/plan, sql/plan/function,
sql/plan, and frontend.
- Focused CGo-backed MORPC v26/v27 remote protocol validation in
sql/compile.
- Embedded-engine regression through real COM_STMT and SQL PREPARE
execution paths.
- Changed executable statement coverage: 406/495 (82.0%).

---------

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
This is the first independently mergeable split from matrixorigin#27093.

- Preserve MySQL numeric-prefix semantics without saturating oversized Decimal256 inputs to unrelated maximum values.
- Canonicalize leading-zero decimal prefixes before parsing.
- Keep exact Decimal256 boundaries and fall back consistently when the prefix exceeds the exact domain.
- Add focused vector and cast regression tests for prefix, precision, scale, and overflow boundaries.

Validation:

- `.agents/skills/mo-dev/scripts/mo-cgo-test ./pkg/container/vector ./pkg/sql/plan/function -count=1`
- `git diff --check`

Approved by: @XuPeng-SH
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
## What type of PR is this?

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

## Which issue(s) this PR fixes:

issue matrixorigin#27088

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

This PR implements the common-type planner split after matrixorigin#27440:

- Reuses the CAST numeric-prefix API to classify prepared string
parameters only in decimal-aware common-type contexts.
- Specializes isolated execution-plan copies for both COM_STMT_EXECUTE
and SQL EXECUTE without mutating cached prepared plans or cached
compiles.
- Preserves exact decimal domains across comparisons, IN/NOT IN,
BETWEEN, COALESCE, GREATEST, and LEAST, including values above 2^53.
- Keeps row-dependent BETWEEN bounds row-dependent and preserves
all-string behavior as a control boundary.
- Introduces the MORPC v27 capability boundary for planner-generated
numeric-prefix casts and rejects those plans on older remote workers.

Testing:

- GOWORK=off go list, go build, and go vet for all changed owning
packages.
- Full CGo-backed tests for defines, pb/plan, sql/plan/function,
sql/plan, and frontend.
- Focused CGo-backed MORPC v26/v27 remote protocol validation in
sql/compile.
- Embedded-engine regression through real COM_STMT and SQL PREPARE
execution paths.
- Changed executable statement coverage: 406/495 (82.0%).

---------

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
This is the first independently mergeable split from matrixorigin#27093.

- Preserve MySQL numeric-prefix semantics without saturating oversized Decimal256 inputs to unrelated maximum values.
- Canonicalize leading-zero decimal prefixes before parsing.
- Keep exact Decimal256 boundaries and fall back consistently when the prefix exceeds the exact domain.
- Add focused vector and cast regression tests for prefix, precision, scale, and overflow boundaries.

Validation:

- `.agents/skills/mo-dev/scripts/mo-cgo-test ./pkg/container/vector ./pkg/sql/plan/function -count=1`
- `git diff --check`

Approved by: @XuPeng-SH
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
## What type of PR is this?

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

## Which issue(s) this PR fixes:

issue matrixorigin#27088

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

This PR implements the common-type planner split after matrixorigin#27440:

- Reuses the CAST numeric-prefix API to classify prepared string
parameters only in decimal-aware common-type contexts.
- Specializes isolated execution-plan copies for both COM_STMT_EXECUTE
and SQL EXECUTE without mutating cached prepared plans or cached
compiles.
- Preserves exact decimal domains across comparisons, IN/NOT IN,
BETWEEN, COALESCE, GREATEST, and LEAST, including values above 2^53.
- Keeps row-dependent BETWEEN bounds row-dependent and preserves
all-string behavior as a control boundary.
- Introduces the MORPC v27 capability boundary for planner-generated
numeric-prefix casts and rejects those plans on older remote workers.

Testing:

- GOWORK=off go list, go build, and go vet for all changed owning
packages.
- Full CGo-backed tests for defines, pb/plan, sql/plan/function,
sql/plan, and frontend.
- Focused CGo-backed MORPC v26/v27 remote protocol validation in
sql/compile.
- Embedded-engine regression through real COM_STMT and SQL PREPARE
execution paths.
- Changed executable statement coverage: 406/495 (82.0%).

---------

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>

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 size/L Denotes a PR that changes [500,999] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants