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(repr): remove expression printing from exception message #10130

Merged
merged 1 commit into from
Sep 15, 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
16 changes: 16 additions & 0 deletions ibis/backends/tests/test_interactive.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import pytest

import ibis
import ibis.common.exceptions as exc
from ibis import config


Expand Down Expand Up @@ -89,3 +90,18 @@ def test_isin_rule_suppressed_exception_repr_not_fail(table):
expr = table.filter(bool_clause)["string_col"].value_counts()

repr(expr)


def test_no_recursion_error(con, monkeypatch):
monkeypatch.setattr(ibis.options, "interactive", True)
monkeypatch.setattr(ibis.options, "default_backend", con)

a = ibis.memtable({"a": [1]})
b = ibis.memtable({"b": [1]})

expr = a.count() + b.count()

with pytest.raises(
exc.RelationError, match="The scalar expression cannot be converted"
):
repr(expr)
2 changes: 1 addition & 1 deletion ibis/expr/types/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -1366,7 +1366,7 @@ def as_table(self) -> ir.Table:
return parent.to_expr().aggregate(self)
else:
raise com.RelationError(
f"The scalar expression {self} cannot be converted to a "
"The scalar expression cannot be converted to a "
"table expression because it involves multiple base table "
"references"
)
Expand Down