Skip to content

Make UnionArray::is_dense Method PublicΒ #8503

@jecsand838

Description

@jecsand838

Is your feature request related to a problem or challenge? Please describe what you are trying to do.

In the arrow-array/src/array/union_array.rs file the UnionArray::is_dense method is currently private. Because this method is private, the arrow-avro Encoder requires additional complexity to support Union type encoding to route between Sparse and Dense Union types.

By having UnionArray::is_dense public, we could simplify this and just call is_dense in the UnionEncoder constructor method.

Describe the solution you'd like

In arrow-array/src/array/union_array.rs:

fn is_dense(&self) -> pub fn is_dense(&self)

Describe alternatives you've considered

Re-implementing the same logic inside of the arrow-avro Encoder, i.e.

Additional context

  1. Without Change
        let DataType::Union(fields, UnionMode::Dense) = array.data_type() else {
            return Err(ArrowError::SchemaError("Expected Dense UnionArray".into()));
        };
  1. With Change
        if !array.is_dense() {
            return Err(ArrowError::SchemaError("Expected Dense UnionArray".into()));
        }

Metadata

Metadata

Assignees

No one assigned

    Labels

    arrowChanges to the arrow crateenhancementAny new improvement worthy of a entry in the changelog

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions