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_r313499455
 
 

 ##########
 File path: api/src/main/java/org/apache/iceberg/expressions/Evaluator.java
 ##########
 @@ -134,18 +134,18 @@ 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, LiteralSet<T> literalSet) {
+      return literalSet.contains(ref.get(struct));
     }
 
     @Override
-    public <T> Boolean notIn(BoundReference<T> ref, Literal<T> lit) {
-      return !in(ref, lit);
+    public <T> Boolean notIn(BoundReference<T> ref, LiteralSet<T> literalSet) {
+      return !in(ref, literalSet);
     }
 
     @Override
     public <T> Boolean startsWith(BoundReference<T> ref, Literal<T> lit) {
-      return ((String) ref.get(struct)).startsWith((String) lit.value());
+      return ((String) ref.get(struct)).startsWith(lit.value().toString());
 
 Review comment:
   This isn't a related change, and the literal is guaranteed to be a string at 
this point. I don't think this should be included in this PR.

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