Fokko commented on code in PR #6139:
URL: https://github.com/apache/iceberg/pull/6139#discussion_r1024330356


##########
python/pyiceberg/expressions/visitors.py:
##########
@@ -60,125 +60,127 @@
     PrimitiveType,
 )
 
+R = TypeVar("R")
 
-class BooleanExpressionVisitor(Generic[T], ABC):
+
+class BooleanExpressionVisitor(Generic[R], ABC):
     @abstractmethod
-    def visit_true(self) -> T:
+    def visit_true(self) -> R:
         """Visit method for an AlwaysTrue boolean expression
 
         Note: This visit method has no arguments since AlwaysTrue instances 
have no context.
         """
 
     @abstractmethod
-    def visit_false(self) -> T:
+    def visit_false(self) -> R:
         """Visit method for an AlwaysFalse boolean expression
 
         Note: This visit method has no arguments since AlwaysFalse instances 
have no context.
         """
 
     @abstractmethod
-    def visit_not(self, child_result: T) -> T:
+    def visit_not(self, child_result: R) -> R:
         """Visit method for a Not boolean expression
 
         Args:
             child_result (T): The result of visiting the child of the Not 
boolean expression
         """
 
     @abstractmethod
-    def visit_and(self, left_result: T, right_result: T) -> T:
+    def visit_and(self, left_result: R, right_result: R) -> R:
         """Visit method for an And boolean expression
 
         Args:
-            left_result (T): The result of visiting the left side of the 
expression
-            right_result (T): The result of visiting the right side of the 
expression
+            left_result (R): The result of visiting the left side of the 
expression
+            right_result (R): The result of visiting the right side of the 
expression
         """
 
     @abstractmethod
-    def visit_or(self, left_result: T, right_result: T) -> T:
+    def visit_or(self, left_result: R, right_result: R) -> R:
         """Visit method for an Or boolean expression
 
         Args:
-            left_result (T): The result of visiting the left side of the 
expression
-            right_result (T): The result of visiting the right side of the 
expression
+            left_result (R): The result of visiting the left side of the 
expression
+            right_result (R): The result of visiting the right side of the 
expression
         """
 
     @abstractmethod
-    def visit_unbound_predicate(self, predicate) -> T:
+    def visit_unbound_predicate(self, predicate: UnboundPredicate) -> R:

Review Comment:
   No, this is because an `UnboundPredicate` can be an `UnaryPredicate`, 
`LiteralPredicate`, and a `SetPredicate`. Only the last two can have a type 
(that we infer from the literals).



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

Reply via email to