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_r313220700
##########
File path: api/src/main/java/org/apache/iceberg/expressions/Evaluator.java
##########
@@ -134,13 +135,13 @@ public Boolean or(Boolean leftResult, Boolean
rightResult) {
}
@Override
- public <T> Boolean in(BoundReference<T> ref, Literal<T> lit) {
- throw new UnsupportedOperationException("In is not supported yet");
+ public <T> Boolean in(BoundReference<T> ref, Set<Literal<T>> lits) {
+ return lits.contains(Literals.from(ref.get(struct)));
Review comment:
@rdblue There is an issue with `CharSequence`. For example, `String("abc")`
and `UTF8("abc")` are not equal but the comparator returns 0. This causes the
`IN` eval return `false`.
To fix it, I created a wrapper class and overrides the `equals` to use the
provided comparator. It worked in our cases although it is not perfect as
`Set<WrapperA> contains B` but `Set<B> may not contain WrapperA`.
----------------------------------------------------------------
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]