jorgecarleitao commented on a change in pull request #9454:
URL: https://github.com/apache/arrow/pull/9454#discussion_r576544330
##########
File path: rust/arrow/src/compute/kernels/arithmetic.rs
##########
@@ -709,6 +906,18 @@ mod tests {
assert_eq!(9, c.value(4));
}
+ #[test]
+ fn test_primitive_array_divide_scalar() {
+ let a = Int32Array::from(vec![15, 14, 9, 8, 1]);
+ let b = 3;
+ let c = divide_scalar(&a, b).unwrap();
+ assert_eq!(5, c.value(0));
+ assert_eq!(4, c.value(1));
+ assert_eq!(3, c.value(2));
+ assert_eq!(2, c.value(3));
+ assert_eq!(0, c.value(4));
+ }
+
Review comment:
What do you think about adding a test with nulls? E.g.
```
let a = Int32Array::from(vec![Some(15), None, Some(9), 2, None]);
```
##########
File path: rust/arrow/src/compute/kernels/arithmetic.rs
##########
@@ -709,6 +906,18 @@ mod tests {
assert_eq!(9, c.value(4));
}
+ #[test]
+ fn test_primitive_array_divide_scalar() {
+ let a = Int32Array::from(vec![15, 14, 9, 8, 1]);
+ let b = 3;
+ let c = divide_scalar(&a, b).unwrap();
+ assert_eq!(5, c.value(0));
+ assert_eq!(4, c.value(1));
+ assert_eq!(3, c.value(2));
+ assert_eq!(2, c.value(3));
+ assert_eq!(0, c.value(4));
Review comment:
```
let expected = Int32Array::from(vec![5, 4, 3, 2, 1]);
assert_eq!(c, expected);
```
so that we check all parts of `ArrayData`?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]