Skip to content

Commit

Permalink
Remove on from cross join tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mcrumiller committed Sep 22, 2024
1 parent aea3c33 commit db3a52c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 18 deletions.
2 changes: 1 addition & 1 deletion py-polars/tests/unit/dataframe/test_df.py
Original file line number Diff line number Diff line change
Expand Up @@ -2145,7 +2145,7 @@ def test_join_suffixes() -> None:
join_strategies: list[JoinStrategy] = ["left", "inner", "full", "cross"]
for how in join_strategies:
# no need for an assert, we error if wrong
df_a.join(df_b, on="A", suffix="_y", how=how)["B_y"]
df_a.join(df_b, on="A" if how != "cross" else None, suffix="_y", how=how)["B_y"]

df_a.join_asof(df_b, on=pl.col("A").set_sorted(), suffix="_y")["B_y"]

Expand Down
2 changes: 1 addition & 1 deletion py-polars/tests/unit/operations/test_cross_join.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def test_cross_join_predicate_pushdown_block_16956() -> None:
).cast(pl.Datetime("ms", "Europe/Amsterdam"))

assert (
lf.join(lf, on="start_datetime", how="cross")
lf.join(lf, how="cross")
.filter(
pl.col.end_datetime_right.is_between(
pl.col.start_datetime, pl.col.start_datetime.dt.offset_by("132h")
Expand Down
20 changes: 4 additions & 16 deletions py-polars/tests/unit/streaming/test_streaming_join.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,26 +103,14 @@ def test_streaming_joins() -> None:


def test_streaming_cross_join_empty() -> None:
df1 = pl.LazyFrame(
data={
"col1": ["a"],
}
)
df1 = pl.LazyFrame(data={"col1": ["a"]})

df2 = pl.LazyFrame(
data={
"col1": [],
},
schema={
"col1": str,
},
data={"col1": []},
schema={"col1": str},
)

out = df1.join(
df2,
how="cross",
on="col1",
).collect(streaming=True)
out = df1.join(df2, how="cross").collect(streaming=True)
assert out.shape == (0, 2)
assert out.columns == ["col1", "col1_right"]

Expand Down

0 comments on commit db3a52c

Please sign in to comment.