HaoYang670 commented on issue #911:
URL: https://github.com/apache/arrow-rs/issues/911#issuecomment-1128878058
I find the above bug in the test :
```rust
#[test]
#[should_panic(expected = "null_bit_buffer size too small. got 1 needed
2")]
fn test_bitmap_too_small() {
let buffer = make_i32_buffer(9);
let null_bit_buffer = Buffer::from(vec![0b11111111]);
ArrayData::try_new(
DataType::Int32,
9,
Some(0),
Some(null_bit_buffer),
0,
vec![buffer],
vec![],
)
.unwrap();
}
```
Here we will not calculate the null count in `new_unchecked` because we have
provided a null count `Some(0)`. And when we validate the array data, we will
get the error `ArrayError(null_bit_buffer size too small. ...)`.
However, if we set `null_count` to be `None` in this test, we will panic at
`range end index 2 out of range for slice of length 1` when calling
`count_nulls(null_bit_buffer.as_ref(), offset, len)` in `new_unchecked`.
--
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]