[fix](Nereids)get NPE and group not be optimized when add REWRITE rule to Cascades Optimzer (#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.
This commit is contained in:
morrySnow
2022-09-05 19:11:48 +08:00
committed by GitHub
parent f466a072d8
commit 698bae09b2
2 changed files with 4 additions and 3 deletions

View File

@ -66,7 +66,7 @@ public class ApplyRuleJob extends Job {
for (Plan newPlan : newPlans) {
CopyInResult result = context.getCascadesContext()
.getMemo()
.copyIn(newPlan, groupExpression.getOwnerGroup(), rule.isRewrite());
.copyIn(newPlan, groupExpression.getOwnerGroup(), false);
if (!result.generateNewExpression) {
continue;
}

View File

@ -19,12 +19,13 @@ package org.apache.doris.nereids.rules;
/**
* Promise of rule, The value with a large promise has a higher priority.
* NOTICE: we must ensure that the promise of the IMPLEMENT is greater than the promise of the others.
*/
public enum RulePromise {
ANALYSIS,
REWRITE,
EXPLORE,
IMPLEMENT,
REWRITE,
ANALYSIS,
// just for check plan in UT
PLAN_CHECK