Skip to content

Commit

Permalink
fix(rust, python): fix panic in join expressions (#5954)
Browse files Browse the repository at this point in the history
  • Loading branch information
ritchie46 authored Dec 30, 2022
1 parent 5c82197 commit 8e40353
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
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]}

0 comments on commit 8e40353

Please sign in to comment.