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
911,890 downloads per month
Used in 419 crates
(19 directly)
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