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::is_nested() #2707

Merged
merged 2 commits into from
Sep 12, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions arrow/src/datatypes/datatype.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1439,6 +1439,20 @@ impl DataType {
)
}

/// Returns true if this type is nested (List, FixedSizeList, LargeList, Struct, Union, or Map)
pub fn is_nested(t: &DataType) -> bool {
use DataType::*;
matches!(
t,
List(_)
| FixedSizeList(_, _)
| LargeList(_)
| Struct(_)
| Union(_, _, _)
| Map(_, _)
)
}

/// Compares the datatype with another, ignoring nested field names
/// and metadata.
pub fn equals_datatype(&self, other: &DataType) -> bool {
Expand Down