Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add DataType function to detect nested types #2704

Closed
alamb opened this issue Sep 12, 2022 · 4 comments · Fixed by #2707
Closed

Add DataType function to detect nested types #2704

alamb opened this issue Sep 12, 2022 · 4 comments · Fixed by #2707
Labels
arrow Changes to the arrow crate enhancement Any new improvement worthy of a entry in the changelog good first issue Good for newcomers

Comments

@alamb
Copy link
Contributor

alamb commented Sep 12, 2022

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

@alamb alamb added arrow Changes to the arrow crate enhancement Any new improvement worthy of a entry in the changelog good first issue Good for newcomers labels Sep 12, 2022
@alamb
Copy link
Contributor Author

alamb commented Sep 12, 2022

This is a pretty straightforward feature to add and would be a great way for someone to contribute

@kfastov
Copy link
Contributor

kfastov commented Sep 12, 2022

This is my first pull request here, any comments are welcome

@alamb
Copy link
Contributor Author

alamb commented Sep 16, 2022

Automatically added labels {'logical-expr'} from #3380

@alamb alamb added the core label Sep 16, 2022
@alamb
Copy link
Contributor Author

alamb commented Sep 16, 2022

Automatically added labels {'core'} from #3380

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arrow Changes to the arrow crate enhancement Any new improvement worthy of a entry in the changelog good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants