Fokko commented on code in PR #6566:
URL: https://github.com/apache/iceberg/pull/6566#discussion_r1091169965
##########
python/pyiceberg/expressions/visitors.py:
##########
@@ -881,3 +881,82 @@ def rewrite_to_dnf(expr: BooleanExpression) ->
Tuple[BooleanExpression, ...]:
# (A AND NOT(B) AND C) OR (NOT(D) AND E AND F) OR (G)
expr_without_not = rewrite_not(expr)
return visit(expr_without_not, _RewriteToDNF())
+
+
+class ExpressionToPlainFormat(BoundBooleanExpressionVisitor[List[Tuple[str,
str, Any]]]):
+ def visit_in(self, term: BoundTerm[L], literals: Set[L]) ->
List[Tuple[str, str, Any]]:
+ return [(term.ref().field.name, "in", literals)]
+
+ def visit_not_in(self, term: BoundTerm[L], literals: Set[L]) ->
List[Tuple[str, str, Any]]:
+ return [(term.ref().field.name, "not in", literals)]
+
+ def visit_is_nan(self, term: BoundTerm[L]) -> List[Tuple[str, str, Any]]:
+ return [(term.ref().field.name, "==", float("nan"))]
+
+ def visit_not_nan(self, term: BoundTerm[L]) -> List[Tuple[str, str, Any]]:
+ return [(term.ref().field.name, "!=", float("nan"))]
+
+ def visit_is_null(self, term: BoundTerm[L]) -> List[Tuple[str, str, Any]]:
+ return [(term.ref().field.name, "==", None)]
+
+ def visit_not_null(self, term: BoundTerm[L]) -> List[Tuple[str, str, Any]]:
+ return [(term.ref().field.name, "!=", None)]
Review Comment:
I agree, and I have https://github.com/apache/iceberg/pull/6398 lined up to
exactly test this. I'll revive the PR tomorrow.
--
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]