Skip to content

Commit

Permalink
fix(rust, python): check chunks before doing chunked_id join optimiza… (
Browse files Browse the repository at this point in the history
  • Loading branch information
ritchie46 committed Nov 22, 2022
1 parent bd9cbcf commit 7c12f16
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions polars/polars-core/src/frame/hash_join/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -880,8 +880,22 @@ impl DataFrame {
) -> PolarsResult<DataFrame> {
#[cfg(feature = "dtype-categorical")]
check_categorical_src(s_left.dtype(), s_right.dtype())?;
let ids = sort_or_hash_left(s_left, s_right, verbose);
self.finish_left_join(ids, &other.drop(s_right.name()).unwrap(), suffix, slice)

// ensure that the chunks are aligned otherwise we go OOB
let mut left = self.clone();
let mut s_left = s_left.clone();
let mut right = other.clone();
let mut s_right = s_right.clone();
if left.should_rechunk() {
left.as_single_chunk_par();
s_left = s_left.rechunk();
}
if right.should_rechunk() {
right.as_single_chunk_par();
s_right = s_right.rechunk();
}
let ids = sort_or_hash_left(&s_left, &s_right, verbose);
left.finish_left_join(ids, &right.drop(s_right.name()).unwrap(), suffix, slice)
}

#[cfg(feature = "semi_anti_join")]
Expand Down

0 comments on commit 7c12f16

Please sign in to comment.