Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion arrow/src/compute/kernels/boolean.rs
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ pub fn not(left: &BooleanArray) -> Result<BooleanArray> {
let null_bit_buffer = data
.null_bitmap()
.as_ref()
.map(|b| b.bits.slice(left_offset));
.map(|b| b.bits.bit_slice(left_offset, len));

let values = buffer_unary_not(&data.buffers()[0], left_offset, len);

Expand Down Expand Up @@ -813,6 +813,19 @@ mod tests {
assert_eq!(c, expected);
}

#[test]
fn test_bool_array_not_sliced() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For anyone interested, without the code change this test fails in the following way:


---- compute::kernels::boolean::tests::test_bool_array_not_sliced stdout ----
thread 'compute::kernels::boolean::tests::test_bool_array_not_sliced' panicked at 'assertion failed: ceil(offset + len, 8) <= buffer.len() * 8', arrow/src/util/bit_chunk_iterator.rs:33:9


failures:
    compute::kernels::boolean::tests::test_bool_array_not_sliced

let a = BooleanArray::from(vec![None, Some(true), Some(false), None, Some(true)]);
let a = a.slice(1, 4);
let a = a.as_any().downcast_ref::<BooleanArray>().unwrap();
let c = not(&a).unwrap();

let expected =
BooleanArray::from(vec![Some(false), Some(true), None, Some(false)]);

assert_eq!(c, expected);
}

#[test]
fn test_bool_array_and_nulls() {
let a = BooleanArray::from(vec![
Expand Down