From 17238e654faff8ea606944968ff7c95d5bd5e00f Mon Sep 17 00:00:00 2001 From: seawinde Date: Wed, 4 Sep 2024 16:50:10 +0800 Subject: [PATCH] optimize code usage --- .../org/apache/doris/nereids/StatementContext.java | 10 +++++----- .../rules/exploration/mv/MaterializedViewUtils.java | 4 ++-- .../doris/nereids/rules/rewrite/AddDefaultLimit.java | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/StatementContext.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/StatementContext.java index 1030d1c0ee12bc0..06e3364f1ea1155 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/StatementContext.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/StatementContext.java @@ -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); @@ -432,12 +432,12 @@ public Map 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 */ diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/exploration/mv/MaterializedViewUtils.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/exploration/mv/MaterializedViewUtils.java index 890681b5640eb1b..a4b717218ae6e6c 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/exploration/mv/MaterializedViewUtils.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/exploration/mv/MaterializedViewUtils.java @@ -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 exprIdToNewRewrittenSlot = Maps.newLinkedHashMap(); for (Slot slot : rewrittenPlan.getOutput()) { diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/AddDefaultLimit.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/AddDefaultLimit.java index a2f42c6776820fe..e03b8a99ca86c1e 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/AddDefaultLimit.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/AddDefaultLimit.java @@ -36,7 +36,7 @@ public class AddDefaultLimit extends DefaultPlanRewriter 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; }