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_r315006529
########## File path: api/src/main/java/org/apache/iceberg/expressions/UnboundPredicate.java ########## @@ -125,13 +154,38 @@ public Expression bind(Types.StructType struct, boolean caseSensitive) { case LT_EQ: case EQ: return Expressions.alwaysFalse(); -// case IN: -// break; -// case NOT_IN: -// break; } } return new BoundPredicate<>(op(), new BoundReference<>(field.fieldId(), - schema.accessorForField(field.fieldId())), lit); + schema.accessorForField(field.fieldId())), lit); + } + + @SuppressWarnings("unchecked") + private Expression bindInOperation(Types.NestedField field, Schema schema) { + final Set<Literal<T>> lits = literalSet().stream().map( + val -> { + if (val instanceof LiteralSet.CharSeqWrapper) { + val = (T) ((LiteralSet.CharSeqWrapper) val).unWrap(); + } + Literal<T> lit = Literals.from(val).to(field.type()); + if (lit == null) { + throw new ValidationException(String.format( + "Invalid value for comparison inclusive type %s: %s (%s)", + field.type(), val, val.getClass().getName())); + } + return lit; + }) + .filter(l -> l != Literals.aboveMax() && l != Literals.belowMin()) + .collect(Collectors.toSet()); Review comment: Thanks for the suggestion. Updated the code accordingly. ---------------------------------------------------------------- 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