This is an automated email from the ASF dual-hosted git repository.

dheres pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow-rs.git


The following commit(s) were added to refs/heads/master by this push:
     new 3cf64df5a Remove sorting to yield sorted_rank (#3693)
3cf64df5a is described below

commit 3cf64df5afc3e5ba7003b1a473740639a507f625
Author: askoa <[email protected]>
AuthorDate: Sat Feb 11 17:47:05 2023 -0500

    Remove sorting to yield sorted_rank (#3693)
    
    Co-authored-by: ask <ask@local>
---
 arrow-ord/src/sort.rs | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/arrow-ord/src/sort.rs b/arrow-ord/src/sort.rs
index f36e91d64..207f499ef 100644
--- a/arrow-ord/src/sort.rs
+++ b/arrow-ord/src/sort.rs
@@ -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
 }
 

Reply via email to