jhorstmann commented on code in PR #7937:
URL: https://github.com/apache/arrow-rs/pull/7937#discussion_r2213141022


##########
arrow-ord/src/sort.rs:
##########
@@ -180,13 +180,36 @@ where
 
 // partition indices into valid and null indices
 fn partition_validity(array: &dyn Array) -> (Vec<u32>, Vec<u32>) {
-    match array.null_count() {
-        // faster path
-        0 => ((0..(array.len() as u32)).collect(), vec![]),
-        _ => {
-            let indices = 0..(array.len() as u32);
-            indices.partition(|index| array.is_valid(*index as usize))
+    let len = array.len();
+    match array.nulls() {
+        Some(nulls) if nulls.null_count() > 0 => {
+            let mut valid_indices = Vec::with_capacity(len - 
nulls.null_count());

Review Comment:
   Updated to assign `Array::null_count` to a variable, on 2nd thought that 
seems clearer than relying on inlining.



-- 
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.

To unsubscribe, e-mail: github-unsubscr...@arrow.apache.org

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

Reply via email to