rdblue commented on code in PR #5258:
URL: https://github.com/apache/iceberg/pull/5258#discussion_r929224219
##########
python/pyiceberg/expressions/base.py:
##########
@@ -282,49 +338,239 @@ def __repr__(self) -> str:
return f"Not({repr(self.child)})"
def __str__(self) -> str:
- return f"(not {self.child})"
+ return f"Not({str(self.child)})"
+@dataclass(frozen=True)
class AlwaysTrue(BooleanExpression, ABC, Singleton):
"""TRUE expression"""
- def __invert__(self) -> "AlwaysFalse":
+ def __invert__(self) -> AlwaysFalse:
return AlwaysFalse()
- def __repr__(self) -> str:
- return "AlwaysTrue()"
-
- def __str__(self) -> str:
- return "true"
-
+@dataclass(frozen=True)
class AlwaysFalse(BooleanExpression, ABC, Singleton):
"""FALSE expression"""
- def __invert__(self) -> "AlwaysTrue":
+ def __invert__(self) -> AlwaysTrue:
return AlwaysTrue()
- def __repr__(self) -> str:
- return "AlwaysFalse()"
- def __str__(self) -> str:
- return "false"
+class IsNull(UnboundPredicate[T]):
+ def __invert__(self) -> NotNull:
+ return NotNull(self.term)
+
+ def _validate_literals(self): # pylint: disable=W0238
+ if self.literals is not None:
+ raise AttributeError("Null is a unary predicate and takes no
Literals.")
+
+ def bind(self, schema: Schema, case_sensitive: bool) -> BoundIsNull[T]:
+ bound_ref = self.term.bind(schema, case_sensitive)
Review Comment:
A better name would be `bound_term` since this is not necessarily a ref.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]