parthchandra commented on code in PR #4323:
URL: https://github.com/apache/arrow-rs/pull/4323#discussion_r1212025802
##########
arrow-cast/src/cast.rs:
##########
@@ -1853,7 +1853,7 @@ pub fn cast_with_options(
if time_array.is_null(i) {
b.append_null();
} else {
- b.append_value((time_array.value(i) / from_size) as i32);
+
b.append_value(num::integer::div_floor::<i64>(time_array.value(i), from_size)
as i32);
Review Comment:
Something like
```
let pre_epoch_adjustment = if value(i) < 0 { -1 } else {
0 };
b.append_value(pre_epoch_adjustment +
(time_array.value(i) / from_size) as i32);
```
might be faster (because it skips all the check made by `div_floor`) ?
--
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]