Skip to content

Conversation

Gusabary
Copy link
Contributor

@Gusabary Gusabary commented Sep 11, 2025

solves #24157

while i am not sure whether it's really desired behavior to expand expression for join, for example test_join_on_nth_error would fail with this change

can add more tests if this behavior change is aligned eventually

@github-actions github-actions bot added enhancement New feature or an improvement of an existing feature python Related to Python Polars rust Related to Rust Polars labels Sep 11, 2025
@orlp
Copy link
Member

orlp commented Sep 12, 2025

def test_join_on_nth_error() -> None:
    df = pl.DataFrame({"x": [1]})
    df2 = pl.DataFrame({"x": [1], "y": [2]})
    with pytest.raises(
        InvalidOperationError,
    ):
        df.join(df2, on=pl.first())

What behavior does this now have in your PR?

@Gusabary
Copy link
Contributor Author

What behavior does this now have in your PR?

df = pl.DataFrame({"x": [1]})
df2 = pl.DataFrame({"x": [1], "y": [2]})
print(df.join(df2, on=pl.first()))
┌─────┬─────┐
│ xy   │
│ ------ │
│ i64i64 │
╞═════╪═════╡
│ 12   │
└─────┴─────┘

df = pl.DataFrame({"a": [1]})
df2 = pl.DataFrame({"x": [1], "y": [2]})
print(df.join(df2, on=pl.first()))
┌─────┬─────┐
│ ay   │
│ ------ │
│ i64i64 │
╞═════╪═════╡
│ 12   │
└─────┴─────┘

@ritchie46 ritchie46 force-pushed the main branch 3 times, most recently from ddf5907 to d0914d4 Compare September 27, 2025 11:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or an improvement of an existing feature python Related to Python Polars rust Related to Rust Polars

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants