seawinde commented on code in PR #50855: URL: https://github.com/apache/doris/pull/50855#discussion_r2092645826
########## fe/fe-core/src/main/java/org/apache/doris/mtmv/MTMVPartitionUtil.java: ########## @@ -488,12 +488,34 @@ private static boolean isSyncWithBaseTable(MTMVRefreshContext context, String mt if (!baseTable.needAutoRefresh()) { return true; } - MTMVSnapshotIf baseTableCurrentSnapshot = baseTable.getTableSnapshot(context, - MvccUtil.getSnapshotFromContext(baseTable)); + MTMVSnapshotIf baseTableCurrentSnapshot = getTableSnapshotFromContext(baseTable, context); return mtmv.getRefreshSnapshot() .equalsWithBaseTable(mtmvPartitionName, new BaseTableInfo(baseTable), baseTableCurrentSnapshot); } + /** + * Try context first, then load via getTableSnapshot and cache + * + * @param mtmvRelatedTableIf Base table of materialized views + * @param context The context data persists for the duration of either a refresh task + * or a transparent rewrite operation + * @return The snapshot information of the MTMV + * @throws AnalysisException + */ + public static MTMVSnapshotIf getTableSnapshotFromContext(MTMVRelatedTableIf mtmvRelatedTableIf, + MTMVRefreshContext context) Review Comment: in query statement, `MTMVRefreshContext` is also used? the only cache mv partition version ? ########## fe/fe-core/src/main/java/org/apache/doris/mtmv/MTMVPartitionUtil.java: ########## @@ -488,12 +488,34 @@ private static boolean isSyncWithBaseTable(MTMVRefreshContext context, String mt if (!baseTable.needAutoRefresh()) { return true; } - MTMVSnapshotIf baseTableCurrentSnapshot = baseTable.getTableSnapshot(context, - MvccUtil.getSnapshotFromContext(baseTable)); + MTMVSnapshotIf baseTableCurrentSnapshot = getTableSnapshotFromContext(baseTable, context); return mtmv.getRefreshSnapshot() .equalsWithBaseTable(mtmvPartitionName, new BaseTableInfo(baseTable), baseTableCurrentSnapshot); } + /** + * Try context first, then load via getTableSnapshot and cache + * + * @param mtmvRelatedTableIf Base table of materialized views + * @param context The context data persists for the duration of either a refresh task + * or a transparent rewrite operation + * @return The snapshot information of the MTMV + * @throws AnalysisException + */ + public static MTMVSnapshotIf getTableSnapshotFromContext(MTMVRelatedTableIf mtmvRelatedTableIf, + MTMVRefreshContext context) Review Comment: in query statement, `MTMVRefreshContext` is also used? only cache mv partition version ? the table partition version which mv used maybe should not cache -- 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