[fix](Nereids): fix enable mv rewrite is useless in dphyp (#30042)
This commit is contained in:
@ -24,7 +24,8 @@ import org.apache.doris.nereids.memo.GroupExpression;
|
||||
import org.apache.doris.nereids.rules.Rule;
|
||||
import org.apache.doris.qe.ConnectContext;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
@ -48,11 +49,6 @@ public class OptimizeGroupExpressionJob extends Job {
|
||||
countJobExecutionTimesOfGroupExpressions(groupExpression);
|
||||
List<Rule> implementationRules = getRuleSet().getImplementationRules();
|
||||
List<Rule> explorationRules = getExplorationRules();
|
||||
ConnectContext connectContext = context.getCascadesContext().getConnectContext();
|
||||
if (connectContext.getSessionVariable().isEnableMaterializedViewRewrite()) {
|
||||
explorationRules = new ArrayList<>(explorationRules);
|
||||
explorationRules.addAll(getRuleSet().getMaterializedViewRules());
|
||||
}
|
||||
|
||||
for (Rule rule : explorationRules) {
|
||||
if (rule.isInvalid(disableRules, groupExpression)) {
|
||||
@ -70,6 +66,13 @@ public class OptimizeGroupExpressionJob extends Job {
|
||||
}
|
||||
|
||||
private List<Rule> getExplorationRules() {
|
||||
return ImmutableList.<Rule>builder()
|
||||
.addAll(getJoinRules())
|
||||
.addAll(getMvRules())
|
||||
.build();
|
||||
}
|
||||
|
||||
private List<Rule> getJoinRules() {
|
||||
boolean isDisableJoinReorder = context.getCascadesContext().getConnectContext().getSessionVariable()
|
||||
.isDisableJoinReorder()
|
||||
|| context.getCascadesContext().getMemo().getGroupExpressionsSize() > context.getCascadesContext()
|
||||
@ -96,4 +99,12 @@ public class OptimizeGroupExpressionJob extends Job {
|
||||
return getRuleSet().getZigZagTreeJoinReorder();
|
||||
}
|
||||
}
|
||||
|
||||
private List<Rule> getMvRules() {
|
||||
ConnectContext connectContext = context.getCascadesContext().getConnectContext();
|
||||
if (connectContext.getSessionVariable().isEnableMaterializedViewRewrite()) {
|
||||
return getRuleSet().getMaterializedViewRules();
|
||||
}
|
||||
return ImmutableList.of();
|
||||
}
|
||||
}
|
||||
|
||||
@ -240,7 +240,6 @@ public class RuleSet {
|
||||
.build();
|
||||
|
||||
public static final List<Rule> DPHYP_REORDER_RULES = ImmutableList.<Rule>builder()
|
||||
.addAll(MATERIALIZED_VIEW_RULES)
|
||||
.add(JoinCommute.BUSHY.build())
|
||||
.build();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user