-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Open
Labels
Description
Describe the bug
The take implementation for DataType::FixedSizeBinary does not consider the nullability of indices. If an index is null, the output value of the kernel should also be null. This is not the case for fixed size binary arrays.
To Reproduce
#[test]
fn test_take_fixed_size_binary_with_nulls_indices() {
let fsb = FixedSizeBinaryArray::try_from_sparse_iter_with_size(
[
Some(vec![0x01, 0x01, 0x01, 0x01]),
Some(vec![0x02, 0x02, 0x02, 0x02]),
Some(vec![0x03, 0x03, 0x03, 0x03]),
Some(vec![0x04, 0x04, 0x04, 0x04]),
]
.into_iter(),
4,
)
.unwrap();
// The two middle indices are null -> Should be null in the output.
let indices = UInt32Array::from(vec![Some(0), None, None, Some(3)]);
let result = take_fixed_size_binary(&fsb, &indices, 4).unwrap();
assert_eq!(result.len(), 4);
assert_eq!(result.null_count(), 2); // <---- Returns 0
assert_eq!(
result.nulls().unwrap().iter().collect::<Vec<_>>(),
vec![true, false, false, true]
);
}Expected behavior
2 Null values in the result
Additional context
Surfaced while looking at apache/datafusion#19067