rdblue commented on code in PR #6258:
URL: https://github.com/apache/iceberg/pull/6258#discussion_r1033855472
##########
python/pyiceberg/io/pyarrow.py:
##########
@@ -379,3 +385,61 @@ def _(_: StringType) -> pa.DataType:
def _(_: BinaryType) -> pa.DataType:
# Variable length by default
return pa.binary()
+
+
+class _ConvertToArrowExpression(BoundBooleanExpressionVisitor[pc.Expression]):
+ def visit_in(self, term: BoundTerm[pc.Expression], literals: Set[Any]) ->
pc.Expression:
+ return pc.field(term.ref().field.name).isin(literals)
+
+ def visit_not_in(self, term: BoundTerm[pc.Expression], literals:
Set[pc.Expression]) -> pc.Expression:
+ return ~pc.field(term.ref().field.name).isin(literals)
+
+ def visit_is_nan(self, term: BoundTerm[pc.Expression]) -> pc.Expression:
+ ref = pc.field(term.ref().field.name)
+ return ref.is_null(nan_is_null=True) & ref.is_valid()
+
+ def visit_not_nan(self, term: BoundTerm[pc.Expression]) -> pc.Expression:
+ return ~pc.field(term.ref().field.name).is_null(nan_is_null=True)
Review Comment:
I think that this needs to be the negation of `visit_is_nan` to handle
`null` values correctly.
--
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]