Skip to content

[Bug]: preserve DECIMAL division range and rounding - #28814

Merged
XuPeng-SH merged 4 commits into
matrixorigin:mainfrom
XuPeng-SH:fix/issues-28774-28775-decimal-div
Sep 13, 2026
Merged

XuPeng-SH merged 4 commits into
matrixorigin:mainfrom
XuPeng-SH:fix/issues-28774-28775-decimal-div

Conversation

@XuPeng-SH

Copy link
Copy Markdown
Contributor

Fixes #28774 and #28775.

  • Preserve full Decimal256 quotients when the D128 fast path is used for eligible inputs.
  • Correct D128 quotient/remainder estimation and half-up rounding for large divisors.
  • Fall back to D256 when a D128 absolute operand is not representable as positive D128, including MinInt128.
  • Add focused UT and distributed regressions for wide results, rounding, and signed minimum boundaries.

Validation: gofmt and git diff checks pass. Local CGo UT and distributed BVT were not run because this worktree lacks cgo/libmo.so and required thirdparties; CI validation is required.

@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 at current head 4fda7ced7a1fb1af55de7e00530a93928d1cdb4e: no verified blocking finding.

The D128 quotient/remainder implementation corrects the normalized large-divisor estimate before forming the remainder and uses the correct half-up threshold for odd and even divisors. The D256-result fallback preserves wide quotients and signed MinInt128 magnitudes while keeping declared D128 overflow behavior. Vector/vector, scalar/vector, and vector/scalar paths retain their fast-inline result handling; zero-divisor/null and overflow behavior match the surrounding contracts.

Racing-UT review: no new cluster/process fixture, wait, retry, repeated workload, or unbounded loop was added; the arithmetic corrections are bounded. Exact-head CI run 34768824045 passed, with the function package selected in the race-enabled UT stage. The existing PESSIMISTIC BVT executed dtype/decimal_256.test 16/16 in 0.127s. No material racing-UT time increase is indicated; a full-suite before/after duration comparison was not measured.

@XuPeng-SH
XuPeng-SH merged commit 8130d01 into matrixorigin:main Sep 13, 2026
17 of 20 checks passed
@XuPeng-SH
XuPeng-SH deleted the fix/issues-28774-28775-decimal-div branch September 13, 2026 17:36
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
Fixes matrixorigin#28774 and matrixorigin#28775.

- Preserve full Decimal256 quotients when the D128 fast path is used for
eligible inputs.
- Correct D128 quotient/remainder estimation and half-up rounding for
large divisors.
- Fall back to D256 when a D128 absolute operand is not representable as
positive D128, including MinInt128.
- Add focused UT and distributed regressions for wide results, rounding,
and signed minimum boundaries.

Validation: gofmt and git diff checks pass. Local CGo UT and distributed
BVT were not run because this worktree lacks cgo/libmo.so and required
thirdparties; CI validation is required.
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
Fixes matrixorigin#28774 and matrixorigin#28775.

- Preserve full Decimal256 quotients when the D128 fast path is used for
eligible inputs.
- Correct D128 quotient/remainder estimation and half-up rounding for
large divisors.
- Fall back to D256 when a D128 absolute operand is not representable as
positive D128, including MinInt128.
- Add focused UT and distributed regressions for wide results, rounding,
and signed minimum boundaries.

Validation: gofmt and git diff checks pass. Local CGo UT and distributed
BVT were not run because this worktree lacks cgo/libmo.so and required
thirdparties; CI validation is required.
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
Fixes matrixorigin#28774 and matrixorigin#28775.

- Preserve full Decimal256 quotients when the D128 fast path is used for
eligible inputs.
- Correct D128 quotient/remainder estimation and half-up rounding for
large divisors.
- Fall back to D256 when a D128 absolute operand is not representable as
positive D128, including MinInt128.
- Add focused UT and distributed regressions for wide results, rounding,
and signed minimum boundaries.

Validation: gofmt and git diff checks pass. Local CGo UT and distributed
BVT were not run because this worktree lacks cgo/libmo.so and required
thirdparties; CI validation is required.

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]: DECIMAL256 division wrongly applies a DECIMAL128 result limit to valid quotients

2 participants