Skip to content
This repository has been archived by the owner on Feb 18, 2024. It is now read-only.

Commit

Permalink
Added missing refactor.
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgecarleitao committed Aug 4, 2021
1 parent 92e2277 commit d545253
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions src/compute/sort/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()`
Expand Down

0 comments on commit d545253

Please sign in to comment.