HaoYang670 commented on code in PR #2717:
URL: https://github.com/apache/arrow-rs/pull/2717#discussion_r973504534
##########
arrow/src/compute/kernels/arithmetic.rs:
##########
@@ -1225,12 +1143,17 @@ where
pub fn divide_dyn(left: &dyn Array, right: &dyn Array) -> Result<ArrayRef> {
match left.data_type() {
DataType::Dictionary(_, _) => {
- typed_dict_math_op!(left, right, |a, b| a / b,
math_divide_checked_op_dict)
+ typed_dict_math_op!(
+ left,
+ right,
+ |a, b| a.div_checked(b),
Review Comment:
> Err...why you changed it to use div_checked...
divide_dyn is no-overflow checking kernel.
Sorry for the delayed reply @viirya.
`divide_dyn` is a checked kernel I guess:
```rust
/// Perform `left / right` operation on two arrays. If either left or right
value is null
/// then the result is also null. If any right hand value is zero then the
result of this
/// operation will be `Err(ArrowError::DivideByZero)`.
pub fn divide_dyn(left: &dyn Array, right: &dyn Array) -> Result<ArrayRef> {
```
And it used `math_checked_divide_op` and `math_checked_divide_op_on_iters`
to wrap a checking on an unchecked op:
https://github.com/apache/arrow-rs/pull/2717/files#diff-f5fde646664693b58364e63a5dff0c05c82fa28c34e72135bbb9a412be5d53b4L169-L173
What I did is pushing down all checking to the `ArrowNativeTypeOp`, and
there should be no bahaviour changes in the compute kernels
--
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]