Module sort

Module sort 

Source
Expand description

§Sorting Algorithms Kernels Module - Array Sorting and Ordering Operations

Sorting kernels for ordering operations across Arrow-compatible data types with null-aware semantics and optimised comparison strategies. Essential foundation for analytical operations requiring ordered data access and ranking computations.

Functions§

sort_boolean_array
Sorts a BooleanArray in-place by value: all false first, then true. Nulls sort first if present.
sort_categorical_lexical
Sorts a CategoricalArray lexically by its unique values, returning new indices and mask. The category dictionary is preserved. Nulls sort first.
sort_float
Total ordering for f32/f64 as per IEEE 754
sort_int
Performs in-place unstable sorting of integer slices with optimal performance.
sort_slice_with_mask
Sorts array data and applies the same permutation to the null mask.
sort_str
Performs in-place unstable sorting of string slice references with lexicographic ordering.
sort_string_array
For StringArray as contiguous utf8 buffer plus offsets. Assumes offsets + values as in minarrow StringArray.
sorted_float
Returns a newly sorted Vec64, leaving the original slice untouched.
sorted_int
Creates a new sorted copy of integer data in a Vec64 container.
sorted_str
Creates a new sorted collection of owned strings from string references.
total_cmp_f
TLDR: Instead of comparing the raw bit patterns directly (which places all negative‐sign bit values after the positives), we transform each bit pattern into a “sort key”: => If the sign bit is 1 (negative or negative‐NaN), we invert all bits: !bits. => Otherwise (sign bit 0), we flip only the sign bit: bits ^ 0x80…0.