Skip to content

Commit

Permalink
fix(repr): remove expression printing from exception message (#10130)
Browse files Browse the repository at this point in the history
  • Loading branch information
cpcloud committed Sep 15, 2024
1 parent 12a235c commit 8a260a8
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
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

0 comments on commit 8a260a8

Please sign in to comment.