Skip to content

Commit

Permalink
Remove sorting to yield sorted_rank (#3693)
Browse files Browse the repository at this point in the history
Co-authored-by: ask <ask@local>
  • Loading branch information
askoa and ask authored Feb 11, 2023
1 parent 5261009 commit 3cf64df
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions arrow-ord/src/sort.rs
Original file line number Diff line number Diff line change
Expand Up @@ -486,8 +486,10 @@ where
fn sorted_rank(sorted_value_indices: &UInt32Array) -> Vec<u32> {
assert_eq!(sorted_value_indices.null_count(), 0);
let sorted_indices = sorted_value_indices.values();
let mut out: Vec<_> = (0..sorted_indices.len() as u32).collect();
out.sort_unstable_by_key(|x| sorted_indices[*x as usize]);
let mut out: Vec<_> = vec![0_u32; sorted_indices.len()];
for (ix, val) in sorted_indices.iter().enumerate() {
out[*val as usize] = ix as u32;
}
out
}

Expand Down

0 comments on commit 3cf64df

Please sign in to comment.