sunchao opened a new pull request, #7811: URL: https://github.com/apache/datafusion-comet/pull/7811
## Which issue does this PR close? Closes #7810. ## Why are the changes needed? Comet computes decimal width in i16, but Arrow's narrow add/subtract still evaluates precision minus scale in i8. At precision 3 and scale -125, that intermediate is 128. For operands with very different scales, Comet's wide kernel can also exceed the i256 power or coefficient limit before it checks the result. ## What changes were proposed in this PR? * Use the existing wide native kernel when the integer-digit count exceeds 127. At precision 3, scale -124 stays on the narrow path. * Keep i256 when the aligned coefficients and rescaling factors fit the conservative 76-digit bound. Otherwise compute the operation exactly in BigInt, round once with HALF_UP and check the target precision. Overflow produces a Spark numeric error in ANSI mode and NULL in TRY or legacy mode. * Multiplication and remainder are unchanged. No new dependency or configuration is needed. ## How was this PR tested? Added Rust tests for both planner boundaries, the 76/77-digit transition, signed rounding, ANSI error values, NULL inputs and overflow masking. Added a Spark integration test for native `try_add` and `try_subtract` at scale -128. Tests are delegated to fork CI. No tests were run locally. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
