Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ArrayData::try_new cannot always return expected error. #1707

Closed
HaoYang670 opened this issue May 17, 2022 · 0 comments · Fixed by #1714
Closed

ArrayData::try_new cannot always return expected error. #1707

HaoYang670 opened this issue May 17, 2022 · 0 comments · Fixed by #1714
Labels
arrow Changes to the arrow crate bug

Comments

@HaoYang670
Copy link
Contributor

Find the bug when working on #911.

To Reproduce
Steps to reproduce the behavior:
Just do a small change on https://github.com/apache/arrow-rs/blob/master/arrow/src/array/data.rs#L1734-L1750
Set null_count to be None instead of Some(0)

    #[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,
            None,
            Some(null_bit_buffer),
            0,
            vec![buffer],
            vec![],
        )
        .unwrap();
    }

This test will panic at "range end index 2 out of range for slice of length 1".

Expected behavior
Panic at null_bit_buffer size too small. got 1 needed 2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arrow Changes to the arrow crate bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants