rdblue commented on code in PR #6566:
URL: https://github.com/apache/iceberg/pull/6566#discussion_r1089531279
##########
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 don't see anything in the docs that indicate this is the right way to pass
this, so we should make sure there are tests for it.
--
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]