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_r313653184
 
 

 ##########
 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:
   Here, I changed the construction of `StringLiteral` to be
   ```
       StringLiteral(CharSequence value) {
         super(new CharSeqWrapper(value));
       }
   ```
   
   The other way is to only wrap `CharSequence` within LiteralSet. In that way, 
there is no need to change `startsWith`.
   
   This seems cleaner with less side effect and I will update the PR 
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

Reply via email to