Skip to content

StructArray take returns incorrect length with empty fields #6732

Closed
@gatesn

Description

@gatesn

Describe the bug
Calling compute::take on a struct array with zero fields results in an array with length == 0, regardless of the length of the take array.

Expected behavior
The result should be a struct array with no fields and length == take_indices.len()

Additional context
In my own code I've found it too easy to drop struct array lengths. I wonder if it's worth:

  • Adding StructArray::try_new(fields, arrays, nulls, length)
  • Making StructArray::try_new(fields, arrays, nulls) return an error for empty fields instead of picking a default length

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