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

fix(rust, python): fix panic in join expressions #5954

Merged
merged 1 commit into from
Dec 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion polars/polars-lazy/polars-plan/src/logical_plan/alp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,7 @@ impl ALogicalPlan {
feature = "streaming"
))]
pub(crate) fn get_input(&self) -> Option<Node> {
let mut inputs = [None];
let mut inputs = [None, None];
self.copy_inputs(&mut inputs);
inputs[0]
}
Expand Down
8 changes: 8 additions & 0 deletions py-polars/tests/unit/test_joins.py
Original file line number Diff line number Diff line change
Expand Up @@ -788,3 +788,11 @@ def test_asof_join_by_logical_types() -> None:
"b": [0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0],
"c": ["1", "2", "3", "1", "2", "3", "1", "2", "3"],
}


def test_join_panic_on_binary_expr_5915() -> None:
df_a = pl.DataFrame({"a": [1, 2, 3]}).lazy()
df_b = pl.DataFrame({"b": [1, 4, 9, 9, 0]}).lazy()

z = df_a.join(df_b, left_on=[(pl.col("a") + 1).cast(int)], right_on=[pl.col("b")])
assert z.collect().to_dict(False) == {"a": [4]}