Skip to content

fix(types): validate Decimal256 tails after retained digits - #29956

Merged
XuPeng-SH merged 2 commits into
matrixorigin:mainfrom
iamlinjunhong:fix/29922-decimal256-malformed-tail
Oct 12, 2026
Merged

XuPeng-SH merged 2 commits into
matrixorigin:mainfrom
iamlinjunhong:fix/29922-decimal256-malformed-tail

Conversation

@iamlinjunhong

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:

The reporter should verify the issue after merge.

What this PR does / why we need it:

Strict CSV and JSONLINE LOAD into Decimal256 columns accepted malformed text after the parser retained 76 digits. For example, 0. followed by 77 1 digits and z was stored as 0.11; a second decimal point was also ignored.

Continue validating the entire tail in the exact parsing mode used by ParseDecimal256. Record the first dropped digit only once so accepted space/plus separators cannot replace the final-scale rounding digit. Valid long fractions, exponents, single-rounding behavior, and legacy Parse256 behavior are preserved. The parser still scans once, with constant extra state and no new success-path allocations.

Regression coverage includes precision boundaries, signs, invalid suffixes and exponents, separator-sensitive rounding, CSV and JSONLINE object/array conversion, and strict LOAD rollback for mixed valid/invalid rows. The existing Decimal256 external-load SQL case is extended with exact string results and expected rejection counts.

Validation on Darwin arm64 with Go 1.27.1:

  • New parser regression fails against the original parser; fixed parser tests pass, including the existing 20,000-input exact-rounding oracle.
  • Complete pkg/container/types and pkg/sql/colexec/external unit suites pass through the repository CGo wrapper.
  • go vet and incremental repository-configured golangci-lint v2.14.0 pass for both changed packages; formatting and diff checks are clean.
  • Built and ran an owned single-CN service. The extended decimal256_external_load.sql passes normal mo-tester comparison twice, 38/38 statements each; teardown checks confirm the test database is removed after each run.
  • Solution design and final overall review use gpt-6-astra, reasoning effort medium.

The issue's two-CN reproduction is historical evidence; local validation uses one CN. Full directory/distributed CI is pending.

@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 Oct 12, 2026
@mergify mergify Bot added the kind/bug Something isn't working label Oct 12, 2026
@XuPeng-SH

XuPeng-SH commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

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

Commit: 3992eef45bac93b03cc54ee5cfabe626553b8733

Assessment: approve

Reviewed the complete five-file delta and relevant conversion callers. The fix reuses the existing scanner to validate dropped tails, preserves the first rounding digit and retains legacy Parse256 behavior. Regression coverage checks parser boundaries, external conversion and strict LOAD atomicity. No actionable defects found.

Model: gpt-6-astra / xhigh

Session: 01a12d8f-7dea-77c2-a565-38d45b5564e4 · slot 0 · generation 0

Validation:

  • Verified exact HEAD, clean source and frozen-patch correspondence. Complete-delta whitespace and Go formatting checks passed.

  • Traced final-scale rounding, exponent handling, CSV/JSONLINE conversion, parallel LOAD casts and error propagation. Parallel staging casts already validate the complete token.

  • Reviewed all added test assertions and SQL results, including malformed tails, separator-sensitive rounding, zero persisted rows after failed mixed-row LOADs, SQL-mode restoration and teardown.

  • Reused frozen current-head evidence showing successful Ubuntu UT, Linux/arm64 static analysis, coverage, and PROXY/pessimistic multi-CN BVT.

  • Author additionally reports a failing pre-fix regression, complete types/external suites, the existing 20,000-input rounding oracle, and two targeted BVT passes of 38/38 statements.

  • Both supplied comments are administrative. Review details are recorded in review-audit.json and static-checks.json.

Limitations:

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

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

Commit: 3992eef45bac93b03cc54ee5cfabe626553b8733

Assessment: approve

Reviewed the complete five-file delta and relevant conversion callers. The fix reuses the existing scanner to validate dropped tails, preserves the first rounding digit and retains legacy Parse256 behavior. Regression coverage checks parser boundaries, external conversion and strict LOAD atomicity. No actionable defects found.

Model: gpt-6-astra / xhigh

Session: 01a12d8f-7dea-77c2-a565-38d45b5564e4 · slot 0 · generation 0

Validation:

  • Verified exact HEAD, clean source and frozen-patch correspondence. Complete-delta whitespace and Go formatting checks passed.

  • Traced final-scale rounding, exponent handling, CSV/JSONLINE conversion, parallel LOAD casts and error propagation. Parallel staging casts already validate the complete token.

  • Reviewed all added test assertions and SQL results, including malformed tails, separator-sensitive rounding, zero persisted rows after failed mixed-row LOADs, SQL-mode restoration and teardown.

  • Reused frozen current-head evidence showing successful Ubuntu UT, Linux/arm64 static analysis, coverage, and PROXY/pessimistic multi-CN BVT.

  • Author additionally reports a failing pre-fix regression, complete types/external suites, the existing 20,000-input rounding oracle, and two targeted BVT passes of 38/38 statements.

  • Both supplied comments are administrative. Review details are recorded in review-audit.json and static-checks.json.

Limitations:

  • CI and author evidence lack raw logs; no local native or service tests were repeated.

  • Issue #29922's standalone body was not supplied; its contract was assessed from the frozen PR description and regression inputs.

  • Performance was assessed structurally: linear scanning and constant additional state; no benchmark was run.

@mergify mergify Bot added the queued label Oct 12, 2026
@mergify

mergify Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • ✅ Entered queue — 2026-10-12 12:07 UTC · Rule: main · triggered by rule Automatic queue on approval for main
  • 🟠 Checks running · in-place
  • 🚫 Left the queue — 2026-10-12 13:59 UTC · at 5ff39cf2510625e5a69140ffb292bd3a3a5f7bd3

This pull request spent 1 hour 52 minutes 34 seconds in the queue, with no time running CI.

Reason

Pull request #29956 has been dequeued

Pull request from fork cannot be queued. This pull request comes from a fork, and Mergify needs the author's permission to update its branch.

The author needs to enable "Allow edits from maintainers" on this pull request.

Hint

You should look at the reason for the failure and decide if the pull request needs to be fixed or if you want to requeue it.
If you do update this pull request, it will automatically be requeued once the queue conditions match again.
If you think this was a flaky issue instead, you can requeue the pull request, without updating it, by posting a @mergifyio queue comment.

Waiting for any of
  • check-neutral = CI Required
  • check-skipped = CI Required
  • check-success = CI Required
All conditions

Tick the box to put this pull request back in the merge queue (same as @mergifyio queue).

  • Requeue this pull request

This branch was previously deployed

1 inactive deployment
ci — 5ff39cf2 Deployed Oct 12, 2026 by mergify[bot]
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/M Denotes a PR that changes [100,499] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants