feiniaofeiafei commented on code in PR #60074:
URL: https://github.com/apache/doris/pull/60074#discussion_r2710899711


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/NereidsPlanner.java:
##########
@@ -761,7 +762,10 @@ public static PhysicalPlan chooseBestPlan(Group rootGroup, 
PhysicalProperties ph
             GroupExpression groupExpression = 
rootGroup.getLowestCostPlan(physicalProperties).orElseThrow(
                     () -> new AnalysisException("lowestCostPlans with 
physicalProperties("
                             + physicalProperties + ") doesn't exist in root 
group")).second;
-            if (rootGroup.getEnforcers().containsKey(groupExpression)) {
+            if ((groupExpression.getPlan() instanceof PhysicalDistribute
+                    && rootGroup.getEnforcerSpecs().containsKey(
+                            ((PhysicalDistribute<?>) 
groupExpression.getPlan()).getDistributionSpec()))
+                    || rootGroup.getEnforcers().containsKey(groupExpression)) {
                 rootGroup.addChosenEnforcerId(groupExpression.getId().asInt());

Review Comment:
   The chosenEnforcerId may be wrong when explain memo plan print the group, 
the chosen groupExpression id is 1, but the group enforcers may not have 
groupExpression with id 1.



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