33 releases (major breaking)

54.0.0 Dec 23, 2024
53.3.0 Nov 20, 2024
53.2.0 Oct 24, 2024
52.2.0 Jul 28, 2024
29.0.0 Dec 12, 2022

#141 in Data structures

Download history 274970/week @ 2024-09-21 277318/week @ 2024-09-28 308215/week @ 2024-10-05 283138/week @ 2024-10-12 320931/week @ 2024-10-19 358586/week @ 2024-10-26 278845/week @ 2024-11-02 284018/week @ 2024-11-09 253088/week @ 2024-11-16 187801/week @ 2024-11-23 189158/week @ 2024-11-30 283107/week @ 2024-12-07 240424/week @ 2024-12-14 99079/week @ 2024-12-21 142138/week @ 2024-12-28 216966/week @ 2025-01-04

747,367 downloads per month
Used in 461 crates (18 directly)

Apache-2.0

2.5MB
53K SLoC

Arrow ordering kernels

Sort RecordBatch

#
let a: ArrayRef = Arc::new(Int32Array::from(vec![1, 2, 3, 4]));
let b: ArrayRef = Arc::new(StringArray::from(vec!["b", "a", "e", "d"]));
let batch = RecordBatch::try_from_iter(vec![("a", a), ("b", b)]).unwrap();

// Sort by column 1
let indices = sort_to_indices(batch.column(1), None, None).unwrap();

// Apply indices to batch columns
let columns = batch.columns().iter().map(|c| take(&*c, &indices, None).unwrap()).collect();
let sorted = RecordBatch::try_new(batch.schema(), columns).unwrap();

let col1 = sorted.column(0).as_primitive::<Int32Type>();
assert_eq!(col1.values(), &[2, 1, 4, 3]);

Dependencies

~3.5–9MB
~77K SLoC