Skip to content

Commit

Permalink
Cleanup sort (#4613)
Browse files Browse the repository at this point in the history
* Cleanup sort

* Add inline

* Further cleanup

* Further sort benchmark fixes
  • Loading branch information
tustvold authored Aug 4, 2023
1 parent 841a6a9 commit a81da6c
Show file tree
Hide file tree
Showing 3 changed files with 196 additions and 632 deletions.
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>;

/// 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

0 comments on commit a81da6c

Please sign in to comment.