adonis0147 commented on code in PR #10667: URL: https://github.com/apache/doris/pull/10667#discussion_r925269681
########## fe/fe-core/src/main/java/org/apache/doris/nereids/util/ExpressionUtils.java: ########## @@ -102,8 +104,13 @@ public static Expression combine(ExpressionType op, List<Expression> expressions } } - Optional<Expression> result = - distinctExpressions.stream().reduce((left, right) -> new CompoundPredicate(op, left, right)); + Optional<Expression> result = distinctExpressions.stream().reduce((left, right) -> { + if (op == ExpressionType.AND) { + return new And(left, right); + } else { + return new Or(left, right); + } + }); Review Comment: Due to the previous check `Preconditions.checkArgument(op == ExpressionType.AND || op == ExpressionType.OR)`, here we can safely use `new CompoundPredicate(op, left, right))` to simplify the code. -- 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 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