rdblue commented on code in PR #6139: URL: https://github.com/apache/iceberg/pull/6139#discussion_r1024480285
########## python/pyiceberg/expressions/__init__.py: ########## @@ -281,249 +361,313 @@ def __invert__(self) -> BoundIsNull: return BoundIsNull(self.term) -@dataclass(frozen=True) -class IsNull(UnaryPredicate[T]): - as_bound = BoundIsNull - - def __invert__(self) -> NotNull[T]: +class IsNull(UnaryPredicate): + def __invert__(self) -> NotNull: return NotNull(self.term) + @property + def as_bound(self) -> Type[BoundIsNull[L]]: + return BoundIsNull[L] -@dataclass(frozen=True) -class NotNull(UnaryPredicate[T]): - as_bound = BoundNotNull - def __invert__(self) -> IsNull[T]: +class NotNull(UnaryPredicate): + def __invert__(self) -> IsNull: return IsNull(self.term) + @property + def as_bound(self) -> Type[BoundNotNull[L]]: + return BoundNotNull[L] -@dataclass(frozen=True) -class BoundIsNaN(BoundUnaryPredicate[T]): - def __new__(cls, term: BoundTerm[T]): # pylint: disable=W0221 + +class BoundIsNaN(BoundUnaryPredicate[L]): + def __new__(cls, term: BoundTerm[L]): # pylint: disable=W0221 bound_type = term.ref().field.field_type if type(bound_type) in {FloatType, DoubleType}: return super().__new__(cls) return AlwaysFalse() - def __invert__(self) -> BoundNotNaN[T]: + def __invert__(self) -> BoundNotNaN[L]: return BoundNotNaN(self.term) -@dataclass(frozen=True) -class BoundNotNaN(BoundUnaryPredicate[T]): - def __new__(cls, term: BoundTerm[T]): # pylint: disable=W0221 +class BoundNotNaN(BoundUnaryPredicate[L]): + def __new__(cls, term: BoundTerm[L]): # pylint: disable=W0221 bound_type = term.ref().field.field_type if type(bound_type) in {FloatType, DoubleType}: return super().__new__(cls) return AlwaysTrue() - def __invert__(self) -> BoundIsNaN[T]: + def __invert__(self) -> BoundIsNaN[L]: return BoundIsNaN(self.term) -@dataclass(frozen=True) -class IsNaN(UnaryPredicate[T]): - as_bound = BoundIsNaN - - def __invert__(self) -> NotNaN[T]: +class IsNaN(UnaryPredicate): + def __invert__(self) -> NotNaN: return NotNaN(self.term) + @property + def as_bound(self) -> Type[BoundIsNaN[L]]: + return BoundIsNaN[L] -@dataclass(frozen=True) -class NotNaN(UnaryPredicate[T]): - as_bound = BoundNotNaN - def __invert__(self) -> IsNaN[T]: +class NotNaN(UnaryPredicate): + def __invert__(self) -> IsNaN: return IsNaN(self.term) + @property + def as_bound(self) -> Type[BoundNotNaN[L]]: + return BoundNotNaN[L] Review Comment: `L` could be replaced with `float` here since we don't support `IsNaN` / `NotNaN` for any other type. -- 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: issues-unsubscr...@iceberg.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For additional commands, e-mail: issues-h...@iceberg.apache.org