mbutrovich opened a new issue, #12241:
URL: https://github.com/apache/arrow-rs/issues/12241

   ### Is your feature request related to a problem or challenge?
   
   
[`duration_op`](https://github.com/apache/arrow-rs/blob/9c9486188744e80ec86c3b2bcdd649b89945ffe5/arrow-arith/src/numeric.rs#L983-L1001)
 runs `add`, `sub`, `add_wrapping`, and `sub_wrapping` on durations through 
`try_op_ref!` with `add_checked` and `sub_checked`. These return at the first 
overflow, so LLVM doesn't vectorize the loop. #12058 changes checked integer 
`add`, `sub`, and `mul` to compute the wrapping result and an overflow flag in 
one vectorized pass, and to fall back to the checked kernel only when a valid 
row overflowed. Durations are `i64` and could use the same path.
   
   ### Describe the solution you'd like
   
   Once #12058 lands, route the `Add` and `Sub` arms of `duration_op` through 
`overflowing_op` with `i64::add_overflowing` and `sub_overflowing`, and keep 
`try_op_ref!` as the fallback that reports the error. Add 
`duration_add_checked` and `duration_subtract_checked` cases to 
`arithmetic_kernels`, with and without nulls, in a commit before the change.
   
   ### Describe alternatives you've considered
   
   A generic helper in `arity.rs` would also serve direct `try_binary(.., 
add_checked)` callers outside `numeric.rs`. It would be new public API, so it 
should wait for a caller that needs it.
   
   ### Additional context
   
   Raised in 
https://github.com/apache/arrow-rs/pull/12058#pullrequestreview-5894773269.
   
   ### Willingness to contribute
   
   I will contribute this


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

Reply via email to