nooneuse commented on code in PR #66307:
URL: https://github.com/apache/doris/pull/66307#discussion_r3764743414


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/properties/ChildOutputPropertyDeriver.java:
##########
@@ -197,6 +247,36 @@ public PhysicalProperties visitPhysicalHashAggregate(
         }
     }
 
+    private PhysicalProperties computeAggregateOutputProperties(
+            PhysicalHashAggregate<? extends Plan> agg, PhysicalProperties 
childOutputProperty) {
+        NaturalDistributionMappingSpec naturalMappingSpec =
+                childOutputProperty.getNaturalDistributionMappingSpec().get();
+        if (agg.hasSourceRepeat()) {
+            return withoutNaturalDistributionMapping(childOutputProperty);
+        }
+
+        Set<ExprId> groupByExprIds = Sets.newHashSet();
+        for (Expression groupBy : agg.getGroupByExpressions()) {
+            if (!(groupBy instanceof SlotReference)) {
+                return withoutNaturalDistributionMapping(childOutputProperty);
+            }
+            groupByExprIds.add(((SlotReference) groupBy).getExprId());
+        }
+        if 
(!naturalMappingSpec.distributionKeysCoveredByDirectOrMapping(groupByExprIds)) {
+            return withoutNaturalDistributionMapping(childOutputProperty);
+        }
+
+        return computeProjectOutputProperties(agg.getOutputExpressions(), 
childOutputProperty);

Review Comment:
   alright. 



-- 
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