Skip to content

Flatten using the wrong validity buffer for LargeList(LargeList) #18419

Description

@sdf-jkl

Describe the bug

While working on #18363 I saw an inconsistency within match arm logic for different inner List types for LargeList.

-let (inner_field, inner_offsets, inner_values, nulls) =  // in LargeList(LargeList)
+let (inner_field, inner_offsets, inner_values, _) = // in LargeList(List)
                        as_list_array(&values)?.clone().into_parts();

let flattened_array = GenericListArray::<i64>::new(
                        inner_field,
                        offsets,
                        inner_values,
                        nulls, <------- the validity buffer is used here
                    );

To Reproduce

To reproduce the error, I fixed an existing sqllogictest to have LargeList(nullable LargeList(nullable Int64))
This way when we generate a flattened_array the validity buffer's len and values difference will cause an error.

External error: task 26 panicked with message "called `Result::unwrap()` on an `Err` value: InvalidArgumentError(\"Incorrect length of null buffer for LargeListArray, expected 1 got 5\")"

Expected behavior

The expected behavior is to pass the new sqllogictest

flatten(arrow_cast(make_array([1], null, [2, 3], [null], make_array(4, null, 5)), 'LargeList(LargeList(Int64))')),
----
[1, NULL, 2, 3, NULL, 4, NULL, 5]

Additional context

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions