rluvaton commented on code in PR #8711:
URL: https://github.com/apache/arrow-rs/pull/8711#discussion_r2466866156
##########
arrow-select/src/zip.rs:
##########
@@ -279,4 +294,110 @@ mod test {
let expected = Int32Array::from(vec![None, None, Some(42), Some(42),
None]);
assert_eq!(actual, &expected);
}
+
+ #[test]
+ fn
test_zip_kernel_primitive_scalar_with_boolean_array_mask_with_nulls_should_be_treated_as_false()
+ {
+ let scalar_truthy = Scalar::new(Int32Array::from_value(42, 1));
+ let scalar_falsy = Scalar::new(Int32Array::from_value(123, 1));
+
+ let mask = {
+ let booleans = BooleanBuffer::from(vec![true, true, false, true,
false, false]);
+ let nulls = NullBuffer::from(vec![
+ true, true, true,
+ false, // null treated as false even though in the original
mask it was true
+ true, true,
+ ]);
+ BooleanArray::new(booleans, Some(nulls))
+ };
+ let out = zip(&mask, &scalar_truthy, &scalar_falsy).unwrap();
+ let actual = out.as_any().downcast_ref::<Int32Array>().unwrap();
+ let expected = Int32Array::from(vec![
+ Some(42),
+ Some(42),
+ Some(123),
+ Some(123), // true in mask but null
+ Some(123),
+ Some(123),
+ ]);
+ assert_eq!(actual, &expected);
+ }
+
+ #[test]
+ fn
test_zip_primitive_array_with_nulls_is_mask_should_be_treated_as_false() {
+ let scalar_truthy = Int32Array::from_iter_values(vec![1, 2, 3, 4, 5,
6]);
+ let scalar_falsy = Int32Array::from_iter_values(vec![7, 8, 9, 10, 11,
12]);
Review Comment:
will fix now, thanks
--
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]