You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by GitBox <gi...@apache.org> on 2023/01/10 17:43:42 UTC

[GitHub] [iceberg] Fokko commented on a diff in pull request #6555: Python: Expression to disjunctive normal form

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


##########
python/pyiceberg/expressions/visitors.py:
##########
@@ -842,3 +842,59 @@ def visit_bound_predicate(self, predicate: BoundPredicate[L]) -> Set[int]:
 
 def extract_field_ids(expr: BooleanExpression) -> Set[int]:
     return visit(expr, _ExpressionFieldIDs())
+
+
+class _RewriteToDNF(BooleanExpressionVisitor[BooleanExpression]):
+    def visit_true(self) -> BooleanExpression:
+        return AlwaysTrue()
+
+    def visit_false(self) -> BooleanExpression:
+        return AlwaysFalse()
+
+    def visit_not(self, child_result: BooleanExpression) -> BooleanExpression:

Review Comment:
   I've done some checks, and that works well! Added some more tests and the logic is indeed redundant here. The difference is that we don't have any `Not()` in the output, but that works well 👍🏻 



-- 
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-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org