GoGoWen opened a new issue, #18221:
URL: https://github.com/apache/doris/issues/18221

   ### Search before asking
   
   - [X] I had searched in the 
[issues](https://github.com/apache/doris/issues?q=is%3Aissue) and found no 
similar issues.
   
   
   ### Description
   
   Now, when query iceberg table with InPredicate like "select  id,sum(count) 
from tb where id in (1,2,3) group by id", 
   the predicate will not push down to iceberg.  when the column is an 
partition column, the performance will  become bad as the partition will not 
hit.
   
   
   
   ### Solution
   
   solution:
   add InPredicate support in IcebergUtils.convertToIcebergExpr. like:
          if (expr instanceof InPredicate) {
               InPredicate inExpr = (InPredicate) expr;
               if (inExpr.contains(Subquery.class)) {
                   return null;
               }
   
               SlotRef slotRef = convertDorisExprToSlotRef(inExpr.getChild(0));
               if (slotRef == null) {
                   return null;
               }
   
               List<Object> valueList = new LinkedList<>();
               for (int i = 1; i < inExpr.getChildren().size(); ++i) {
                   if (!(inExpr.getChild(i) instanceof  LiteralExpr)) {
                       return null;
                   }
   
                   LiteralExpr literalExpr = (LiteralExpr) inExpr.getChild(i);
                   Object value = extractDorisLiteral(literalExpr);
                   valueList.add(value);
               }
   
               String colName = slotRef.getColumnName();
               Types.NestedField nestedField = 
schema.caseInsensitiveFindField(colName);
               colName = nestedField.name();
   
               if (inExpr.isNotIn()) {
                   // not in
                   return Expressions.notIn(colName, valueList);
               } else {
                   // in
                   return Expressions.in(colName, valueList);
               }
           }
   
   ### Are you willing to submit PR?
   
   - [X] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of 
Conduct](https://www.apache.org/foundation/policies/conduct)
   


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

To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to