Skip to content

Commit 698bae0

Browse files
authored
[fix](Nereids)get NPE and group not be optimized when add REWRITE rule to Cascades Optimzer (apache#12346)
Fix some bugs when add REWRITE rule to Cascades Optimizer - all rule should set as not rewrite rule when use them in Cascades Optimizer - IMPLEMENT rule promise should large than others since we should do exploration first.
1 parent f466a07 commit 698bae0

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

fe/fe-core/src/main/java/org/apache/doris/nereids/jobs/cascades/ApplyRuleJob.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public void execute() throws AnalysisException {
6666
for (Plan newPlan : newPlans) {
6767
CopyInResult result = context.getCascadesContext()
6868
.getMemo()
69-
.copyIn(newPlan, groupExpression.getOwnerGroup(), rule.isRewrite());
69+
.copyIn(newPlan, groupExpression.getOwnerGroup(), false);
7070
if (!result.generateNewExpression) {
7171
continue;
7272
}

fe/fe-core/src/main/java/org/apache/doris/nereids/rules/RulePromise.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,13 @@
1919

2020
/**
2121
* Promise of rule, The value with a large promise has a higher priority.
22+
* NOTICE: we must ensure that the promise of the IMPLEMENT is greater than the promise of the others.
2223
*/
2324
public enum RulePromise {
25+
ANALYSIS,
26+
REWRITE,
2427
EXPLORE,
2528
IMPLEMENT,
26-
REWRITE,
27-
ANALYSIS,
2829

2930
// just for check plan in UT
3031
PLAN_CHECK

0 commit comments

Comments
 (0)