samredai commented on code in PR #4815:
URL: https://github.com/apache/iceberg/pull/4815#discussion_r878991275


##########
python/src/iceberg/expressions/base.py:
##########
@@ -346,3 +346,112 @@ def bind(self, schema: Schema, case_sensitive: bool) -> 
BoundReference:
             raise ValueError(f"Cannot find field '{self.name}' in schema: 
{schema}")
 
         return BoundReference(field=field, 
accessor=schema.accessor_for_field(field.field_id))
+
+
+class BooleanExpressionVisitor(Generic[T], ABC):
+    @abstractmethod
+    def visit_true(self) -> T:
+        """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:
+        """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:
+        """Visit method for a Not boolean expression
+
+        Args:
+            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:
+        """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
+        """
+
+    @abstractmethod
+    def visit_or(self, left_result: T, right_result: T) -> T:
+        """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
+        """
+
+    @abstractmethod
+    def visit_unbound_predicate(self, predicate) -> T:
+        """Visit method for an unbound predicate in an expression tree
+
+        Args:
+            predicate (UnboundPredicate): An instance of an UnboundPredicate
+        """
+
+    @abstractmethod
+    def visit_bound_predicate(self, predicate) -> T:

Review Comment:
   `predicate` has no typehint here because `BoundPredicate` and 
`UnboundPredicate` have not been added yet, but I'll circle back and add if 
after PR #4816 gets in (or rebase this PR if that one gets in first).



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