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: Don't panic in string_addition_to_linear_concat #15006

Merged
merged 1 commit into from
Mar 12, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -300,12 +300,8 @@ fn string_addition_to_linear_concat(
let schema = lp_arena.get(input).schema(lp_arena);

let get_type = |ae: &AExpr| ae.get_type(&schema, Context::Default, expr_arena).ok();
let type_a = get_type(left_aexpr)
.or_else(|| get_type(right_aexpr))
.unwrap();
let type_b = get_type(right_aexpr)
.or_else(|| get_type(right_aexpr))
.unwrap();
let type_a = get_type(left_aexpr).or_else(|| get_type(right_aexpr))?;
let type_b = get_type(right_aexpr).or_else(|| get_type(right_aexpr))?;

if type_a != type_b {
return None;
Expand Down
6 changes: 6 additions & 0 deletions py-polars/tests/unit/test_errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -699,3 +699,9 @@ def test_error_lazyframe_not_repeating() -> None:

match = "Error originated just after this operation:"
assert str(exc_info).count(match) == 1


def test_raise_not_found_in_simplify_14974() -> None:
df = pl.DataFrame()
with pytest.raises(pl.ColumnNotFoundError):
df.select(1 / (1 + pl.col("a")))
Loading