From d545253e30fa9060e1f74b973df378ef2d82fec2 Mon Sep 17 00:00:00 2001 From: "Jorge C. Leitao" Date: Wed, 4 Aug 2021 16:47:58 +0000 Subject: [PATCH] Added missing refactor. --- src/compute/sort/common.rs | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/compute/sort/common.rs b/src/compute/sort/common.rs index 7b12704bb77..fc3ea0c667e 100644 --- a/src/compute/sort/common.rs +++ b/src/compute/sort/common.rs @@ -127,15 +127,18 @@ where let last_valid_index = length.saturating_sub(validity.null_count()); let mut nulls = 0; let mut valids = 0; - validity.iter().zip(0..length).for_each(|(x, index)| { - if x { - indices[valids] = I::from_usize(index).unwrap(); - valids += 1; - } else { - indices[last_valid_index + nulls] = I::from_usize(index).unwrap(); - nulls += 1; - } - }); + validity + .iter() + .zip(I::range(0, length).unwrap()) + .for_each(|(x, index)| { + if x { + indices[valids] = index; + valids += 1; + } else { + indices[last_valid_index + nulls] = index; + nulls += 1; + } + }); // Soundness: // all indices in `indices` are by construction `< array.len() == values.len()`