28 changes: 28 additions & 0 deletions ibis/backends/polars/tests/test_join.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
from __future__ import annotations

import pandas as pd
import pandas.testing as tm

import ibis


def test_memtable_join(con):
t1 = ibis.memtable({"x": [1, 2, 3], "y": [4, 5, 6], "z": ["a", "b", "c"]})
t2 = ibis.memtable({"x": [3, 2, 1], "y": [7, 8, 9], "z": ["d", "e", "f"]})
expr = t1.join(t2, "x")

result = con.execute(expr)
expected = pd.DataFrame(
{
"x": [1, 2, 3],
"y": [4, 5, 6],
"z": ["a", "b", "c"],
"x_right": [1, 2, 3],
"y_right": [9, 8, 7],
"z_right": ["f", "e", "d"],
}
)

left = result.sort_values("x").reset_index(drop=True)
right = expected.sort_values("x").reset_index(drop=True)
tm.assert_frame_equal(left, right)
8 changes: 4 additions & 4 deletions ibis/backends/tests/test_interactive.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def table(backend):
return backend.functional_alltypes


@pytest.mark.notimpl(["pandas"])
@pytest.mark.notimpl(["pandas", "polars"])
def test_interactive_execute_on_repr(table, queries, snapshot):
repr(table.bigint_col.sum())
snapshot.assert_match(queries[0], "out.sql")
Expand All @@ -53,21 +53,21 @@ def test_repr_png_is_not_none_in_not_interactive(table):
assert table._repr_png_() is not None


@pytest.mark.notimpl(["pandas"])
@pytest.mark.notimpl(["pandas", "polars"])
def test_default_limit(table, snapshot, queries):
repr(table.select("id", "bool_col"))

snapshot.assert_match(queries[0], "out.sql")


@pytest.mark.notimpl(["pandas"])
@pytest.mark.notimpl(["pandas", "polars"])
def test_respect_set_limit(table, snapshot, queries):
repr(table.select("id", "bool_col").limit(10))

snapshot.assert_match(queries[0], "out.sql")


@pytest.mark.notimpl(["pandas"])
@pytest.mark.notimpl(["pandas", "polars"])
def test_disable_query_limit(table, snapshot, queries):
assert ibis.options.sql.default_limit is None

Expand Down
25 changes: 0 additions & 25 deletions ibis/backends/tests/test_join.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,6 @@ def check_eq(left, right, how, **kwargs):
+ ["sqlite"] * (vparse(sqlite3.sqlite_version) < vparse("3.39"))
),
pytest.mark.xfail_version(datafusion=["datafusion<31"]),
pytest.mark.broken(
["polars"], reason="upstream outer joins are broken"
),
],
),
],
Expand Down Expand Up @@ -141,11 +138,6 @@ def test_filtering_join(backend, batting, awards_players, how):
backend.assert_frame_equal(result, expected, check_like=True)


@pytest.mark.broken(
["polars"],
raises=ValueError,
reason="https://github.com/pola-rs/polars/issues/9335",
)
@pytest.mark.notimpl(["exasol"], raises=com.IbisTypeError)
def test_join_then_filter_no_column_overlap(awards_players, batting):
left = batting[batting.yearID == 2015]
Expand All @@ -159,11 +151,6 @@ def test_join_then_filter_no_column_overlap(awards_players, batting):
assert not q.execute().empty


@pytest.mark.broken(
["polars"],
raises=ValueError,
reason="https://github.com/pola-rs/polars/issues/9335",
)
@pytest.mark.notimpl(["exasol"], raises=com.IbisTypeError)
def test_mutate_then_join_no_column_overlap(batting, awards_players):
left = batting.mutate(year=batting.yearID).filter(lambda t: t.year == 2015)
Expand All @@ -176,11 +163,6 @@ def test_mutate_then_join_no_column_overlap(batting, awards_players):
@pytest.mark.notimpl(["druid"])
@pytest.mark.notyet(["dask"], reason="dask doesn't support descending order by")
@pytest.mark.notyet(["flink"], reason="Flink doesn't support semi joins")
@pytest.mark.broken(
["polars"],
raises=ValueError,
reason="https://github.com/pola-rs/polars/issues/9335",
)
@pytest.mark.parametrize(
"func",
[
Expand Down Expand Up @@ -283,11 +265,6 @@ def test_join_with_pandas_non_null_typed_columns(batting, awards_players):
),
],
)
@pytest.mark.notimpl(
["polars"],
raises=com.TranslationError,
reason="polars doesn't support join predicates",
)
@pytest.mark.notimpl(
["dask"],
raises=TypeError,
Expand Down Expand Up @@ -339,7 +316,6 @@ def test_join_with_trivial_predicate(awards_players, predicate, how, pandas_valu
lambda left: left.filter(lambda t: t.x == 1).select(y=lambda t: t.x),
[("x", "y")],
id="left-xy",
marks=pytest.mark.notyet(["polars"], reason="renaming fails"),
),
param(
"left",
Expand All @@ -355,7 +331,6 @@ def test_join_with_trivial_predicate(awards_players, predicate, how, pandas_valu
lambda left: left.filter(lambda t: t.x == 1).select(y=lambda t: t.x),
[("x", "y")],
id="right-xy",
marks=pytest.mark.notyet(["polars"], reason="renaming fails"),
),
param(
"right",
Expand Down