xzj7019 commented on code in PR #23870:
URL: https://github.com/apache/doris/pull/23870#discussion_r1325529659


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/properties/ChildOutputPropertyDeriver.java:
##########
@@ -348,8 +348,21 @@ public PhysicalProperties 
visitPhysicalRepeat(PhysicalRepeat<? extends Plan> rep
     public PhysicalProperties 
visitPhysicalPartitionTopN(PhysicalPartitionTopN<? extends Plan> partitionTopN,
             PlanContext context) {
         Preconditions.checkState(childrenOutputProperties.size() == 1);
-        PhysicalProperties childOutputProperty = 
childrenOutputProperties.get(0);
-        return new 
PhysicalProperties(childOutputProperty.getDistributionSpec());
+        DistributionSpec childDistSpec = 
childrenOutputProperties.get(0).getDistributionSpec();
+
+        if (partitionTopN.getPhase().isTwoPhaseLocal() || 
partitionTopN.getPhase().isOnePhaseGlobal()) {
+            return new PhysicalProperties(childDistSpec);
+        } else {
+            
Preconditions.checkState(partitionTopN.getPhase().isTwoPhaseGlobal(),
+                    "partition topn phase is not two phase global");
+            Preconditions.checkState(childDistSpec instanceof 
DistributionSpecHash,
+                    "child dist spec is not hash spec");
+
+            DistributionSpec distributionSpec = 
PhysicalProperties.createHash(partitionTopN.getPartitionKeys(),
+                    ((DistributionSpecHash) 
childDistSpec).getShuffleType()).getDistributionSpec();

Review Comment:
   done



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

Reply via email to