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

Take panics on a fixed size list array when given null indices #5169

Closed
westonpace opened this issue Dec 5, 2023 · 0 comments · Fixed by #5170
Closed

Take panics on a fixed size list array when given null indices #5169

westonpace opened this issue Dec 5, 2023 · 0 comments · Fixed by #5170
Labels
arrow Changes to the arrow crate bug

Comments

@westonpace
Copy link
Member

Describe the bug
When running arrow_select::take::take on a FixedSizeListArray and passing in indices that contain null then there is a panic:

thread 'take::tests::test_take_fixed_list_null_indices' panicked at arrow-data/src/data.rs:533:9:
assertion failed: (offset + length) <= self.len()

To Reproduce

    #[test]
    fn test_take_fixed_list_null_indices() {
        let indices = Int32Array::new(vec![0, 1].into(), Some(NullBuffer::from(vec![true, false])));
        let values = Arc::new(Int32Array::from(vec![0, 1, 2, 3]));
        let arr_field = Arc::new(Field::new("item", values.data_type().clone(), true));
        let values = FixedSizeListArray::try_new(arr_field, 2, values, None).unwrap();

        let r = take(&values, &indices, None).unwrap();
        let values = r
            .as_fixed_size_list()
            .values()
            .as_primitive::<Int32Type>()
            .into_iter()
            .collect::<Vec<_>>();
        assert_eq!(&values, &[Some(0), Some(1), None, None])
    }

Expected behavior
There is no panic and the take operation returns what is expected.

Additional context
I encountered this issue running full outer joins in datafusion on batches that have fixed size list arrays in the payloads. The outer join implementation appears to materialize nulls (when one side doesn't match) by using take with null indices.

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