Skip to content

Commit

Permalink
Remove queries with warnings in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
wence- committed Jul 19, 2024
1 parent 845f3e5 commit 8877c8d
Showing 1 changed file with 47 additions and 46 deletions.
93 changes: 47 additions & 46 deletions python/cudf_polars/tests/test_join.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,65 +12,68 @@
)


@pytest.mark.parametrize(
"how",
[
"inner",
"left",
"semi",
"anti",
"full",
],
)
@pytest.mark.parametrize("coalesce", [False, True])
@pytest.mark.parametrize(
"join_nulls", [False, True], ids=["nulls_not_equal", "nulls_equal"]
)
@pytest.mark.parametrize(
"join_expr",
[
pl.col("a"),
pl.col("a") * 2,
[pl.col("a"), pl.col("c") + 1],
["c", "a"],
],
)
def test_join(how, coalesce, join_nulls, join_expr):
left = pl.DataFrame(
@pytest.fixture(params=[False, True], ids=["nulls_not_equal", "nulls_equal"])
def join_nulls(request):
return request.param


@pytest.fixture(params=["inner", "left", "semi", "anti", "full"])
def how(request):
return request.param


@pytest.fixture
def left():
return pl.LazyFrame(
{
"a": [1, 2, 3, 1, None],
"b": [1, 2, 3, 4, 5],
"c": [2, 3, 4, 5, 6],
}
).lazy()
right = pl.DataFrame(
)


@pytest.fixture
def right():
return pl.LazyFrame(
{
"a": [1, 4, 3, 7, None, None],
"c": [2, 3, 4, 5, 6, 7],
}
).lazy()
)


@pytest.mark.parametrize(
"join_expr",
[
pl.col("a"),
pl.col("a") * 2,
[pl.col("a"), pl.col("c") + 1],
["c", "a"],
],
)
def test_non_coalesce_join(left, right, how, join_nulls, join_expr):
query = left.join(
right, on=join_expr, how=how, join_nulls=join_nulls, coalesce=coalesce
right, on=join_expr, how=how, join_nulls=join_nulls, coalesce=False
)
assert_gpu_result_equal(query, check_row_order=False)


def test_cross_join():
left = pl.DataFrame(
{
"a": [1, 2, 3, 1, None],
"b": [1, 2, 3, 4, 5],
"c": [2, 3, 4, 5, 6],
}
).lazy()
right = pl.DataFrame(
{
"a": [1, 4, 3, 7, None, None],
"c": [2, 3, 4, 5, 6, 7],
}
).lazy()
@pytest.mark.parametrize(
"join_expr",
[
pl.col("a"),
["c", "a"],
],
)
def test_coalesce_join(left, right, how, join_nulls, join_expr):
query = left.join(
right, on=join_expr, how=how, join_nulls=join_nulls, coalesce=True
)
assert_gpu_result_equal(query, check_row_order=False)


def test_cross_join(left, right):
q = left.join(right, how="cross")

assert_gpu_result_equal(q)
Expand All @@ -79,9 +82,7 @@ def test_cross_join():
@pytest.mark.parametrize(
"left_on,right_on", [(pl.col("a"), pl.lit(2)), (pl.lit(2), pl.col("a"))]
)
def test_join_literal_key_unsupported(left_on, right_on):
left = pl.LazyFrame({"a": [1, 2, 3], "b": [3, 4, 5]})
right = pl.LazyFrame({"a": [1, 2, 3], "b": [5, 6, 7]})
def test_join_literal_key_unsupported(left, right, left_on, right_on):
q = left.join(right, left_on=left_on, right_on=right_on, how="inner")

assert_ir_translation_raises(q, NotImplementedError)

0 comments on commit 8877c8d

Please sign in to comment.