seawinde commented on code in PR #59972:
URL: https://github.com/apache/doris/pull/59972#discussion_r3709114968


##########
fe/fe-core/src/main/java/org/apache/doris/mtmv/MTMVRefreshContext.java:
##########
@@ -58,9 +59,10 @@ public Map<BaseTableInfo, MTMVSnapshotIf> 
getBaseTableSnapshotCache() {
         return baseTableSnapshotCache;
     }
 
-    public static MTMVRefreshContext buildContext(MTMV mtmv) throws 
AnalysisException {
+    public static MTMVRefreshContext buildContext(MTMV mtmv, Map<List<String>, 
Set<String>> queryUsedPartitions)
+            throws AnalysisException {
         MTMVRefreshContext context = new MTMVRefreshContext(mtmv);
-        context.partitionMappings = mtmv.calculatePartitionMappings();
+        context.partitionMappings = 
mtmv.calculatePartitionMappings(queryUsedPartitions);
         context.baseVersions = MTMVPartitionUtil.getBaseVersions(mtmv);

Review Comment:
   Implemented in `10084ac4cc3`. `MTMVRefreshContext` now passes the completed 
`partitionMappings` into version collection; mapped partition names are unioned 
and deduplicated per PCT OLAP table, and only those partitions are passed to 
`Partition.getVisibleVersions()`. Non-PCT table-version snapshots are 
unchanged, and full refresh behavior is preserved because full-refresh mappings 
contain all PCT partition names. Added unit coverage for sparse mappings, 
cross-MV deduplication, and fully mapped/all-partition behavior; 
`MTMVPartitionUtilTest` passes all 13 tests and `./build.sh --fe` succeeds.



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