diff --git a/ibis/expr/operations/generic.py b/ibis/expr/operations/generic.py index 754029e292b52..a33abd28bfae8 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 c7f4f17873db1..e0e5eb4c7a982 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 9635459d43144..276cd6607bb52 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 ee4c2003a85b0..d0e2d3889b954 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)