32 releases (major breaking)

53.3.0 Nov 20, 2024
53.0.0 Sep 3, 2024
52.2.0 Jul 28, 2024
51.0.0 Mar 18, 2024
29.0.0 Dec 12, 2022

#146 in Data structures

Download history 290129/week @ 2024-08-19 280022/week @ 2024-08-26 255610/week @ 2024-09-02 276878/week @ 2024-09-09 245884/week @ 2024-09-16 279686/week @ 2024-09-23 274479/week @ 2024-09-30 312203/week @ 2024-10-07 279499/week @ 2024-10-14 334195/week @ 2024-10-21 340380/week @ 2024-10-28 285331/week @ 2024-11-04 280875/week @ 2024-11-11 257273/week @ 2024-11-18 177440/week @ 2024-11-25 187149/week @ 2024-12-02

911,890 downloads per month
Used in 419 crates (19 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
~78K SLoC