Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cross-join should not work on any key #17303

Closed
FBruzzesi opened this issue Jun 30, 2024 · 1 comment · Fixed by #17305
Closed

cross-join should not work on any key #17303

FBruzzesi opened this issue Jun 30, 2024 · 1 comment · Fixed by #17305
Assignees
Labels
accepted Ready for implementation enhancement New feature or an improvement of an existing feature

Comments

@FBruzzesi
Copy link
Contributor

FBruzzesi commented Jun 30, 2024

Description

This is borderline between a bug, a documentation and a feature request.

Cross join's ignore join keys and whatever can be passed as keys.
This is not documented, and it may seem counterintuitive to a user.

Minimal reproducible example:

import polars as pl

df = pl.DataFrame({
    "a": [0, 1],
    "b": ["x", "y"]
})

df.join(df, how="cross")
df.join(df, how="cross", left_on="a", right_on="b")
df.join(df, how="cross", left_on="a", right_on="c")  # c doesn't even exist

All 3 operations above lead to the same result.

I know we should not compare with pandas, but in this occasion, I feel like the fact that an error is raised if keys are passed is more intuitive for a user.

@FBruzzesi FBruzzesi added the enhancement New feature or an improvement of an existing feature label Jun 30, 2024
@FBruzzesi FBruzzesi changed the title cross-join should not work on _any_ key cross-join should not work on any key Jun 30, 2024
@ritchie46
Copy link
Member

We should raise an error indeed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepted Ready for implementation enhancement New feature or an improvement of an existing feature
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants