liutang123 commented on code in PR #33454: URL: https://github.com/apache/doris/pull/33454#discussion_r1560516907
########## fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/mv/SelectMaterializedIndexWithAggregate.java: ########## @@ -745,22 +748,22 @@ public PreAggStatus visit(Expression expr, CheckContext context) { @Override public PreAggStatus visitAggregateFunction(AggregateFunction aggregateFunction, CheckContext context) { - return checkAggFunc(aggregateFunction, AggregateType.NONE, context); + return checkAggFunc(aggregateFunction, AggregateType.NONE, context, false); } @Override public PreAggStatus visitMax(Max max, CheckContext context) { - return checkAggFunc(max, AggregateType.MAX, context); + return checkAggFunc(max, AggregateType.MAX, context, true); Review Comment: Because max value or min value is not affected by the number of keys. For example: There are two rowsets. One includes key values: [1, 2],the ohter one includes key values:[2, 3]. The merge key values should be [1, 2, 3]. The value of max(max([1,2]), max([2, 3]) and the value of max([1, 2, 3]) are all 3. min is the same as max. But, the other funcs like sum are not. The value of sum(sum([1,2]), sum([2, 3]) is 8 and the right value of sum([1, 2, 3]) should be 6. -- 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