Function arrow::compute::kernels::sort::sort[][src]

pub fn sort(values: &ArrayRef, options: Option<SortOptions>) -> Result<ArrayRef>
Expand description

Sort the ArrayRef using SortOptions.

Performs a stable sort on values and indices. Nulls are ordered according to the nulls_first flag in options. Floats are sorted using IEEE 754 totalOrder

Returns an ArrowError::ComputeError(String) if the array type is either unsupported by sort_to_indices or take.

Example

let array: ArrayRef = Arc::new(Int32Array::from(vec![5, 4, 3, 2, 1]));
let sorted_array = sort(&array, None).unwrap();
let sorted_array = sorted_array.as_any().downcast_ref::<Int32Array>().unwrap();
assert_eq!(sorted_array, &Int32Array::from(vec![1, 2, 3, 4, 5]));