seawinde commented on code in PR #59972:
URL: https://github.com/apache/doris/pull/59972#discussion_r3709114041
##########
fe/fe-core/src/main/java/org/apache/doris/mtmv/MTMVRelatedPartitionDescOnePartitionColGenerator.java:
##########
@@ -49,16 +49,22 @@ public class
MTMVRelatedPartitionDescOnePartitionColGenerator implements MTMVRel
@Override
public void apply(MTMVPartitionInfo mvPartitionInfo, Map<String, String>
mvProperties,
- RelatedPartitionDescResult lastResult, List<Column>
partitionColumns) throws AnalysisException {
+ RelatedPartitionDescResult lastResult, List<Column>
partitionColumns,
+ Map<List<String>, Set<String>> queryUsedPartitionMap)
throws AnalysisException {
if (mvPartitionInfo.getPartitionType() ==
MTMVPartitionType.SELF_MANAGE) {
return;
}
Map<MTMVRelatedTableIf, Map<PartitionKeyDesc, Set<String>>> res =
Maps.newHashMap();
+ // the key is mv related table, the value is map<partition name,
partition item>
Map<MTMVRelatedTableIf, Map<String, PartitionItem>>
relatedPartitionItems = lastResult.getItems();
for (Entry<MTMVRelatedTableIf, Map<String, PartitionItem>> entry :
relatedPartitionItems.entrySet()) {
int relatedColPos = mvPartitionInfo.getPctColPos(entry.getKey());
Map<PartitionKeyDesc, Set<String>> onePctRes = Maps.newHashMap();
+ Set<String> queryUsedPartitions =
queryUsedPartitionMap.get(entry.getKey().getFullQualifiers());
for (Entry<String, PartitionItem> onePctEntry :
entry.getValue().entrySet()) {
+ if (queryUsedPartitions != null &&
!queryUsedPartitions.contains(onePctEntry.getKey())) {
Review Comment:
Conclusion: no change in this PR. The reported case relies on multiple
physical base-table partitions projecting to the same MV partition (for
example, `LIST(c1, c2)` projected to an MV partitioned only by `c1`). The
current `FOLLOW_BASE_TABLE` design and this optimization support the primary
one-to-one PCT partition relation; completing a selected physical partition to
other physical partitions in the same projected MV bucket is not supported.
Adding that behavior here would extend the partition model beyond this PR, so
we will keep the current behavior and handle it only together with explicit
support for that many-to-one mapping.
--
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]