924060929 commented on code in PR #65129:
URL: https://github.com/apache/doris/pull/65129#discussion_r3523073066
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/properties/ChildOutputPropertyDeriver.java:
##########
@@ -525,6 +606,23 @@ public PhysicalProperties
visitPhysicalSetOperation(PhysicalSetOperation setOper
for (int offset : offsetsOfFirstChild) {
request.add(setOperation.getOutput().get(offset).getExprId());
}
+ // The offsets / shuffle-type comparison above does not prove that two
STORAGE_BUCKETED
+ // children use the same bucket function: children distributed by
different tables'
+ // bucket layouts hash the same output columns differently, and
satisfy() of the
+ // returned property does not check the storage layout. Only claim
STORAGE_BUCKETED
+ // when every child shares the same storage layout; otherwise return a
non-specific
+ // property so the parent re-aligns the data.
+ if (firstType == ShuffleType.STORAGE_BUCKETED) {
+ DistributionSpecHash firstHash = (DistributionSpecHash)
childrenDistribution.get(0);
+ for (int i = 1; i < childrenDistribution.size(); i++) {
+ DistributionSpecHash otherHash = (DistributionSpecHash)
childrenDistribution.get(i);
+ if (otherHash.getTableId() != firstHash.getTableId()
+ || otherHash.getSelectedIndexId() !=
firstHash.getSelectedIndexId()
+ ||
!otherHash.getPartitionIds().equals(firstHash.getPartitionIds())) {
+ return PhysicalProperties.createAnyFromHash(firstHash);
+ }
+ }
+ }
return PhysicalProperties.createHash(request, firstType);
Review Comment:
Addressed. The fallback now preserves the validated layout when returning
the STORAGE_BUCKETED property (table / index / partitions from the compared
children) instead of erasing it through `createHash`, and both layout-equality
checks additionally treat an unknown layout (`tableId < 0`) as not provable and
return the non-specific property, so two layout-less STORAGE_BUCKETED claims
from different tables can no longer be treated as bucket-aligned by an outer
set operation.
--
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]