You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2020/05/31 23:46:10 UTC

[GitHub] [arrow] houqp commented on a change in pull request #7193: ARROW-7924: [Rust] Add sort for float types

houqp commented on a change in pull request #7193:
URL: https://github.com/apache/arrow/pull/7193#discussion_r432995131



##########
File path: rust/arrow/src/compute/kernels/sort.rs
##########
@@ -44,8 +46,22 @@ pub fn sort_to_indices(
 ) -> Result<UInt32Array> {
     let options = options.unwrap_or_default();
     let range = values.offset()..values.len();
-    let (v, n): (Vec<usize>, Vec<usize>) =
-        range.partition(|index| values.is_valid(*index));
+    // perform a custom range partition for floats, to account for NaN
+    let (v, n): (Vec<usize>, Vec<usize>) = if values.data_type() == &DataType::Float32 {

Review comment:
       looks like using match would be cleaner here?




----------------------------------------------------------------
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:
users@infra.apache.org