rdblue commented on a change in pull request #357: Add in and not in predicates
URL: https://github.com/apache/incubator-iceberg/pull/357#discussion_r314831603
##########
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:
I'd rather return `Expression` because there are cases where the caller
might not know what is in the set and simply pass through. Forcing the caller
to check whether the set is empty instead of returning an equivalent wouldn't
be as easy to use.
----------------------------------------------------------------
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]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]