mbutrovich commented on issue #12168: URL: https://github.com/apache/arrow-rs/issues/12168#issuecomment-7048091003
Closing this in favor of the alternative above: the kernels keep their own rounding corrections. Neither arrow-rs kernel that rounds needs a shared helper to use the divisors. [`make_downscaler`](https://github.com/apache/arrow-rs/blob/1b42833a2105efdbb757108c7d15233aa35e9bf5/arrow-cast/src/cast/decimal.rs#L252-L267) and [`divide_and_round`](https://github.com/apache/arrow-rs/blob/1b42833a2105efdbb757108c7d15233aa35e9bf5/arrow-arith/src/arithmetic.rs#L161-L175) already round half away from zero by comparing the remainder with a precomputed `half`. #12169 and #12170 only replace the division that produces `(d, r)`, and the correction after it stays as it is. Both divisors are positive powers of ten, so `half` is exact and the `2 * |r|` overflow described above can't happen. The two kernels are in different crates, and arrow-cast doesn't depend on arrow-arith ([`Cargo.toml`](https://github.com/apache/arrow-rs/blob/1b42833a2105efdbb757108c7d15233aa35e9bf5/arrow-cast/Cargo.toml#L28-L33)). A helper they share would have to be public in arrow-buffer, which makes it permanent API to save about six lines per kernel. Floor, ceiling, and the Euclidean remainder have no callers in arrow-rs. If a downstream project wants them on the divisor types, we can reopen this with that caller in hand. #12169 and #12170 no longer depend on this issue. -- 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]
