jaimeferj commented on code in PR #2561:
URL: https://github.com/apache/iceberg-python/pull/2561#discussion_r2404682116


##########
pyiceberg/expressions/__init__.py:
##########
@@ -725,12 +729,37 @@ def as_bound(self) -> Type[BoundNotIn[L]]:
         return BoundNotIn[L]
 
 
-class LiteralPredicate(UnboundPredicate[L], ABC):
-    literal: Literal[L]
+class LiteralPredicate(IcebergBaseModel, UnboundPredicate[L], ABC):
+    op: str = Field(
+        default="",
+        alias="type",
+        validation_alias="type",
+        serialization_alias="type",
+        repr=False,
+    )

Review Comment:
   If you call it directly type, you cannot subclass it directly and use:
   - For the father: type: TypingLiteral["lt-eq", "gt", "gt-eq", "eq", 
"not-eq", "starts-with", "not-starts-with"] = Field(alias="type")
   - For the child: type = type: TypingLiteral["eq"] = Field(default="eq")
   
   Because mypy will scream at you saying:
   
   ```
   1. "type" overrides symbol of same name in class "LiteralPredicate"
        Variable is mutable so its type is invariant
          Override type "Literal['eq']" is not the same as base type 
"Literal['lt-eq', 'gt', 'gt-eq', 'eq', 'not-eq', 'starts-with', 
'not-starts-with']" [reportIncompatibleVariableOverride]
   ```



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