Skip to content

Commit

Permalink
fix(repr): remove expression printing from exception message
Browse files Browse the repository at this point in the history
  • Loading branch information
cpcloud committed Sep 14, 2024
1 parent 12a235c commit 0e45d4d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
18 changes: 18 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,20 @@ 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)

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

right = a.count()
left = b.count()

expr = left + right

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 0e45d4d

Please sign in to comment.