Skip to content

Commit

Permalink
optimize code usage
Browse files Browse the repository at this point in the history
  • Loading branch information
seawinde committed Sep 4, 2024
1 parent a651cf4 commit 17238e6
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ public class StatementContext implements Closeable {

// Identify now is RBO during materialized view rewrite or not, such as in rewrite, we should not
// add default limit
private boolean rboInMaterializedViewRewrite = false;
private boolean rboForMaterializedViewRewrite = false;

public StatementContext() {
this(ConnectContext.get(), null, 0);
Expand Down Expand Up @@ -432,12 +432,12 @@ public Map<RelationId, Statistics> getRelationIdToStatisticsMap() {
return relationIdToStatisticsMap;
}

public boolean isRboInMaterializedViewRewrite() {
return rboInMaterializedViewRewrite;
public boolean isRboForMaterializedViewRewrite() {
return rboForMaterializedViewRewrite;
}

public void setRboInMaterializedViewRewrite(boolean rboInMaterializedViewRewrite) {
this.rboInMaterializedViewRewrite = rboInMaterializedViewRewrite;
public void setRboForMaterializedViewRewrite(boolean rboForMaterializedViewRewrite) {
this.rboForMaterializedViewRewrite = rboForMaterializedViewRewrite;
}

/** addTableReadLock */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,11 +268,11 @@ public static Plan rewriteByRules(
cascadesContext.getStatementContext(), rewrittenPlan,
cascadesContext.getCurrentJobContext().getRequiredProperties());
try {
rewrittenPlanContext.getConnectContext().getStatementContext().setRboInMaterializedViewRewrite(true);
rewrittenPlanContext.getConnectContext().getStatementContext().setRboForMaterializedViewRewrite(true);
rewrittenPlan = planRewriter.apply(rewrittenPlanContext);
} finally {
// Reset default value
rewrittenPlanContext.getConnectContext().getStatementContext().setRboInMaterializedViewRewrite(false);
rewrittenPlanContext.getConnectContext().getStatementContext().setRboForMaterializedViewRewrite(false);
}
Map<ExprId, Slot> exprIdToNewRewrittenSlot = Maps.newLinkedHashMap();
for (Slot slot : rewrittenPlan.getOutput()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public class AddDefaultLimit extends DefaultPlanRewriter<StatementContext> imple

@Override
public Plan rewriteRoot(Plan plan, JobContext jobContext) {
if (jobContext.getCascadesContext().getStatementContext().isRboInMaterializedViewRewrite()) {
if (jobContext.getCascadesContext().getStatementContext().isRboForMaterializedViewRewrite()) {
// If RBO in materialized view rewrite, should not add default limit
return plan;
}
Expand Down

0 comments on commit 17238e6

Please sign in to comment.