Skip to content

Commit

Permalink
fix compile error
Browse files Browse the repository at this point in the history
  • Loading branch information
seawinde committed Oct 8, 2024
1 parent 8b32ced commit d6337ab
Showing 1 changed file with 8 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -253,8 +253,7 @@ public static Plan generateMvScanPlan(OlapTable table, long indexId,
public static Plan rewriteByRules(
CascadesContext cascadesContext,
Function<CascadesContext, Plan> planRewriter,
Plan rewrittenPlan, Plan originPlan,
Set<RuleType> disableRuleSet) {
Plan rewrittenPlan, Plan originPlan) {
if (originPlan == null || rewrittenPlan == null) {
return null;
}
Expand All @@ -273,23 +272,18 @@ public static Plan rewriteByRules(
Set<String> oldDisableRuleNames = rewrittenPlanContext.getStatementContext().getConnectContext()
.getSessionVariable()
.getDisableNereidsRuleNames();
if (!disableRuleSet.isEmpty()) {
Set<String> disableRules = disableRuleSet.stream().map(RuleType::name).collect(Collectors.toSet());
rewrittenPlanContext.getStatementContext().getConnectContext().getSessionVariable()
.setDisableNereidsRules(String.join(",", disableRules));
rewrittenPlanContext.getStatementContext().invalidCache(SessionVariable.DISABLE_NEREIDS_RULES);
}
rewrittenPlanContext.getStatementContext().getConnectContext().getSessionVariable()
.setDisableNereidsRules(String.join(",", ImmutableSet.of(RuleType.ADD_DEFAULT_LIMIT.name())));
rewrittenPlanContext.getStatementContext().invalidCache(SessionVariable.DISABLE_NEREIDS_RULES);
try {
rewrittenPlanContext.getConnectContext().setSkipAuth(true);
rewrittenPlan = planRewriter.apply(rewrittenPlanContext);
} finally {
rewrittenPlanContext.getConnectContext().setSkipAuth(false);
// Recover old disable rules variable
if (!disableRuleSet.isEmpty()) {
rewrittenPlanContext.getStatementContext().getConnectContext().getSessionVariable()
.setDisableNereidsRules(String.join(",", oldDisableRuleNames));
rewrittenPlanContext.getStatementContext().invalidCache(SessionVariable.DISABLE_NEREIDS_RULES);
}
rewrittenPlanContext.getStatementContext().getConnectContext().getSessionVariable()
.setDisableNereidsRules(String.join(",", oldDisableRuleNames));
rewrittenPlanContext.getStatementContext().invalidCache(SessionVariable.DISABLE_NEREIDS_RULES);
}
Map<ExprId, Slot> exprIdToNewRewrittenSlot = Maps.newLinkedHashMap();
for (Slot slot : rewrittenPlan.getOutput()) {
Expand Down Expand Up @@ -348,7 +342,7 @@ public Plan visitLogicalResultSink(LogicalResultSink<? extends Plan> logicalResu
Rewriter.getCteChildrenRewriter(childContext,
ImmutableList.of(Rewriter.custom(RuleType.ELIMINATE_SORT, EliminateSort::new))).execute();
return childContext.getRewritePlan();
}, mvPlan, originPlan, ImmutableSet.of(RuleType.ADD_DEFAULT_LIMIT));
}, mvPlan, originPlan);
return new MTMVCache(mvPlan, originPlan,
planner.getCascadesContext().getMemo().getRoot().getStatistics(), null);
}
Expand Down

0 comments on commit d6337ab

Please sign in to comment.