Skip to content

Commit

Permalink
[FEAT] Enable broadcast strategy on anti and semi joins (#2621)
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinzwang committed Aug 6, 2024
1 parent 94b4d38 commit aef5999
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 16 deletions.
2 changes: 0 additions & 2 deletions daft/dataframe/dataframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -1497,8 +1497,6 @@ def join(
raise ValueError("Sort merge join only supports inner joins")
elif join_strategy == JoinStrategy.Broadcast and join_type == JoinType.Outer:
raise ValueError("Broadcast join does not support outer joins")
elif join_strategy == JoinStrategy.Broadcast and join_type == JoinType.Anti:
raise ValueError("Broadcast join does not support Anti joins")

left_exprs = self.__column_input_to_expression(tuple(left_on) if isinstance(left_on, list) else (left_on,))
right_exprs = self.__column_input_to_expression(tuple(right_on) if isinstance(right_on, list) else (right_on,))
Expand Down
12 changes: 2 additions & 10 deletions src/daft-plan/src/physical_planner/translate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -548,16 +548,8 @@ pub(super) fn translate_single_logical_node(
"Broadcast join does not support outer joins.".to_string(),
));
}
(JoinType::Anti, _) => {
return Err(common_error::DaftError::ValueError(
"Broadcast join does not support anti joins.".to_string(),
));
}
(JoinType::Semi, _) => {
return Err(common_error::DaftError::ValueError(
"Broadcast join does not support semi joins.".to_string(),
));
}
(JoinType::Anti, _) => true,
(JoinType::Semi, _) => true,
};

if is_swapped {
Expand Down
4 changes: 0 additions & 4 deletions tests/dataframe/test_joins.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ def skip_invalid_join_strategies(join_strategy, join_type):
pytest.skip("Sort merge currently only supports inner joins")
elif join_strategy == "broadcast" and join_type == "outer":
pytest.skip("Broadcast join does not support outer joins")
elif join_strategy == "broadcast" and join_type == "anti":
pytest.skip("Broadcast join does not support anti joins")
elif join_strategy == "broadcast" and join_type == "semi":
pytest.skip("Broadcast join does not support semi joins")


def test_invalid_join_strategies(make_df):
Expand Down

0 comments on commit aef5999

Please sign in to comment.