Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /home/zhenxiangba/zhenxiangba.com/public_html/phproxy-improved-master/index.php on line 456
sort in datafusion::common::arrow::compute - Rust
[go: Go Back, main page]

Function sort

Source
pub fn sort(
    values: &dyn Array,
    options: Option<SortOptions>,
) -> Result<Arc<dyn Array>, ArrowError>
Expand description

Sort the ArrayRef using SortOptions.

Performs a 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.

Note: this is an unstable_sort, meaning it may not preserve the order of equal elements.

ยงExample

let array = Int32Array::from(vec![5, 4, 3, 2, 1]);
let sorted_array = sort(&array, None).unwrap();
assert_eq!(sorted_array.as_ref(), &Int32Array::from(vec![1, 2, 3, 4, 5]));