Skip to content

Commit 4642dde

Browse files
committed
Deserialize expressions
1 parent 9e4e122 commit 4642dde

2 files changed

Lines changed: 4 additions & 10 deletions

File tree

pyiceberg/expressions/__init__.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -307,12 +307,10 @@ def __new__(cls, left: BooleanExpression, right: BooleanExpression, *rest: Boole
307307
elif right is AlwaysTrue():
308308
return left
309309
else:
310-
return super().__new__(cls)
311-
312-
def __init__(self, left: BooleanExpression, right: BooleanExpression, *rest: BooleanExpression) -> None:
313-
# Ignore rest if provided - __new__ should have handled it
314-
if not rest:
315-
super().__init__(left=left, right=right)
310+
obj = super().__new__(cls)
311+
obj.left = left
312+
obj.right = right
313+
return obj
316314

317315
def __eq__(self, other: Any) -> bool:
318316
"""Return the equality of two instances of the And class."""

tests/expressions/test_expressions.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -724,10 +724,6 @@ def test_and() -> None:
724724
with pytest.raises(ValueError, match="Expected BooleanExpression, got: abc"):
725725
null & "abc"
726726

727-
json_repr = '{"type": "and", "left": {"type": "is-null", "ref"}}'
728-
assert and_.model_dump_json() == json_repr
729-
assert BooleanExpression.model_validate_json(json_repr) == and_
730-
731727

732728
def test_or() -> None:
733729
null = IsNull(Reference("a"))

0 commit comments

Comments
 (0)