starocean999 commented on code in PR #38958: URL: https://github.com/apache/doris/pull/38958#discussion_r1706341060
########## fe/fe-core/src/main/java/org/apache/doris/nereids/rules/exploration/mv/AbstractMaterializedViewAggregateRule.java: ########## @@ -266,6 +266,34 @@ protected LogicalAggregate<Plan> doRewriteQueryByView( return new LogicalAggregate<>(finalGroupExpressions, finalOutputExpressions, tempRewritedPlan); } + /** + * handle the scene that query top plan not use the group by in query bottom aggregate + * If mv is select o_orderdate from orders group by o_orderdate; + * query is select 1 from orders group by o_orderdate. + * Or mv is select o_orderdate from orders group by o_orderdate, o_order_key; + * query is select o_orderdate from orders group by o_orderdate; + * if the slot which query top project use can not cover the slot which query bottom aggregate group by slot + * should compensate group by to make sure the data is right. + */ + private static boolean needCompensateGroupBy(Set<? extends Expression> queryTopPlanGroupBySet, Review Comment: does queryTopPlanGroupBySet mean top project slots? if it does, we may use a better name such as topProjectList? -- 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