velvia commented on a change in pull request #8688:
URL: https://github.com/apache/arrow/pull/8688#discussion_r525621539



##########
File path: rust/arrow/src/compute/kernels/boolean.rs
##########
@@ -457,4 +516,20 @@ mod tests {
         assert_eq!(true, res.value(2));
         assert_eq!(false, res.value(3));
     }
+
+    #[test]
+    fn test_nullif_int_array() {
+        let a = Int32Array::from(vec![Some(15), None, Some(8), Some(1), 
Some(9)]);
+        let comp =
+            BooleanArray::from(vec![Some(false), None, Some(true), 
Some(false), None]);
+        let res = nullif(&a, &comp).unwrap();
+
+        assert_eq!(15, res.value(0));
+        assert_eq!(true, res.is_null(1));
+        assert_eq!(true, res.is_null(2)); // comp true, slot 2 turned into null
+        assert_eq!(1, res.value(3));
+        // Even though comp array / right is null, should still pass through 
original value
+        assert_eq!(9, res.value(4));
+        assert_eq!(false, res.is_null(4)); // comp true, slot 2 turned into 
null

Review comment:
       Actually I'm going to borrow `assert_array_eq` from the expressions.rs 
test.




----------------------------------------------------------------
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:
us...@infra.apache.org


Reply via email to