github-actions[bot] commented on code in PR #61495:
URL: https://github.com/apache/doris/pull/61495#discussion_r3084654732


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/properties/ChildOutputPropertyDeriver.java:
##########
@@ -223,6 +224,19 @@ public PhysicalProperties visitPhysicalHashAggregate(
         }
     }
 
+    @Override
+    public PhysicalProperties visitPhysicalBucketedHashAggregate(
+            PhysicalBucketedHashAggregate<? extends Plan> agg, PlanContext 
context) {
+        Preconditions.checkState(childrenOutputProperties.size() == 1);
+        // Although bucketed agg internally re-distributes data into 256 
buckets by
+        // group-by keys (so the output is "complete" per group), we cannot 
claim
+        // EXECUTION_BUCKETED distribution because the 256-bucket hash 
function differs
+        // from the shuffle hash function. Downstream operators expecting 
shuffle-compatible
+        // distribution would be incorrect. Preserve child distribution 
instead.
+        PhysicalProperties childOutputProperty = 
childrenOutputProperties.get(0);

Review Comment:
   This cannot preserve the child `DistributionSpecHash`. 
`BucketedAggLocalState::_get_results()` assigns completed buckets to whichever 
source task wins `merge_in_progress`, so after this operator each source task 
may emit arbitrary hash buckets rather than the original child/task 
partitioning. A downstream hash join or global agg that requests `REQUIRE` on 
the same expr ids can therefore see this node as already partitioned and skip 
the exchange, producing wrong results. Please downgrade this output to a 
non-hash property (for example `PhysicalProperties.ANY`) unless you can prove a 
shuffle-compatible distribution and add a test that covers `(bucketed agg) -> 
hash join` / downstream global agg.`



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