morrySnow commented on code in PR #49773: URL: https://github.com/apache/doris/pull/49773#discussion_r2057736206
########## fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/MergePercentileToArray.java: ########## @@ -76,19 +75,19 @@ public Rule build() { // Merge percentile into percentile_array according to funcMap private List<AggregateFunction> getPercentileArrays(Map<DistinctAndExpr, List<AggregateFunction>> funcMap) { List<AggregateFunction> newPercentileArrays = Lists.newArrayList(); + for (Map.Entry<DistinctAndExpr, List<AggregateFunction>> entry : funcMap.entrySet()) { - List<Literal> literals = new ArrayList<>(); + List<Expression> literals = new ArrayList<>(); for (AggregateFunction aggFunc : entry.getValue()) { - List<Expression> literal = aggFunc.child(1).collectToList(expr -> expr instanceof Literal); - literals.add((Literal) literal.get(0)); + literals.add(aggFunc.child(1)); } - ArrayLiteral arrayLiteral = new ArrayLiteral(literals); Review Comment: if all expression are literal, generate a array literal directly for better performance ########## fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/MergePercentileToArray.java: ########## @@ -76,19 +75,19 @@ public Rule build() { // Merge percentile into percentile_array according to funcMap private List<AggregateFunction> getPercentileArrays(Map<DistinctAndExpr, List<AggregateFunction>> funcMap) { List<AggregateFunction> newPercentileArrays = Lists.newArrayList(); + for (Map.Entry<DistinctAndExpr, List<AggregateFunction>> entry : funcMap.entrySet()) { - List<Literal> literals = new ArrayList<>(); + List<Expression> literals = new ArrayList<>(); Review Comment: rename this variable to a proper name -- 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