Skip to content

Filtering UnionArray Incorrect Handles Runs #1598

@tustvold

Description

@tustvold

Describe the bug

The filter kernel attempt to filter runs of contiguous slices, this currently breaks for UnionArrays.

To Reproduce

#[test]
fn test_filter_run_union_array_dense() {
    let mut builder = UnionBuilder::new_dense(3);
    builder.append::<Int32Type>("A", 1).unwrap();
    builder.append::<Int32Type>("A", 3).unwrap();
    builder.append::<Int32Type>("A", 34).unwrap();
    let array = builder.build().unwrap();

    let filter_array = BooleanArray::from(vec![true, true, false]);
    let c = filter(&array, &filter_array).unwrap();
    let filtered = c.as_any().downcast_ref::<UnionArray>().unwrap();

    let mut builder = UnionBuilder::new_dense(3);
    builder.append::<Int32Type>("A", 1).unwrap();
    builder.append::<Int32Type>("A", 3).unwrap();
    let expected = builder.build().unwrap();

    assert_eq!(filtered.data(), expected.data());
}

Expected behavior

The above test should pass

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugquestionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions