yyanyy commented on a change in pull request #1747:
URL: https://github.com/apache/iceberg/pull/1747#discussion_r529176195
##########
File path: api/src/main/java/org/apache/iceberg/expressions/Expressions.java
##########
@@ -123,6 +123,22 @@ public static Expression not(Expression child) {
return new UnboundPredicate<>(Expression.Operation.NOT_NULL, expr);
}
+ public static <T> UnboundPredicate<T> isNaN(String name) {
+ return new UnboundPredicate<>(Expression.Operation.IS_NAN, ref(name));
+ }
+
+ public static <T> UnboundPredicate<T> isNaN(UnboundTerm<T> expr) {
+ return new UnboundPredicate<>(Expression.Operation.IS_NAN, expr);
+ }
+
+ public static <T> UnboundPredicate<T> notNaN(String name) {
+ return new UnboundPredicate<>(Expression.Operation.NOT_NAN, ref(name));
+ }
+
+ public static <T> UnboundPredicate<T> notNaN(UnboundTerm<T> expr) {
+ return new UnboundPredicate<>(Expression.Operation.NOT_NAN, expr);
+ }
Review comment:
Thanks, those are some good points! To make sure I understand
correctly/know how to move forward, I have some questions:
- If I understand correctly, to reject NaN in any predicate sounds like we
might go back to the idea of rewriting equals in `SparkFilters` (or in general,
the integration point with engines during the query-to-expression translation);
or maybe even earlier than that, to let engines to support syntax of `is NaN`?
- Since to know if a query is eligible to be translated to `isNaN` there has
to be some place that ensures the type has to be either double or float, and in
iceberg code base we will only know this during binding; are we able to rely on
engine to do this check before translating query to `Expression`?
- And seems like this may only impact `eq` as we decided to do input
validation on other `lg/lteq/gt/gteq` and `in` anyway?
- And if we start to throw exceptions when the code passes in `NaN` to `eq`,
that may sound backward incompatible until the engine starts to rewrite NaN?
I guess the conversation is starting to get too detailed, if you wouldn't
mind I'll try to follow up on Slack tomorrow and then post the conclusion here?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]