rdblue commented on a change in pull request #1747:
URL: https://github.com/apache/iceberg/pull/1747#discussion_r521653310



##########
File path: 
api/src/main/java/org/apache/iceberg/expressions/UnboundPredicate.java
##########
@@ -127,11 +128,27 @@ private Expression bindUnaryOperation(BoundTerm<T> 
boundTerm) {
           return Expressions.alwaysTrue();
         }
         return new BoundUnaryPredicate<>(Operation.NOT_NULL, boundTerm);
+      case IS_NAN:
+        if (typeAcceptsNaN(boundTerm.type().typeId())) {
+          return new BoundUnaryPredicate<>(Operation.IS_NAN, boundTerm);
+        } else {
+          return Expressions.alwaysFalse();
+        }
+      case NOT_NAN:
+        if (typeAcceptsNaN(boundTerm.type().typeId())) {
+          return new BoundUnaryPredicate<>(Operation.NOT_NAN, boundTerm);
+        } else {
+          return Expressions.alwaysTrue();
+        }
       default:
-        throw new ValidationException("Operation must be IS_NULL or NOT_NULL");
+        throw new ValidationException("Operation must be IS_NULL, NOT_NULL, 
IS_NAN, or NOT_NAN");
     }
   }
 
+  private boolean typeAcceptsNaN(Type.TypeID typeID) {

Review comment:
       I think "accepts" isn't quite the right verb. What about "includes" 
instead?




----------------------------------------------------------------
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]

Reply via email to