You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: DECIMAL division truncates when scale-up falls back from Decimal128 to Decimal256 #28775
Regression and extended verification for #28775 (2026-09-15)
Verification Environment
MatrixOne source and running binary were both verified at 2ea4ec2e6ef4b20321a235ef416228506813e39b (revert: restore single-runner race UT execution (#28887)), equal to fetched origin/main.
Topology: 2 CN / 1 TN / 1 Log service / Proxy.
Proxy 6001, CN1 16001, and CN2 16002 were reachable and each executed the SQL regression, not only a health check.
Client protocol: MySQL text protocol through the MySQL CLI. The Proxy, CN1, and CN2 SQL runs used isolated temporary databases and ran concurrently.
What Was Covered
OK — The original DECIMAL(38,0) / DECIMAL(38,18) scale-up fallback expression returned 0.123457 on Proxy 6001, CN1 16001, and CN2 16002.
OK — The mathematically equivalent direct Decimal256 control returned 0.123457 on all three endpoints.
OK — The negative original expression returned -0.123457 on all three endpoints.
OK — Round-half-up boundaries returned 0.123456 below half and 0.123457 at and above half.
OK — Inserting the original positive and negative expressions into DECIMAL(65,6) persisted 0.123457 and -0.123457.
OK — The unhappy-path control DECIMAL / 0 returned NULL.
OK — The MOTR case recorded and replayed successfully (14/14).
Not covered — A direct MySQL 8.3 server comparison was not run locally. The direct Decimal256 control and exact fixed-scale expectations provide the local cross-path oracle.
Not covered — The product UT coverage for wide Decimal256 results and signed MinInt128 boundaries from the associated fix was not repeated as a public SQL test; those are distinct internal numeric-domain contracts.
Findings
The associated fix is #28814, merge commit 8130d012ebf5cb0b7d8a94699d981570e9420849, [Bug]: preserve DECIMAL division range and rounding. It is included in the verified main commit.
The fix preserves the full Decimal256 quotient when the Decimal128 fast path cannot safely represent the scale-adjusted calculation, retaining final round-half-up semantics instead of narrowing through a truncated Decimal128 result.
No large-data regression is required: this is scalar arithmetic with a deterministic value/scale boundary, independent of row count, block/batch boundaries, memory, spill, data skew, concurrency, or network transfer. The three endpoint SQL runs were concurrent for test efficiency; they do not claim or replace MatrixOne engine-parallel verification, which is out of scope for this issue.
Source commit: 3cc0768c404ff6a55289b10ca32ce83933dc81b0 (test: add MOTR regression for #28775).
Added suites/14_issue_regression/t/issue_28775_decimal_division_rounding.test and suites/14_issue_regression/r/issue_28775_decimal_division_rounding.result.
The source branch was pushed and tracks origin/test/issue-28775-decimal-division-rounding.
Fixed. The Decimal128 scale-up fallback now preserves correct round-half-up DECIMAL division results on Proxy 6001, CN1 16001, and CN2 16002. Large-data regression is not needed for the reasons above.
Activity
[Bug]: preserve DECIMAL division range and rounding (#28814)
slyunnn commentedon Sep 15, 2026
Regression and extended verification for #28775 (2026-09-15)
Verification Environment
2ea4ec2e6ef4b20321a235ef416228506813e39b(revert: restore single-runner race UT execution (#28887)), equal to fetchedorigin/main.2 CN / 1 TN / 1 Log service / Proxy.6001, CN116001, and CN216002were reachable and each executed the SQL regression, not only a health check.What Was Covered
DECIMAL(38,0) / DECIMAL(38,18)scale-up fallback expression returned0.123457on Proxy6001, CN116001, and CN216002.Decimal256control returned0.123457on all three endpoints.-0.123457on all three endpoints.0.123456below half and0.123457at and above half.DECIMAL(65,6)persisted0.123457and-0.123457.DECIMAL / 0returnedNULL.14/14).8.3server comparison was not run locally. The directDecimal256control and exact fixed-scale expectations provide the local cross-path oracle.MinInt128boundaries from the associated fix was not repeated as a public SQL test; those are distinct internal numeric-domain contracts.Findings
The associated fix is #28814, merge commit
8130d012ebf5cb0b7d8a94699d981570e9420849,[Bug]: preserve DECIMAL division range and rounding. It is included in the verifiedmaincommit.The fix preserves the full Decimal256 quotient when the Decimal128 fast path cannot safely represent the scale-adjusted calculation, retaining final
round-half-upsemantics instead of narrowing through a truncated Decimal128 result.No large-data regression is required: this is scalar arithmetic with a deterministic value/scale boundary, independent of row count, block/batch boundaries, memory, spill, data skew, concurrency, or network transfer. The three endpoint SQL runs were concurrent for test efficiency; they do not claim or replace MatrixOne engine-parallel verification, which is out of scope for this issue.
MOTR / BVT Coverage
test/issue-28775-decimal-division-rounding.3cc0768c404ff6a55289b10ca32ce83933dc81b0(test: add MOTR regression for #28775).suites/14_issue_regression/t/issue_28775_decimal_division_rounding.testandsuites/14_issue_regression/r/issue_28775_decimal_division_rounding.result.origin/test/issue-28775-decimal-division-rounding.matrixorigin/motr#177, cherry-pick commite9c3534d33bc6d1555f9bee9e740be5cec2d4d60.Final Conclusion
Fixed. The Decimal128 scale-up fallback now preserves correct
round-half-upDECIMAL division results on Proxy6001, CN116001, and CN216002. Large-data regression is not needed for the reasons above.[Bug]: preserve DECIMAL division range and rounding (matrixorigin#28814)
[Bug]: preserve DECIMAL division range and rounding (matrixorigin#28814)
[Bug]: preserve DECIMAL division range and rounding (matrixorigin#28814)