jun-he commented on a change in pull request #357: Add in and not in predicates
URL: https://github.com/apache/incubator-iceberg/pull/357#discussion_r314586632
 
 

 ##########
 File path: api/src/main/java/org/apache/iceberg/expressions/Expressions.java
 ##########
 @@ -109,16 +111,46 @@ public static Expression not(Expression child) {
     return new UnboundPredicate<>(Expression.Operation.STARTS_WITH, ref(name), 
value);
   }
 
+  public static <T> UnboundPredicate<T> in(String name, T value, T... values) {
+    return predicate(Operation.IN, name,
+        Stream.concat(Stream.of(value), Stream.of(values))
+            .map(Literals::from).collect(Collectors.toSet()));
+  }
+
+  public static <T> UnboundPredicate<T> notIn(String name, T value, T... 
values) {
 
 Review comment:
   @rdblue 
   Thanks for the comment, I can make it to be `T...` here.
   
   I still think it may be better to throw exception instead of return 
`alwaysTrue` because that will force the method to return `Expression`. When 
users use it, they have to explicitly cast it to the concrete class, which 
makes it not-easy to use. 
   
   Please let me know your thoughts. thanks.
   

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org
For additional commands, e-mail: issues-h...@iceberg.apache.org

Reply via email to