Skip to content

Commit

Permalink
use zip to simplify codes.
Browse files Browse the repository at this point in the history
  • Loading branch information
Rachelint committed Oct 30, 2024
1 parent df81f8f commit 9165799
Showing 1 changed file with 17 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ impl<T: ArrowPrimitiveType, const NULLABLE: bool> GroupColumn
.iter()
.zip(rhs_rows.iter())
.zip(equal_to_results.iter_mut());

for ((&lhs_row, &rhs_row), equal_to_result) in iter {
// Has found not equal to, don't need to check
if !*equal_to_result {
Expand Down Expand Up @@ -344,14 +345,18 @@ where
{
let array = array.as_bytes::<B>();

for (idx, &lhs_row) in lhs_rows.iter().enumerate() {
let iter = lhs_rows
.iter()
.zip(rhs_rows.iter())
.zip(equal_to_results.iter_mut());

for ((&lhs_row, &rhs_row), equal_to_result) in iter {
// Has found not equal to, don't need to check
if !equal_to_results[idx] {
if !*equal_to_results[idx] {
continue;
}

let rhs_row = rhs_rows[idx];
equal_to_results[idx] = self.do_equal_to_inner(lhs_row, array, rhs_row);
*equal_to_results = self.do_equal_to_inner(lhs_row, array, rhs_row);
}
}

Expand Down Expand Up @@ -729,14 +734,18 @@ impl<B: ByteViewType> ByteViewGroupValueBuilder<B> {
) {
let array = array.as_byte_view::<B>();

for (idx, &lhs_row) in group_indices.iter().enumerate() {
let iter = lhs_rows
.iter()
.zip(rhs_rows.iter())
.zip(equal_to_results.iter_mut());

for ((&lhs_row, &rhs_row), equal_to_result) in iter {
// Has found not equal to, don't need to check
if !equal_to_results[idx] {
if !*equal_to_results {
continue;
}

let rhs_row = rows[idx];
equal_to_results[idx] = self.do_equal_to_inner(lhs_row, array, rhs_row);
*equal_to_results = self.do_equal_to_inner(lhs_row, array, rhs_row);
}
}

Expand Down

0 comments on commit 9165799

Please sign in to comment.