mbutrovich opened a new issue, #12173: URL: https://github.com/apache/arrow-rs/issues/12173
### Is your feature request related to a problem or challenge? Part of #11421. Casts from a finer time unit to a coarser one divide every value by `from_size / to_size`, a power of ten that is known once per cast: [1](https://github.com/apache/arrow-rs/blob/6b34163d51aa59f7cac2edcb74e8bd1ddc6b9120/arrow-cast/src/cast/mod.rs#L2218), [2](https://github.com/apache/arrow-rs/blob/6b34163d51aa59f7cac2edcb74e8bd1ddc6b9120/arrow-cast/src/cast/mod.rs#L2423), and [3](https://github.com/apache/arrow-rs/blob/6b34163d51aa59f7cac2edcb74e8bd1ddc6b9120/arrow-cast/src/cast/mod.rs#L2648), which also converts the quotient to `i32` with `safe` handling. ### Describe the solution you'd like Build a `DivisorI64` from #11467 once per cast and divide with it. The divisor is a positive power of ten, never a power of two, so the benchmark must reach the `Up` or `AddIndicator` variant that `new` picks for 1000, 1000000 and 1000000000. The casts truncate toward zero today. Whether a timestamp cast to a coarser unit should floor instead is open in #11602. If that changes, the floor correction from {{02}} applies, and this PR should keep whichever behavior `main` has when it lands. `arrow/benches/cast_kernels.rs` has `Time32` to `Time64` and `Time64` to `Time32` casts. If it lacks cases for the other two sites (the `Duration` and `Timestamp` unit changes), add them in their own commit before the change so the benchmark bot can compare against it. The PR reports before and after numbers, with and without nulls. ### Describe alternatives you've considered None beyond the ones in #11421. The gain is smaller than for the decimal kernels because the divisor is 64-bit, so the PR should show it is worth the change. ### Additional context None. -- 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]
