zddr commented on code in PR #40332: URL: https://github.com/apache/doris/pull/40332#discussion_r1749490925
########## fe/fe-core/src/main/java/org/apache/doris/mtmv/MTMVPropertyUtil.java: ########## @@ -66,6 +67,8 @@ public static void analyzeProperty(String key, String value) { break; case PropertyAnalyzer.PROPERTIES_ENABLE_NONDETERMINISTIC_FUNCTION: break; + case PropertyAnalyzer.PROPERTIES_USE_FOR_REWRITE: Review Comment: we need check type is `boolean`? ########## fe/fe-core/src/main/java/org/apache/doris/nereids/rules/exploration/mv/InitMaterializationContextHook.java: ########## @@ -129,15 +131,24 @@ private List<MaterializationContext> createAsyncMaterializationContext(CascadesC Set<TableIf> usedTables) { Set<MTMV> availableMTMVs = getAvailableMTMVs(usedTables, cascadesContext); if (availableMTMVs.isEmpty()) { - LOG.debug(String.format("Enable materialized view rewrite but availableMTMVs is empty, current queryId " - + "is %s", cascadesContext.getConnectContext().getQueryIdentifier())); + LOG.debug("Enable materialized view rewrite but availableMTMVs is empty, current queryId " + + "is {}", cascadesContext.getConnectContext().getQueryIdentifier()); return ImmutableList.of(); } List<MaterializationContext> asyncMaterializationContext = new ArrayList<>(); for (MTMV materializedView : availableMTMVs) { MTMVCache mtmvCache = null; try { mtmvCache = materializedView.getOrGenerateCache(cascadesContext.getConnectContext()); + // If mv property use_for_rewrite is set false, should not partition in + // query rewrite by materialized view + String usedForRewrite = materializedView.getMvProperties().get( + PropertyAnalyzer.PROPERTIES_USE_FOR_REWRITE); + if (!StringUtils.isEmpty(usedForRewrite) && !Boolean.parseBoolean(usedForRewrite)) { Review Comment: Suggest extracting a method from the logic for obtaining usedForRewrite and placing it in MTMV, similar to getWorkload Group, -- 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