paddyhoran commented on a change in pull request #9602:
URL: https://github.com/apache/arrow/pull/9602#discussion_r586324951



##########
File path: rust/arrow/src/compute/kernels/sort.rs
##########
@@ -278,12 +347,27 @@ fn sort_boolean(
     let valids_len = valids.len();
     let nulls_len = nulls.len();
 
-    if !descending {
-        valids.sort_by(|a, b| a.1.cmp(&b.1));
-    } else {
-        valids.sort_by(|a, b| a.1.cmp(&b.1).reverse());
-        // reverse to keep a stable ordering
-        nulls.reverse();
+    let mut len = values.len();
+    match limit {
+        Some(limit) => {
+            len = limit.min(len);
+            if !descending {
+                valids.partial_sort(len, |a, b| cmp(a.1, b.1));

Review comment:
       Sorry not "fast path" but would the performance be the same as `sort_by`?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to