velvia commented on a change in pull request #8688: URL: https://github.com/apache/arrow/pull/8688#discussion_r525618283
########## 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: So looks like the problem with the above is somehow the equality test fails: ``` thread 'compute::kernels::boolean::tests::test_nullif_int_array' panicked at 'assertion failed: `(left == right)` left: `PrimitiveArray<Int32> [ 15, null, null, 1, 9, ]`, right: `PrimitiveArray<Int32> [ 15, null, null, 1, 9, ]`', arrow/src/compute/kernels/boolean.rs:537:9 ``` My guess is that the equality test compares the data() elements, and the data buffer elements for the null ones are not identical, even though it should not matter (null elements should just check the null bitmap). Some possibilities: - Create a different equality method, maybe a test Trait like `SemanticallyEqual` or something - revert back to the old way of testing these arrays ??? @jorgecarleitao ---------------------------------------------------------------- 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