Skip to content

fix: normalize binary prepared DECIMAL materialization - #28827

Merged
XuPeng-SH merged 4 commits into
matrixorigin:mainfrom
XuPeng-SH:codex/issue-28771-decimal-canonical
Sep 14, 2026
Merged

XuPeng-SH merged 4 commits into
matrixorigin:mainfrom
XuPeng-SH:codex/issue-28771-decimal-canonical

Conversation

@XuPeng-SH

Copy link
Copy Markdown
Contributor

Summary

  • Normalize the canonical DECIMAL coefficient and exponent before typed parameter materialization.
  • Preserve the visible DECIMAL scale through the existing runtime/direct-result domains.
  • Add normalized/visible/canonical, binary protocol, full-package, and Connector/J server-prepared regression coverage.

Fixes #28771

Validation

  • make -j8 cgo
  • make -j8 build
  • mo-cgo-test focused and full pkg/sql/plan / pkg/frontend tests
  • go vet and incremental golangci-lint: 0 issues
  • Connector/J 8.0.15 with useServerPrepStmts=true: issue value succeeds in arithmetic and direct SELECT ? retains DECIMAL(31,30) metadata.

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

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

GPT-6 medium deep review of exact head f29421dc4acdb99b9a628fe4c48e60b5a4d23c07: no blocker found.

The canonical DECIMAL lexeme is now emitted from the normalized coefficient/scale, while the visible result type remains separately preserved. This keeps repeated trailing zeroes from producing a coefficient too wide for the bounded wire value and still parses to the same exact value in both domains. I traced the frontend materialization and plan specialization paths; the new cases cover zero with a huge exponent, both DECIMAL protocol type codes, trailing zeroes, and execution through a DECIMAL256 expression. The added fixtures are small and deterministic; no mechanism for a major racing-UT slowdown is apparent.

Exact-head CI run 34781448516 passed UT, SCA, coverage, shared build, and the required BVTs. This is a self-authored PR, so this is a COMMENT review rather than an approval.

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

GPT-6 medium deep review of exact head dfcb9a4c6a3046818154be226992d080fab6daac: no blocker found. The three changed files are byte-identical to the previously reviewed head; the rebase adds Decimal256/float coercion rules elsewhere, but they do not invalidate DECIMAL normalization, visible-scale preservation, or prepared-parameter materialization. Exact-head Ubuntu UT, SCA, build, Connector/J E2E, and required BVTs pass. I found no credible major racing-UT slowdown mechanism. This is a self-authored PR, so this is COMMENT only.

@XuPeng-SH
XuPeng-SH merged commit 00eab40 into matrixorigin:main Sep 14, 2026
18 of 21 checks passed
@XuPeng-SH
XuPeng-SH deleted the codex/issue-28771-decimal-canonical branch September 14, 2026 03:02
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
…28827)

## Summary
- Normalize the canonical DECIMAL coefficient and exponent before typed
parameter materialization.
- Preserve the visible DECIMAL scale through the existing
runtime/direct-result domains.
- Add normalized/visible/canonical, binary protocol, full-package, and
Connector/J server-prepared regression coverage.

Fixes matrixorigin#28771

## Validation
- `make -j8 cgo`
- `make -j8 build`
- `mo-cgo-test` focused and full `pkg/sql/plan` / `pkg/frontend` tests
- `go vet` and incremental `golangci-lint`: 0 issues
- Connector/J 8.0.15 with `useServerPrepStmts=true`: issue value
succeeds in arithmetic and direct `SELECT ?` retains `DECIMAL(31,30)`
metadata.
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
…28827)

## Summary
- Normalize the canonical DECIMAL coefficient and exponent before typed
parameter materialization.
- Preserve the visible DECIMAL scale through the existing
runtime/direct-result domains.
- Add normalized/visible/canonical, binary protocol, full-package, and
Connector/J server-prepared regression coverage.

Fixes matrixorigin#28771

## Validation
- `make -j8 cgo`
- `make -j8 build`
- `mo-cgo-test` focused and full `pkg/sql/plan` / `pkg/frontend` tests
- `go vet` and incremental `golangci-lint`: 0 issues
- Connector/J 8.0.15 with `useServerPrepStmts=true`: issue value
succeeds in arithmetic and direct `SELECT ?` retains `DECIMAL(31,30)`
metadata.
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
…28827)

## Summary
- Normalize the canonical DECIMAL coefficient and exponent before typed
parameter materialization.
- Preserve the visible DECIMAL scale through the existing
runtime/direct-result domains.
- Add normalized/visible/canonical, binary protocol, full-package, and
Connector/J server-prepared regression coverage.

Fixes matrixorigin#28771

## Validation
- `make -j8 cgo`
- `make -j8 build`
- `mo-cgo-test` focused and full `pkg/sql/plan` / `pkg/frontend` tests
- `go vet` and incremental `golangci-lint`: 0 issues
- Connector/J 8.0.15 with `useServerPrepStmts=true`: issue value
succeeds in arithmetic and direct `SELECT ?` retains `DECIMAL(31,30)`
metadata.

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

size/M Denotes a PR that changes [100,499] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: binary prepared DECIMAL arithmetic rejects representable values with trailing zeros

2 participants