From 6f62cb61b91ee5ac6fe397354890eea576d4e2e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=A2=E5=81=A5?= Date: Fri, 10 Nov 2023 22:16:32 +0800 Subject: [PATCH] [fix](Nereids) fix plan shape of query64 unstable (#26012) (#26775) don't remove the physical plan after optimizing the plan in dphyper. --- .../nereids/jobs/executor/Optimizer.java | 2 -- .../org/apache/doris/nereids/memo/Memo.java | 26 ------------------- 2 files changed, 28 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/jobs/executor/Optimizer.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/jobs/executor/Optimizer.java index 5f1ace6ea7e920..86a64d929b8255 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/jobs/executor/Optimizer.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/jobs/executor/Optimizer.java @@ -80,8 +80,6 @@ private void dpHypOptimize() { // Due to EnsureProjectOnTopJoin, root group can't be Join Group, so DPHyp doesn't change the root group cascadesContext.pushJob(new JoinOrderJob(root, cascadesContext.getCurrentJobContext())); cascadesContext.getJobScheduler().executeJobPool(cascadesContext); - // after DPHyp just keep logical expression - cascadesContext.getMemo().removePhysicalExpression(); cascadesContext.getStatementContext().setOtherJoinReorder(true); } diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/memo/Memo.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/memo/Memo.java index 4204f33ca1591b..5ec774941ddeb9 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/memo/Memo.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/memo/Memo.java @@ -47,7 +47,6 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; -import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Optional; @@ -111,31 +110,6 @@ public int getGroupExpressionsSize() { return groupExpressions.size(); } - /** just keep LogicalExpression in Memo. */ - public void removePhysicalExpression() { - groupExpressions.entrySet().removeIf(entry -> entry.getValue().getPlan() instanceof PhysicalPlan); - - Iterator> iterator = groups.entrySet().iterator(); - while (iterator.hasNext()) { - Map.Entry entry = iterator.next(); - Group group = entry.getValue(); - - group.clearPhysicalExpressions(); - group.clearLowestCostPlans(); - group.removeParentPhysicalExpressions(); - group.setExplored(false); - - if (group.getLogicalExpressions().isEmpty() && group.getPhysicalExpressions().isEmpty()) { - iterator.remove(); - } - } - - // logical groupExpression reset ruleMask - groupExpressions.values().stream() - .filter(groupExpression -> groupExpression.getPlan() instanceof LogicalPlan) - .forEach(GroupExpression::clearApplied); - } - private Plan skipProject(Plan plan, Group targetGroup) { // Some top project can't be eliminated if (plan instanceof LogicalProject && ((LogicalProject) plan).canEliminate()) {