peterxcli opened a new pull request, #5440: URL: https://github.com/apache/datafusion-comet/pull/5440
## Which issue does this PR close? Closes #5094. ## Rationale for this change `DecimalRescaleCheckOverflow` duplicates Arrow's Decimal128 cast kernel, including rescaling, HALF_UP rounding, precision validation, and legacy overflow nulling. Reusing Arrow's single-pass implementation removes the duplicate arithmetic and sentinel/null-masking path while preserving legacy and ANSI behavior. ## What changes are included in this PR? - Delegate Decimal128 rescaling and precision checks to `ColumnarValue::cast_to` with Arrow `CastOptions`. - Remove the hand-written rescale, precision-bound, overflow-sentinel, and null-masking logic. - Add coverage for scale-down rounding that crosses the output precision boundary in legacy and ANSI modes. - Update the expression audit documentation for the Arrow-backed implementation. ## How are these changes tested? - `cargo test -p datafusion-comet-spark-expr decimal_rescale_check --lib` (15 passed) - `cargo fmt --all -- --check` - `cargo clippy -p datafusion-comet-spark-expr --all-targets -- -D warnings` - `git diff --check` - `cargo bench -p datafusion-comet-spark-expr --bench decimal_rescale -- --quick` The quick Criterion run was used as a regression screen. Point estimates improved in all measured shapes, although the quick-mode samples were not statistically significant: | Shape | Before | After | | --- | ---: | ---: | | Scale up, no overflow | 241.92 us | 39.708 us | | Scale up, no overflow, nulls | 480.80 us | 45.135 us | | Scale down, no overflow | 999.03 us | 42.780 us | | Sparse overflow | 374.10 us | 36.719 us | | Dense overflow | 364.63 us | 38.451 us | | ANSI scale up, no overflow | 155.48 us | 69.466 us | -- 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]
