Skip to content

Add DataType function to detect nested types #2704

@alamb

Description

@alamb

Is your feature request related to a problem or challenge? Please describe what you are trying to do.
DataFusion handles structured types specially in some cases. It would be nice to have a function in DataType to detect this case such as DataType::is_nested

Ideally it would follow a similar model to https://docs.rs/arrow/22.0.0/arrow/datatypes/enum.DataType.html#method.is_numeric

Describe the solution you'd like
I would like a function like DataType::is_nested() or something similar that returns true for FixedSizeList, LargeList, etc. I think the list is:

    !matches!(
        field.data_type(),
        DataType::List(_)
            | DataType::FixedSizeList(_, _)
            | DataType::LargeList(_)
            | DataType::Struct(_)
            | DataType::Union(_, _, _)
            | DataType::Map(_, _)
    )
}

Describe alternatives you've considered

Additional context
See https://github.com/apache/arrow-datafusion/pull/3380/files#r967640804

Metadata

Metadata

Assignees

No one assigned

    Labels

    arrowChanges to the arrow crateenhancementAny new improvement worthy of a entry in the changeloggood first issueGood for newcomers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions