diff --git a/ibis/backends/tests/test_join.py b/ibis/backends/tests/test_join.py index ff4b0c10358c..f60dadea0952 100644 --- a/ibis/backends/tests/test_join.py +++ b/ibis/backends/tests/test_join.py @@ -164,9 +164,20 @@ def test_mutate_then_join_no_column_overlap(batting, awards_players): @pytest.mark.notimpl(["datafusion", "bigquery", "druid"]) @pytest.mark.notyet(["dask"], reason="dask doesn't support descending order by") -def test_semi_join_topk(batting, awards_players): +@pytest.mark.parametrize( + "func", + [ + param(lambda left, right: left.semi_join(right, "year"), id="method"), + param( + lambda left, right: left.join(right, "year", how="left_semi"), + id="how_left_semi", + ), + param(lambda left, right: left.join(right, "year", how="semi"), id="how_semi"), + ], +) +def test_semi_join_topk(batting, awards_players, func): batting = batting.mutate(year=batting.yearID) - left = batting.semi_join(batting.year.topk(5), "year").select("year", "RBI") + left = func(batting, batting.year.topk(5)).select("year", "RBI") expr = left.join(awards_players, left.year == awards_players.yearID) assert not expr.limit(5).execute().empty diff --git a/ibis/expr/types/relations.py b/ibis/expr/types/relations.py index d7b67134efeb..f5c58210c1c8 100644 --- a/ibis/expr/types/relations.py +++ b/ibis/expr/types/relations.py @@ -2442,7 +2442,7 @@ def join( # semi/anti join only give access to the left table's fields, so # there's never overlap - if how in ("semi", "anti"): + if how in ("left_semi", "semi", "anti"): return expr return ops.relations._dedup_join_columns(expr, lname=lname, rname=rname)