wangshuo128 commented on code in PR #15275:
URL: https://github.com/apache/doris/pull/15275#discussion_r1056224544


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/mv/SelectMaterializedIndexWithAggregate.java:
##########
@@ -711,34 +746,62 @@ private static Expression rewrite(Expression expr, 
RewriteContext context) {
 
         /**
          * count(distinct col) -> bitmap_union_count(mv_bitmap_union_col)
+         * count(col) -> sum(mv_count_col)
          */
         @Override
         public Expression visitCount(Count count, RewriteContext context) {
             if (count.isDistinct() && count.arity() == 1) {

Review Comment:
   This rewriter is a bit different. 
   It only handles aggregate function on a slot, e.g., rewriting `count(col)` 
to `sum(mv_count_col)`. The child of the aggregate function is checked by 
`ExpressionUtils.extractSlotOrCastOnSlot(count.child(0))` to ensure it's a slot.
    So we don't need to rewrite children first.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to