Skip to content

Commit

Permalink
refactor: address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
iajoiner committed Dec 18, 2024
1 parent a90e584 commit 9a535e1
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions crates/proof-of-sql/src/base/database/join_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,16 +102,17 @@ fn get_sort_merge_join_indexes<'a, S: Scalar>(
})
.collect();

// Advance the iterators
left_iter.nth(left_group.len() - 1);
right_iter.nth(right_group.len() - 1);

// Generate all pairs (Cartesian product)
let pairs: Vec<_> = left_group
.iter()
.flat_map(|&l| right_group.iter().map(move |&r| (l, r)))
.cartesian_product(right_group.iter())
.map(|(&lidx, &ridx)| (lidx, ridx))
.collect();

// Advance the iterators
left_iter.nth(left_group.len() - 1);
right_iter.nth(right_group.len() - 1);

Some(pairs)
}
}
Expand Down

0 comments on commit 9a535e1

Please sign in to comment.