Skip to content

Filtering a struct array with no fields returns incorrect length #7447

Open
@gatesn

Description

@gatesn

Describe the bug
Calling arrow_select filter over a struct array with no fields always returns an array of length zero.

To Reproduce
As above.

Expected behavior
Length should be equal to true-count of the mask.

Additional context
This is yet another example of bugs caused from struct array defaulting length to zero. I strongly think we should change these APIs and absorb the disruption.

This function call is incorrect and should pass the length as true-count:

Ok(unsafe { StructArray::new_unchecked(array.fields().clone(), columns, nulls) })
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions