diff --git a/ibis/backends/pandas/executor.py b/ibis/backends/pandas/executor.py index b895d892dbac..5c97bd270415 100644 --- a/ibis/backends/pandas/executor.py +++ b/ibis/backends/pandas/executor.py @@ -110,6 +110,10 @@ def visit(cls, op: ops.Value, **operands): if func := cls.kernels.generic.get(typ): return cls.generic(func, **kwargs) + if len(operands) < 1: + raise OperationNotDefinedError( + f"No implementation found for operation {typ}" + ) _, *rest = operands.values() is_multi_arg = bool(rest) is_multi_column = any_of(rest, pd.Series) diff --git a/ibis/expr/operations/generic.py b/ibis/expr/operations/generic.py index 754029e292b5..a33abd28bfae 100644 --- a/ibis/expr/operations/generic.py +++ b/ibis/expr/operations/generic.py @@ -185,13 +185,7 @@ class Constant(Scalar, Singleton): @public class Impure(Value): - _counter = itertools.count() - uid: Optional[int] = None - - def __init__(self, uid, **kwargs): - if uid is None: - uid = next(self._counter) - super().__init__(uid=uid, **kwargs) + pass @public diff --git a/ibis/expr/operations/tests/test_generic.py b/ibis/expr/operations/tests/test_generic.py index c7f4f17873db..e0e5eb4c7a98 100644 --- a/ibis/expr/operations/tests/test_generic.py +++ b/ibis/expr/operations/tests/test_generic.py @@ -146,10 +146,6 @@ def test_NULL(): @pytest.mark.parametrize("op", [ops.RandomScalar, ops.RandomUUID]) -def test_unique_impure_values(op): - assert op() != op() - assert hash(op()) != hash(op()) - - node = op() - other = node.copy() - assert node == other +def test_impure_values_are_equal(op): + assert op() == op() + assert hash(op()) == hash(op()) diff --git a/ibis/expr/tests/test_newrels.py b/ibis/expr/tests/test_newrels.py index 9635459d4314..276cd6607bb5 100644 --- a/ibis/expr/tests/test_newrels.py +++ b/ibis/expr/tests/test_newrels.py @@ -1618,7 +1618,7 @@ def test_impure_operation_dereferencing(func): expected = ops.Project( parent=t1, - values={"x": t1.x, "y": t1.y, "z": t1.y.cast("string")}, + values={"x": t1.x, "y": t1.y, "z": impure.cast("string")}, ) assert t2.op() == expected diff --git a/ibis/expr/types/relations.py b/ibis/expr/types/relations.py index c0cd7cb6e1d0..3a19bb8d5483 100644 --- a/ibis/expr/types/relations.py +++ b/ibis/expr/types/relations.py @@ -169,7 +169,7 @@ def dereference_mapping(parents): while isinstance(v, ops.Field) and v not in mapping: mapping[v] = ops.Field(parent, k) v = v.rel.values.get(v.name) - elif v not in mapping: + elif v not in mapping and not v.find(ops.Impure): # do not dereference literal expressions mapping[v] = ops.Field(parent, k)