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 DIV rejects a representable integer quotient when scale alignment overflows #28790
SELECT
CAST('0.000000000000000000000000000007'ASDECIMAL(65,30))
DIV
CAST('99999999999999999999999999999999999999999999999999999999999999999'ASDECIMAL(65,0)) AS r;
数学结果和 MySQL 8.3 结果均为 0。MO 在两个 CN 上返回:
ERROR 1690 (22003): Decimal256 IntDiv overflow:
0.000000000000000000000000000007 DIV 999...999
Regression and extended verification for #28790 (2026-09-15)
Verification Environment
MatrixOne source: latest local origin/main at 2ea4ec2e6ef4b20321a235ef416228506813e39b — revert: restore single-runner race UT execution (#28887).
Runtime binary was rebuilt from that commit, restarted, and reported Git commit ID: 2ea4ec2e6e.
Topology: 2 CN / 1 TN / 1 Log service / Proxy.
Endpoints: Proxy 127.0.0.1:6001, CN1 127.0.0.1:16001, and CN2 127.0.0.1:16002; all were reachable before execution.
Client protocol: MySQL text protocol through the mysql client. The original and necessary extended SQL cases were run independently and concurrently across all three endpoints.
What Was Covered
OK — Original DECIMAL(65,30) DIV DECIMAL(65,0) reproduction returned the representable quotient 0 on Proxy 6001, CN1 16001, and CN2 16002.
OK — Scale boundary coverage: both scale=11 and the formerly overflowing scale=12 alignment case returned 0.
OK — Sign controls preserved truncation toward zero for negative numerator and denominator combinations.
OK — Ordinary decimal and integer controls returned 6 for 12.9 DIV 2 and 3 for 7 DIV DECIMAL(10,1).
OK — Table expression, filter, view, and SQL PREPARE / EXECUTE paths returned the same 0 result.
OK — The reverse DECIMAL(65,0) DIV DECIMAL(65,30) case still returned the valid final-range error 1690 / 22003 when the quotient exceeded BIGINT.
OK — The three endpoint checks ran in parallel with isolated client sessions and separate test databases for table-based paths.
Not covered — A local MySQL 8.3.0 instance was not available for a fresh side-by-side execution; expected values follow exact integer division semantics and the issue’s documented MySQL comparison.
Not covered — Large-volume, spill, concurrency-pressure, skew, and network-scale tests are unrelated to this scalar decimal scale-alignment defect.
Findings
The associated fix is MatrixOne PR #28804, merge commit 67a9a4b130388956971888a67fc626784deade48 (fix(decimal): avoid DECIMAL256 MOD/DIV scale overflow). It is an ancestor of the verified origin/main.
The fix avoids materializing an overflowing scale-aligned coefficient for DECIMAL256 DIV, while preserving truncation, signs, null/zero behavior, and final BIGINT range validation.
MOTR source commit: 37a02803c0b7e35c4e8051b1b095997fb87cd3c1 on test/issue-28790-decimal-div-scale. It was cherry-picked as f4e7e0f into daily PR matrixorigin/motr#177.
Final Conclusion
Fixed. The original representable-quotient overflow no longer occurs through Proxy 6001, CN1 16001, or CN2 16002; valid final quotient overflow remains correctly reported as 1690.
Large-data regression is not required: behavior depends on operand precision, scale difference, and scalar quotient range, not on row count, block/batch boundaries, memory/spill, concurrency, data skew, network transfer, or cluster resource scale.
Activity
fix(decimal): avoid DECIMAL256 MOD/DIV scale overflow (#28804)
slyunnn commentedon Sep 15, 2026
Regression and extended verification for #28790 (2026-09-15)
Verification Environment
origin/mainat2ea4ec2e6ef4b20321a235ef416228506813e39b—revert: restore single-runner race UT execution (#28887).Git commit ID: 2ea4ec2e6e.2 CN / 1 TN / 1 Log service / Proxy.127.0.0.1:6001, CN1127.0.0.1:16001, and CN2127.0.0.1:16002; all were reachable before execution.mysqlclient. The original and necessary extended SQL cases were run independently and concurrently across all three endpoints.What Was Covered
DECIMAL(65,30) DIV DECIMAL(65,0)reproduction returned the representable quotient0on Proxy6001, CN116001, and CN216002.scale=11and the formerly overflowingscale=12alignment case returned0.6for12.9 DIV 2and3for7 DIV DECIMAL(10,1).PREPARE/EXECUTEpaths returned the same0result.DECIMAL(65,0) DIV DECIMAL(65,30)case still returned the valid final-range error1690/22003when the quotient exceededBIGINT.8.3.0instance was not available for a fresh side-by-side execution; expected values follow exact integer division semantics and the issue’s documented MySQL comparison.Findings
The associated fix is MatrixOne PR #28804, merge commit
67a9a4b130388956971888a67fc626784deade48(fix(decimal): avoid DECIMAL256 MOD/DIV scale overflow). It is an ancestor of the verifiedorigin/main.The fix avoids materializing an overflowing scale-aligned coefficient for
DECIMAL256 DIV, while preserving truncation, signs, null/zero behavior, and finalBIGINTrange validation.MOTR / BVT Coverage
Added and recorded/replayed:
suites/14_issue_regression/t/issue_28790_decimal_div_scale.testsuites/14_issue_regression/r/issue_28790_decimal_div_scale.resultMOTR source commit:
37a02803c0b7e35c4e8051b1b095997fb87cd3c1ontest/issue-28790-decimal-div-scale. It was cherry-picked asf4e7e0finto daily PR matrixorigin/motr#177.Final Conclusion
Fixed. The original representable-quotient overflow no longer occurs through Proxy
6001, CN116001, or CN216002; valid final quotient overflow remains correctly reported as1690.Large-data regression is not required: behavior depends on operand precision, scale difference, and scalar quotient range, not on row count, block/batch boundaries, memory/spill, concurrency, data skew, network transfer, or cluster resource scale.
fix(decimal): avoid DECIMAL256 MOD/DIV scale overflow (matrixorigin#2…
fix(decimal): avoid DECIMAL256 MOD/DIV scale overflow (matrixorigin#2…
fix(decimal): avoid DECIMAL256 MOD/DIV scale overflow (matrixorigin#2…