jhorstmann commented on code in PR #7937: URL: https://github.com/apache/arrow-rs/pull/7937#discussion_r2210905229
########## 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: I did not call `Array::null_count` outside the match because that would be another dynamic dispatch, the impact would probably not be measurable though. `NullBuffer::null_count` is annotated `#[inline]` and just returns a field, so almost guaranteed to have no overhead. -- 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