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


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/exploration/mv/AbstractMaterializedViewRule.java:
##########
@@ -151,14 +184,101 @@ protected List<Plan> rewrite(Plan queryPlan, 
CascadesContext cascadesContext) {
                         rewritedPlan,
                         materializationContext);
                 if (rewritedPlan == null) {
+                    logger.info(currentClassName + " rewrite query by view 
fail so continue");
                     continue;
                 }
+                if (!checkPartitionIsValid(queryStructInfo, 
materializationContext, cascadesContext)) {
+                    logger.info(currentClassName + " check partition 
validation fail so continue");
+                    continue;
+                }
+                // run rbo job on mv rewritten plan
+                CascadesContext rewrittenPlanContext =
+                        
CascadesContext.initContext(cascadesContext.getStatementContext(), rewritedPlan,
+                                
cascadesContext.getCurrentJobContext().getRequiredProperties());
+                Rewriter.getWholeTreeRewriter(cascadesContext).execute();
+                rewritedPlan = rewrittenPlanContext.getRewritePlan();
+                logger.info(currentClassName + "rewrite by materialized view 
success");
                 rewriteResults.add(rewritedPlan);
             }
         }
         return rewriteResults;
     }
 
+    protected boolean checkPartitionIsValid(

Review Comment:
   Have add it



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