andygrove opened a new issue, #6974:
URL: https://github.com/apache/datafusion-comet/issues/6974

   ### What is the problem the feature request solves?
   
   `native/spark-expr/src/math_funcs/ceil.rs` and `floor.rs` are the same 
module with `ceil`/`floor` and `div_ceil`/`div_floor` swapped. The `spark_*` 
dispatch, `decimal_*_f`, `decimal_*_pow10::<EXP>` with its i64 fast path, and 
the cold `*_wide` fallback are identical, as are the first seven tests.
   
   - 
[ceil.rs#L18-L297](https://github.com/apache/datafusion-comet/blob/7d8d9b1544b734c85a93cca2cc9d5380ad70accd/native/spark-expr/src/math_funcs/ceil.rs#L18-L297)
   - 
[floor.rs#L18-L353](https://github.com/apache/datafusion-comet/blob/7d8d9b1544b734c85a93cca2cc9d5380ad70accd/native/spark-expr/src/math_funcs/floor.rs#L18-L353)
   
   The copies have already diverged in their tests. `floor.rs` has 
`test_floor_decimal128_i64_boundary_array` and 
`test_floor_decimal128_large_scale_array`, which exercise the i64/i128 switch 
and the runtime fallback. `ceil.rs` has neither, even though 
`decimal_ceil_pow10` has the same boundary logic. Any future fix to the fast 
path has to be made twice, and today only floor's version is tested at the 
boundary.
   
   ### Describe the potential solution
   
   1. Port floor's boundary and large-scale tests to ceil. This is the quick 
win and could land on its own.
   2. Move the shared decimal rounding into `math_funcs/utils.rs`, generic over 
a rounding mode (e.g. a trait with `Ceil`/`Floor` marker types providing the 
i64 and i128 division), and make `spark_ceil`/`spark_floor` thin wrappers over 
one generic function. Parameterise the tests by mode.
   
   ### Additional context
   
   Line references are pinned to commit 7d8d9b1544b7.
   


-- 
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]

Reply via email to