Fokko commented on code in PR #2593:
URL: https://github.com/apache/iceberg-python/pull/2593#discussion_r2454682625


##########
pyiceberg/expressions/__init__.py:
##########
@@ -341,20 +341,25 @@ def __getnewargs__(self) -> Tuple[BooleanExpression, 
BooleanExpression]:
         return (self.left, self.right)
 
 
-class Not(BooleanExpression):
+class Not(IcebergBaseModel, BooleanExpression):
     """NOT operation expression - logical negation."""
 
-    child: BooleanExpression
+    model_config = ConfigDict(arbitrary_types_allowed=True)
+
+    type: TypingLiteral["not"] = Field(default="not")
+    child: BooleanExpression = Field()
+
+    def __init__(self, child: BooleanExpression, **_: Any) -> None:
+        super().__init__(child=child)
 
-    def __new__(cls, child: BooleanExpression) -> BooleanExpression:  # type: 
ignore
+    def __new__(cls, child: BooleanExpression, **_: Any) -> BooleanExpression: 
 # type: ignore
         if child is AlwaysTrue():
             return AlwaysFalse()
         elif child is AlwaysFalse():
             return AlwaysTrue()
         elif isinstance(child, Not):
             return child.child
         obj = super().__new__(cls)
-        obj.child = child
         return obj
 
     def __repr__(self) -> str:

Review Comment:
   ```suggestion
       def __str__(self) -> str:
           """Return the string representation of the Not class."""
           return f"Not(child={self.child})"
   
       def __repr__(self) -> str:
   ```



-- 
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]

Reply via email to