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

Cleanup sort #4613

Merged
merged 4 commits into from
Aug 4, 2023
Merged
Show file tree
Hide file tree
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
17 changes: 17 additions & 0 deletions arrow-array/src/cast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -799,6 +799,15 @@ pub trait AsArray: private::Sealed {
self.as_list_opt().expect("list array")
}

/// Downcast this to a [`FixedSizeBinaryArray`] returning `None` if not possible
fn as_fixed_size_binary_opt(&self) -> Option<&FixedSizeBinaryArray>;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This trait is sealed so this isn't a breaking change


/// Downcast this to a [`FixedSizeBinaryArray`] panicking if not possible
fn as_fixed_size_binary(&self) -> &FixedSizeBinaryArray {
self.as_fixed_size_binary_opt()
.expect("fixed size binary array")
}

/// Downcast this to a [`FixedSizeListArray`] returning `None` if not possible
fn as_fixed_size_list_opt(&self) -> Option<&FixedSizeListArray>;

Expand Down Expand Up @@ -848,6 +857,10 @@ impl AsArray for dyn Array + '_ {
self.as_any().downcast_ref()
}

fn as_fixed_size_binary_opt(&self) -> Option<&FixedSizeBinaryArray> {
self.as_any().downcast_ref()
}

fn as_fixed_size_list_opt(&self) -> Option<&FixedSizeListArray> {
self.as_any().downcast_ref()
}
Expand Down Expand Up @@ -885,6 +898,10 @@ impl AsArray for ArrayRef {
self.as_ref().as_list_opt()
}

fn as_fixed_size_binary_opt(&self) -> Option<&FixedSizeBinaryArray> {
self.as_ref().as_fixed_size_binary_opt()
}

fn as_fixed_size_list_opt(&self) -> Option<&FixedSizeListArray> {
self.as_ref().as_fixed_size_list_opt()
}
Expand Down
Loading
Loading