3939 literal ,
4040)
4141from pyiceberg .schema import Accessor , Schema
42- from pyiceberg .typedef import L , StructProtocol
42+ from pyiceberg .typedef import IcebergBaseModel , L , StructProtocol
4343from pyiceberg .types import DoubleType , FloatType , NestedField
4444from pyiceberg .utils .singleton import Singleton
4545
@@ -429,7 +429,20 @@ def bind(self, schema: Schema, case_sensitive: bool = True) -> BooleanExpression
429429 def as_bound (self ) -> Type [BoundPredicate [L ]]: ...
430430
431431
432- class UnaryPredicate (UnboundPredicate [Any ], ABC ):
432+ class UnaryPredicate (UnboundPredicate [Any ], IcebergBaseModel , ABC ):
433+ type : str
434+ column : str
435+
436+ def __init__ (self , term : Union [str , UnboundTerm [Any ]]):
437+ if isinstance (term , Reference ):
438+ term_name = term .name
439+ elif isinstance (term , str ):
440+ term_name = term
441+ else :
442+ raise ValueError ("term must be a string or Reference" )
443+ super ().__init__ (term = Reference (term_name ))
444+ self .column = term_name
445+
433446 def bind (self , schema : Schema , case_sensitive : bool = True ) -> BoundUnaryPredicate [Any ]:
434447 bound_term = self .term .bind (schema , case_sensitive )
435448 return self .as_bound (bound_term )
@@ -488,6 +501,8 @@ def as_unbound(self) -> Type[NotNull]:
488501
489502
490503class IsNull (UnaryPredicate ):
504+ type : str = "is-null"
505+
491506 def __invert__ (self ) -> NotNull :
492507 """Transform the Expression into its negated version."""
493508 return NotNull (self .term )
@@ -498,6 +513,8 @@ def as_bound(self) -> Type[BoundIsNull[L]]:
498513
499514
500515class NotNull (UnaryPredicate ):
516+ type : str = "not-null"
517+
501518 def __invert__ (self ) -> IsNull :
502519 """Transform the Expression into its negated version."""
503520 return IsNull (self .term )
@@ -540,6 +557,8 @@ def as_unbound(self) -> Type[NotNaN]:
540557
541558
542559class IsNaN (UnaryPredicate ):
560+ type : str = "is-nan"
561+
543562 def __invert__ (self ) -> NotNaN :
544563 """Transform the Expression into its negated version."""
545564 return NotNaN (self .term )
@@ -550,6 +569,8 @@ def as_bound(self) -> Type[BoundIsNaN[L]]:
550569
551570
552571class NotNaN (UnaryPredicate ):
572+ type : str = "not-nan"
573+
553574 def __invert__ (self ) -> IsNaN :
554575 """Transform the Expression into its negated version."""
555576 return IsNaN (self .term )
0 commit comments