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.

Regular sorts here alter the actual data. The argsort variants return the indices.

Structs§

ArgsortConfig
Configuration for argsort with algorithm selection

Enums§

SortAlgorithm
Sort algorithm selection for argsort operations

Functions§

argsort
Comparison-based argsort for any Ord type - returns indices that would sort the data
argsort_auto_i32
Argsort for i32 with automatic algorithm selection
argsort_auto_i64
Argsort for i64 with automatic algorithm selection
argsort_auto_u32
Argsort for u32 with automatic algorithm selection
argsort_auto_u64
Argsort for u64 with automatic algorithm selection
argsort_boolean
Argsort for boolean arrays - false sorts before true
argsort_categorical_custom
Argsort for CategoricalArray with custom category order
argsort_categorical_lexical
Argsort for CategoricalArray - lexical ordering by string values
argsort_float
Argsort for floats with proper NaN handling
argsort_radix_i32
LSD Radix argsort for i32 - uses sign-bit flipping for proper signed ordering
argsort_radix_i64
LSD Radix argsort for i64 - uses sign-bit flipping for proper signed ordering
argsort_radix_u32
LSD Radix argsort for u32 - O(n·k) where k=4 (bytes)
argsort_radix_u64
LSD Radix argsort for u64 - O(n·k) where k=8 (bytes)
argsort_str
Argsort for string slices - returns indices that would sort the data lexicographically
argsort_string_array
Argsort for StringArray (offset-based string storage)
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.