This is an automated email from the ASF dual-hosted git repository. jakevin pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push: new bb67a1467a [fix](Nereids): mergeGroup should merge target Group into existed Group (#22123) bb67a1467a is described below commit bb67a1467a6647a27abbd65a27470026c7efa9fb Author: jakevin <jakevin...@gmail.com> AuthorDate: Wed Jul 26 13:13:25 2023 +0800 [fix](Nereids): mergeGroup should merge target Group into existed Group (#22123) --- .../nereids/jobs/joinorder/hypergraph/Node.java | 1 + .../hypergraph/receiver/PlanReceiver.java | 26 ++--- .../java/org/apache/doris/nereids/memo/Memo.java | 45 ++++++-- .../org/apache/doris/nereids/memo/MemoTest.java | 2 +- .../org/apache/doris/nereids/util/PlanChecker.java | 22 ++-- .../nereids_tpcds_shape_sf100_p0/shape/query15.out | 5 +- .../nereids_tpcds_shape_sf100_p0/shape/query16.out | 16 +-- .../nereids_tpcds_shape_sf100_p0/shape/query33.out | 122 ++++++++++----------- .../nereids_tpcds_shape_sf100_p0/shape/query40.out | 33 +++--- .../nereids_tpcds_shape_sf100_p0/shape/query6.out | 33 +++--- .../nereids_tpcds_shape_sf100_p0/shape/query62.out | 14 +-- .../nereids_tpcds_shape_sf100_p0/shape/query66.out | 24 ++-- .../nereids_tpcds_shape_sf100_p0/shape/query68.out | 21 ++-- .../nereids_tpcds_shape_sf100_p0/shape/query99.out | 14 +-- .../nereids_tpch_shape_sf1000_p0/shape/q21.out | 10 +- .../data/nereids_tpch_shape_sf500_p0/shape/q21.out | 10 +- 16 files changed, 215 insertions(+), 183 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/jobs/joinorder/hypergraph/Node.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/jobs/joinorder/hypergraph/Node.java index 599db01987..40c5171769 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/jobs/joinorder/hypergraph/Node.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/jobs/joinorder/hypergraph/Node.java @@ -29,6 +29,7 @@ import java.util.List; */ public class Node { private final int index; + // TODO private final Group group; private final List<Edge> edges = new ArrayList<>(); diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/jobs/joinorder/hypergraph/receiver/PlanReceiver.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/jobs/joinorder/hypergraph/receiver/PlanReceiver.java index c29cac616a..2c1b7ebed5 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/jobs/joinorder/hypergraph/receiver/PlanReceiver.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/jobs/joinorder/hypergraph/receiver/PlanReceiver.java @@ -58,6 +58,7 @@ import java.util.HashSet; import java.util.List; import java.util.Optional; import java.util.Set; +import java.util.function.Supplier; import java.util.stream.Collectors; import javax.annotation.Nullable; @@ -133,7 +134,7 @@ public class PlanReceiver implements AbstractReceiver { } Group group = planTable.get(fullKey); for (Plan plan : physicalPlans) { - CopyInResult copyInResult = memo.copyIn(plan, group, false); + CopyInResult copyInResult = memo.copyIn(plan, group, false, planTable); GroupExpression physicalExpression = copyInResult.correspondingExpression; proposeAllDistributedPlans(physicalExpression); } @@ -272,7 +273,7 @@ public class PlanReceiver implements AbstractReceiver { usdEdges.put(bitmap, new BitSet()); Plan plan = proposeProject(Lists.newArrayList(new GroupPlan(group)), new ArrayList<>(), bitmap, bitmap).get(0); if (!(plan instanceof GroupPlan)) { - CopyInResult copyInResult = jobContext.getCascadesContext().getMemo().copyIn(plan, null, false); + CopyInResult copyInResult = jobContext.getCascadesContext().getMemo().copyIn(plan, null, false, planTable); group = copyInResult.correspondingExpression.getOwnerGroup(); } planTable.put(bitmap, group); @@ -295,23 +296,21 @@ public class PlanReceiver implements AbstractReceiver { @Override public Group getBestPlan(long bitmap) { - Group root = planTable.get(bitmap); - Preconditions.checkState(root != null); // If there are some rules relied on the logical join, we need to make logical Expression // However, it cost 15% of total optimized time. - makeLogicalExpression(root); - return root; + makeLogicalExpression(() -> planTable.get(bitmap)); + return planTable.get(bitmap); } - private void makeLogicalExpression(Group root) { - if (!root.getLogicalExpressions().isEmpty()) { + private void makeLogicalExpression(Supplier<Group> root) { + if (!root.get().getLogicalExpressions().isEmpty()) { return; } // only makeLogicalExpression for those winners Set<GroupExpression> hasGenerated = new HashSet<>(); - for (PhysicalProperties physicalProperties : root.getAllProperties()) { - GroupExpression groupExpression = root.getBestPlan(physicalProperties); + for (PhysicalProperties physicalProperties : root.get().getAllProperties()) { + GroupExpression groupExpression = root.get().getBestPlan(physicalProperties); if (hasGenerated.contains(groupExpression) || groupExpression.getPlan() instanceof PhysicalDistribute) { continue; } @@ -319,8 +318,9 @@ public class PlanReceiver implements AbstractReceiver { // process child first, plan's child may be changed due to mergeGroup Plan physicalPlan = groupExpression.getPlan(); - for (Group child : groupExpression.children()) { - makeLogicalExpression(child); + for (int i = 0; i < groupExpression.children().size(); i++) { + int childIdx = i; + makeLogicalExpression(() -> groupExpression.child(childIdx)); } Plan logicalPlan; @@ -336,7 +336,7 @@ public class PlanReceiver implements AbstractReceiver { } else { throw new RuntimeException("DPhyp can only handle join and project operator"); } - jobContext.getCascadesContext().getMemo().copyIn(logicalPlan, root, false); + jobContext.getCascadesContext().getMemo().copyIn(logicalPlan, root.get(), false, planTable); } } 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 67534014ce..a313975684 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 @@ -45,6 +45,7 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import java.util.ArrayList; +import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; @@ -198,6 +199,20 @@ public class Memo { return Pair.of(continuousJoinCount, Math.max(continuousJoinCount, maxJoinCount)); } + /** + * Add plan to Memo. + */ + public CopyInResult copyIn(Plan plan, @Nullable Group target, boolean rewrite, HashMap<Long, Group> planTable) { + CopyInResult result; + if (rewrite) { + result = doRewrite(plan, target); + } else { + result = doCopyIn(skipProject(plan, target), target, planTable); + } + maybeAddStateId(result); + return result; + } + /** * Add plan to Memo. * @@ -213,7 +228,7 @@ public class Memo { if (rewrite) { result = doRewrite(plan, target); } else { - result = doCopyIn(skipProject(plan, target), target); + result = doCopyIn(skipProject(plan, target), target, null); } maybeAddStateId(result); return result; @@ -401,7 +416,7 @@ public class Memo { * @return a pair, in which the first element is true if a newly generated groupExpression added into memo, * and the second element is a reference of node in Memo */ - private CopyInResult doCopyIn(Plan plan, @Nullable Group targetGroup) { + private CopyInResult doCopyIn(Plan plan, @Nullable Group targetGroup, @Nullable HashMap<Long, Group> planTable) { Preconditions.checkArgument(!(plan instanceof GroupPlan), "plan can not be GroupPlan"); // check logicalproperties, must same output in a Group. if (targetGroup != null && !plan.getLogicalProperties().equals(targetGroup.getLogicalProperties())) { @@ -424,12 +439,12 @@ public class Memo { } else if (child.getGroupExpression().isPresent()) { childrenGroups.add(child.getGroupExpression().get().getOwnerGroup()); } else { - childrenGroups.add(doCopyIn(child, null).correspondingExpression.getOwnerGroup()); + childrenGroups.add(doCopyIn(child, null, planTable).correspondingExpression.getOwnerGroup()); } } plan = replaceChildrenToGroupPlan(plan, childrenGroups); GroupExpression newGroupExpression = new GroupExpression(plan, childrenGroups); - return insertGroupExpression(newGroupExpression, targetGroup, plan.getLogicalProperties()); + return insertGroupExpression(newGroupExpression, targetGroup, plan.getLogicalProperties(), planTable); // TODO: need to derive logical property if generate new group. currently we not copy logical plan into } @@ -473,12 +488,12 @@ public class Memo { * @return a pair, in which the first element is true if a newly generated groupExpression added into memo, * and the second element is a reference of node in Memo */ - private CopyInResult insertGroupExpression( - GroupExpression groupExpression, Group target, LogicalProperties logicalProperties) { + private CopyInResult insertGroupExpression(GroupExpression groupExpression, Group target, + LogicalProperties logicalProperties, HashMap<Long, Group> planTable) { GroupExpression existedGroupExpression = groupExpressions.get(groupExpression); if (existedGroupExpression != null) { if (target != null && !target.getGroupId().equals(existedGroupExpression.getOwnerGroup().getGroupId())) { - mergeGroup(existedGroupExpression.getOwnerGroup(), target); + mergeGroup(target, existedGroupExpression.getOwnerGroup(), planTable); } // When we create a GroupExpression, we will add it into ParentExpression of childGroup. // But if it already exists, we should remove it from ParentExpression of childGroup. @@ -505,7 +520,7 @@ public class Memo { * @param source source group * @param destination destination group */ - public void mergeGroup(Group source, Group destination) { + public void mergeGroup(Group source, Group destination, HashMap<Long, Group> planTable) { if (source.equals(destination)) { return; } @@ -544,13 +559,25 @@ public class Memo { reinsertGroupExpr.mergeTo(existGroupExpr); } else { // reinsertGroupExpr & existGroupExpr aren't in same group, need to merge their OwnerGroup. - mergeGroup(reinsertGroupExpr.getOwnerGroup(), existGroupExpr.getOwnerGroup()); + mergeGroup(reinsertGroupExpr.getOwnerGroup(), existGroupExpr.getOwnerGroup(), planTable); } } else { groupExpressions.put(reinsertGroupExpr, reinsertGroupExpr); } } + // replace source with destination in groups of planTable + if (planTable != null) { + planTable.forEach((bitset, group) -> { + if (group.equals(source)) { + planTable.put(bitset, destination); + } + }); + } + source.mergeTo(destination); + if (source == root) { + root = destination; + } groups.remove(source.getGroupId()); } diff --git a/fe/fe-core/src/test/java/org/apache/doris/nereids/memo/MemoTest.java b/fe/fe-core/src/test/java/org/apache/doris/nereids/memo/MemoTest.java index 3f55ba9579..9689227d7c 100644 --- a/fe/fe-core/src/test/java/org/apache/doris/nereids/memo/MemoTest.java +++ b/fe/fe-core/src/test/java/org/apache/doris/nereids/memo/MemoTest.java @@ -110,7 +110,7 @@ class MemoTest implements MemoPatternMatchSupported { groupExpressions.put(srcParentExpression, srcParentExpression); groupExpressions.put(dstParentExpression, dstParentExpression); - memo.mergeGroup(srcGroup, dstGroup); + memo.mergeGroup(srcGroup, dstGroup, null); // check Assertions.assertEquals(0, srcGroup.getParentGroupExpressions().size()); diff --git a/fe/fe-core/src/test/java/org/apache/doris/nereids/util/PlanChecker.java b/fe/fe-core/src/test/java/org/apache/doris/nereids/util/PlanChecker.java index 66c855ae03..6c88f66056 100644 --- a/fe/fe-core/src/test/java/org/apache/doris/nereids/util/PlanChecker.java +++ b/fe/fe-core/src/test/java/org/apache/doris/nereids/util/PlanChecker.java @@ -65,7 +65,6 @@ import org.apache.doris.planner.PlanFragment; import org.apache.doris.qe.ConnectContext; import org.apache.doris.qe.OriginStatement; -import com.google.common.base.Supplier; import com.google.common.collect.ImmutableList; import com.google.common.collect.Lists; import com.google.common.collect.Sets; @@ -76,6 +75,7 @@ import java.util.List; import java.util.Optional; import java.util.Set; import java.util.function.Consumer; +import java.util.function.Supplier; /** * Utility to apply rules to plan and check output plan matches the expected pattern. @@ -357,20 +357,24 @@ public class PlanChecker { } private PlanChecker applyExploration(Group group, Rule rule) { - // copy groupExpressions can prevent ConcurrentModificationException - for (GroupExpression logicalExpression : Lists.newArrayList(group.getLogicalExpressions())) { - applyExploration(logicalExpression, rule); + List<GroupExpression> logicalExpressions = Lists.newArrayList(group.getLogicalExpressions()); + for (int i = 0; i < logicalExpressions.size(); i++) { + final int childIdx = i; + applyExploration(() -> logicalExpressions.get(childIdx), rule); } - for (GroupExpression physicalExpression : Lists.newArrayList(group.getPhysicalExpressions())) { - applyExploration(physicalExpression, rule); + List<GroupExpression> physicalExpressions = Lists.newArrayList(group.getPhysicalExpressions()); + for (int i = 0; i < physicalExpressions.size(); i++) { + final int childIdx = i; + applyExploration(() -> physicalExpressions.get(childIdx), rule); } return this; } - private void applyExploration(GroupExpression groupExpression, Rule rule) { - GroupExpressionMatching matchResult = new GroupExpressionMatching(rule.getPattern(), groupExpression); + private void applyExploration(Supplier<GroupExpression> groupExpression, Rule rule) { + GroupExpressionMatching matchResult = new GroupExpressionMatching(rule.getPattern(), groupExpression.get()); + List<Group> childrenGroup = new ArrayList<>(groupExpression.get().children()); for (Plan before : matchResult) { Plan after = rule.transform(before, cascadesContext).get(0); if (before != after) { @@ -378,7 +382,7 @@ public class PlanChecker { } } - for (Group childGroup : groupExpression.children()) { + for (Group childGroup : childrenGroup) { applyExploration(childGroup, rule); } } diff --git a/regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query15.out b/regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query15.out index 9d365f0d82..3276beaec8 100644 --- a/regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query15.out +++ b/regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query15.out @@ -19,9 +19,10 @@ PhysicalTopN ----------------PhysicalDistribute ------------------PhysicalProject --------------------hashJoin[INNER_JOIN](customer.c_current_addr_sk = customer_address.ca_address_sk) -----------------------PhysicalProject -------------------------PhysicalOlapScan[customer_address] ----------------------PhysicalDistribute ------------------------PhysicalProject --------------------------PhysicalOlapScan[customer] +----------------------PhysicalDistribute +------------------------PhysicalProject +--------------------------PhysicalOlapScan[customer_address] diff --git a/regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query16.out b/regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query16.out index 1d8f699cb2..eefd61c93b 100644 --- a/regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query16.out +++ b/regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query16.out @@ -13,16 +13,16 @@ PhysicalTopN --------------------PhysicalOlapScan[call_center] ----------------PhysicalDistribute ------------------PhysicalProject ---------------------hashJoin[INNER_JOIN](cs1.cs_ship_date_sk = date_dim.d_date_sk) -----------------------PhysicalProject -------------------------filter((cast(d_date as DATETIMEV2(0)) <= cast(days_add(cast('2002-4-01' as DATEV2), INTERVAL 60 DAY) as DATETIMEV2(0)))(date_dim.d_date >= 2002-04-01)) ---------------------------PhysicalOlapScan[date_dim] +--------------------hashJoin[RIGHT_SEMI_JOIN](cs1.cs_order_number = cs2.cs_order_number)( not (cs_warehouse_sk = cs_warehouse_sk)) ----------------------PhysicalDistribute ------------------------PhysicalProject ---------------------------hashJoin[RIGHT_SEMI_JOIN](cs1.cs_order_number = cs2.cs_order_number)( not (cs_warehouse_sk = cs_warehouse_sk)) -----------------------------PhysicalDistribute -------------------------------PhysicalProject ---------------------------------PhysicalOlapScan[catalog_sales] +--------------------------PhysicalOlapScan[catalog_sales] +----------------------PhysicalDistribute +------------------------hashJoin[INNER_JOIN](cs1.cs_ship_date_sk = date_dim.d_date_sk) +--------------------------PhysicalProject +----------------------------filter((cast(d_date as DATETIMEV2(0)) <= cast(days_add(cast('2002-4-01' as DATEV2), INTERVAL 60 DAY) as DATETIMEV2(0)))(date_dim.d_date >= 2002-04-01)) +------------------------------PhysicalOlapScan[date_dim] +--------------------------PhysicalDistribute ----------------------------hashJoin[RIGHT_ANTI_JOIN](cs1.cs_order_number = cr1.cr_order_number) ------------------------------PhysicalDistribute --------------------------------PhysicalProject diff --git a/regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query33.out b/regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query33.out index 731dc27082..e9a32797ac 100644 --- a/regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query33.out +++ b/regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query33.out @@ -8,71 +8,71 @@ PhysicalTopN ----------hashAgg[LOCAL] ------------PhysicalUnion --------------PhysicalProject -----------------hashJoin[LEFT_SEMI_JOIN](item.i_manufact_id = item.i_manufact_id) -------------------hashAgg[GLOBAL] ---------------------PhysicalDistribute -----------------------hashAgg[LOCAL] -------------------------PhysicalProject ---------------------------hashJoin[INNER_JOIN](store_sales.ss_item_sk = item.i_item_sk) -----------------------------PhysicalDistribute -------------------------------PhysicalProject ---------------------------------hashJoin[INNER_JOIN](store_sales.ss_addr_sk = customer_address.ca_address_sk) -----------------------------------PhysicalDistribute -------------------------------------PhysicalProject ---------------------------------------hashJoin[INNER_JOIN](store_sales.ss_sold_date_sk = date_dim.d_date_sk) +----------------hashAgg[GLOBAL] +------------------PhysicalDistribute +--------------------hashAgg[LOCAL] +----------------------PhysicalProject +------------------------hashJoin[INNER_JOIN](store_sales.ss_item_sk = item.i_item_sk) +--------------------------PhysicalDistribute +----------------------------PhysicalProject +------------------------------hashJoin[INNER_JOIN](store_sales.ss_addr_sk = customer_address.ca_address_sk) +--------------------------------PhysicalDistribute +----------------------------------PhysicalProject +------------------------------------hashJoin[INNER_JOIN](store_sales.ss_sold_date_sk = date_dim.d_date_sk) +--------------------------------------PhysicalProject +----------------------------------------PhysicalOlapScan[store_sales] +--------------------------------------PhysicalDistribute ----------------------------------------PhysicalProject -------------------------------------------PhysicalOlapScan[store_sales] -----------------------------------------PhysicalDistribute -------------------------------------------PhysicalProject ---------------------------------------------filter((date_dim.d_moy = 1)(date_dim.d_year = 2002)) -----------------------------------------------PhysicalOlapScan[date_dim] -----------------------------------PhysicalDistribute -------------------------------------PhysicalProject ---------------------------------------filter((customer_address.ca_gmt_offset = -5.00)) -----------------------------------------PhysicalOlapScan[customer_address] -----------------------------PhysicalDistribute +------------------------------------------filter((date_dim.d_moy = 1)(date_dim.d_year = 2002)) +--------------------------------------------PhysicalOlapScan[date_dim] +--------------------------------PhysicalDistribute +----------------------------------PhysicalProject +------------------------------------filter((customer_address.ca_gmt_offset = -5.00)) +--------------------------------------PhysicalOlapScan[customer_address] +--------------------------PhysicalDistribute +----------------------------hashJoin[LEFT_SEMI_JOIN](item.i_manufact_id = item.i_manufact_id) ------------------------------PhysicalProject --------------------------------PhysicalOlapScan[item] -------------------PhysicalDistribute ---------------------PhysicalProject -----------------------filter((item.i_category = 'Home')) -------------------------PhysicalOlapScan[item] +------------------------------PhysicalDistribute +--------------------------------PhysicalProject +----------------------------------filter((item.i_category = 'Home')) +------------------------------------PhysicalOlapScan[item] --------------PhysicalProject -----------------hashJoin[LEFT_SEMI_JOIN](item.i_manufact_id = item.i_manufact_id) -------------------hashAgg[GLOBAL] ---------------------PhysicalDistribute -----------------------hashAgg[LOCAL] -------------------------PhysicalProject ---------------------------hashJoin[INNER_JOIN](catalog_sales.cs_item_sk = item.i_item_sk) -----------------------------PhysicalDistribute -------------------------------PhysicalProject ---------------------------------hashJoin[INNER_JOIN](catalog_sales.cs_bill_addr_sk = customer_address.ca_address_sk) -----------------------------------PhysicalDistribute -------------------------------------PhysicalProject ---------------------------------------hashJoin[INNER_JOIN](catalog_sales.cs_sold_date_sk = date_dim.d_date_sk) +----------------hashAgg[GLOBAL] +------------------PhysicalDistribute +--------------------hashAgg[LOCAL] +----------------------PhysicalProject +------------------------hashJoin[INNER_JOIN](catalog_sales.cs_item_sk = item.i_item_sk) +--------------------------PhysicalDistribute +----------------------------PhysicalProject +------------------------------hashJoin[INNER_JOIN](catalog_sales.cs_bill_addr_sk = customer_address.ca_address_sk) +--------------------------------PhysicalDistribute +----------------------------------PhysicalProject +------------------------------------hashJoin[INNER_JOIN](catalog_sales.cs_sold_date_sk = date_dim.d_date_sk) +--------------------------------------PhysicalProject +----------------------------------------PhysicalOlapScan[catalog_sales] +--------------------------------------PhysicalDistribute ----------------------------------------PhysicalProject -------------------------------------------PhysicalOlapScan[catalog_sales] -----------------------------------------PhysicalDistribute -------------------------------------------PhysicalProject ---------------------------------------------filter((date_dim.d_moy = 1)(date_dim.d_year = 2002)) -----------------------------------------------PhysicalOlapScan[date_dim] -----------------------------------PhysicalDistribute -------------------------------------PhysicalProject ---------------------------------------filter((customer_address.ca_gmt_offset = -5.00)) -----------------------------------------PhysicalOlapScan[customer_address] -----------------------------PhysicalDistribute +------------------------------------------filter((date_dim.d_moy = 1)(date_dim.d_year = 2002)) +--------------------------------------------PhysicalOlapScan[date_dim] +--------------------------------PhysicalDistribute +----------------------------------PhysicalProject +------------------------------------filter((customer_address.ca_gmt_offset = -5.00)) +--------------------------------------PhysicalOlapScan[customer_address] +--------------------------PhysicalDistribute +----------------------------hashJoin[LEFT_SEMI_JOIN](item.i_manufact_id = item.i_manufact_id) ------------------------------PhysicalProject --------------------------------PhysicalOlapScan[item] -------------------PhysicalDistribute ---------------------PhysicalProject -----------------------filter((item.i_category = 'Home')) -------------------------PhysicalOlapScan[item] +------------------------------PhysicalDistribute +--------------------------------PhysicalProject +----------------------------------filter((item.i_category = 'Home')) +------------------------------------PhysicalOlapScan[item] --------------PhysicalProject -----------------hashJoin[LEFT_SEMI_JOIN](item.i_manufact_id = item.i_manufact_id) -------------------hashAgg[GLOBAL] ---------------------PhysicalDistribute -----------------------hashAgg[LOCAL] -------------------------PhysicalProject +----------------hashAgg[GLOBAL] +------------------PhysicalDistribute +--------------------hashAgg[LOCAL] +----------------------PhysicalProject +------------------------hashJoin[LEFT_SEMI_JOIN](item.i_manufact_id = item.i_manufact_id) --------------------------hashJoin[INNER_JOIN](web_sales.ws_item_sk = item.i_item_sk) ----------------------------PhysicalProject ------------------------------PhysicalOlapScan[item] @@ -92,8 +92,8 @@ PhysicalTopN ------------------------------------PhysicalProject --------------------------------------filter((customer_address.ca_gmt_offset = -5.00)) ----------------------------------------PhysicalOlapScan[customer_address] -------------------PhysicalDistribute ---------------------PhysicalProject -----------------------filter((item.i_category = 'Home')) -------------------------PhysicalOlapScan[item] +--------------------------PhysicalDistribute +----------------------------PhysicalProject +------------------------------filter((item.i_category = 'Home')) +--------------------------------PhysicalOlapScan[item] diff --git a/regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query40.out b/regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query40.out index 693a3f8136..5b6553bb24 100644 --- a/regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query40.out +++ b/regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query40.out @@ -7,25 +7,24 @@ PhysicalTopN --------PhysicalDistribute ----------hashAgg[LOCAL] ------------PhysicalProject ---------------hashJoin[RIGHT_OUTER_JOIN](catalog_sales.cs_item_sk = catalog_returns.cr_item_sk)(catalog_sales.cs_order_number = catalog_returns.cr_order_number) +--------------hashJoin[INNER_JOIN](catalog_sales.cs_warehouse_sk = warehouse.w_warehouse_sk) ----------------PhysicalProject -------------------PhysicalOlapScan[catalog_returns] -----------------PhysicalProject -------------------hashJoin[INNER_JOIN](catalog_sales.cs_sold_date_sk = date_dim.d_date_sk) +------------------hashJoin[RIGHT_OUTER_JOIN](catalog_sales.cs_item_sk = catalog_returns.cr_item_sk)(catalog_sales.cs_order_number = catalog_returns.cr_order_number) --------------------PhysicalProject -----------------------hashJoin[INNER_JOIN](catalog_sales.cs_warehouse_sk = warehouse.w_warehouse_sk) -------------------------hashJoin[INNER_JOIN](item.i_item_sk = catalog_sales.cs_item_sk) ---------------------------PhysicalProject -----------------------------PhysicalOlapScan[catalog_sales] ---------------------------PhysicalDistribute -----------------------------PhysicalProject -------------------------------filter((item.i_current_price >= 0.99)(item.i_current_price <= 1.49)) ---------------------------------PhysicalOlapScan[item] +----------------------PhysicalOlapScan[catalog_returns] +--------------------hashJoin[INNER_JOIN](catalog_sales.cs_sold_date_sk = date_dim.d_date_sk) +----------------------hashJoin[INNER_JOIN](item.i_item_sk = catalog_sales.cs_item_sk) +------------------------PhysicalProject +--------------------------PhysicalOlapScan[catalog_sales] ------------------------PhysicalDistribute --------------------------PhysicalProject -----------------------------PhysicalOlapScan[warehouse] ---------------------PhysicalDistribute -----------------------PhysicalProject -------------------------filter((date_dim.d_date >= 2001-03-03)(date_dim.d_date <= 2001-05-02)) ---------------------------PhysicalOlapScan[date_dim] +----------------------------filter((item.i_current_price >= 0.99)(item.i_current_price <= 1.49)) +------------------------------PhysicalOlapScan[item] +----------------------PhysicalDistribute +------------------------PhysicalProject +--------------------------filter((date_dim.d_date >= 2001-03-03)(date_dim.d_date <= 2001-05-02)) +----------------------------PhysicalOlapScan[date_dim] +----------------PhysicalDistribute +------------------PhysicalProject +--------------------PhysicalOlapScan[warehouse] diff --git a/regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query6.out b/regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query6.out index aa6c71623d..853909e2c9 100644 --- a/regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query6.out +++ b/regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query6.out @@ -15,23 +15,22 @@ PhysicalTopN ------------------------PhysicalProject --------------------------hashJoin[INNER_JOIN](s.ss_item_sk = i.i_item_sk) ----------------------------PhysicalDistribute -------------------------------PhysicalProject ---------------------------------hashJoin[INNER_JOIN](s.ss_sold_date_sk = d.d_date_sk) -----------------------------------PhysicalProject -------------------------------------PhysicalOlapScan[store_sales] -----------------------------------PhysicalDistribute -------------------------------------hashJoin[INNER_JOIN](d.d_month_seq = date_dim.d_month_seq) ---------------------------------------PhysicalProject -----------------------------------------PhysicalOlapScan[date_dim] ---------------------------------------PhysicalDistribute -----------------------------------------PhysicalAssertNumRows -------------------------------------------PhysicalDistribute ---------------------------------------------hashAgg[GLOBAL] -----------------------------------------------PhysicalDistribute -------------------------------------------------hashAgg[LOCAL] ---------------------------------------------------PhysicalProject -----------------------------------------------------filter((date_dim.d_year = 2002)(date_dim.d_moy = 3)) -------------------------------------------------------PhysicalOlapScan[date_dim] +------------------------------hashJoin[INNER_JOIN](s.ss_sold_date_sk = d.d_date_sk) +--------------------------------PhysicalProject +----------------------------------PhysicalOlapScan[store_sales] +--------------------------------PhysicalDistribute +----------------------------------hashJoin[INNER_JOIN](d.d_month_seq = date_dim.d_month_seq) +------------------------------------PhysicalProject +--------------------------------------PhysicalOlapScan[date_dim] +------------------------------------PhysicalDistribute +--------------------------------------PhysicalAssertNumRows +----------------------------------------PhysicalDistribute +------------------------------------------hashAgg[GLOBAL] +--------------------------------------------PhysicalDistribute +----------------------------------------------hashAgg[LOCAL] +------------------------------------------------PhysicalProject +--------------------------------------------------filter((date_dim.d_year = 2002)(date_dim.d_moy = 3)) +----------------------------------------------------PhysicalOlapScan[date_dim] ----------------------------PhysicalDistribute ------------------------------PhysicalProject --------------------------------PhysicalOlapScan[item] diff --git a/regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query62.out b/regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query62.out index e66a13f8fe..f9551baabd 100644 --- a/regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query62.out +++ b/regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query62.out @@ -8,9 +8,9 @@ PhysicalTopN ----------hashAgg[LOCAL] ------------PhysicalProject --------------hashJoin[INNER_JOIN](web_sales.ws_warehouse_sk = warehouse.w_warehouse_sk) -----------------hashJoin[INNER_JOIN](web_sales.ws_web_site_sk = web_site.web_site_sk) -------------------PhysicalProject ---------------------hashJoin[INNER_JOIN](web_sales.ws_ship_mode_sk = ship_mode.sm_ship_mode_sk) +----------------PhysicalProject +------------------hashJoin[INNER_JOIN](web_sales.ws_ship_mode_sk = ship_mode.sm_ship_mode_sk) +--------------------hashJoin[INNER_JOIN](web_sales.ws_web_site_sk = web_site.web_site_sk) ----------------------hashJoin[INNER_JOIN](web_sales.ws_ship_date_sk = date_dim.d_date_sk) ------------------------PhysicalProject --------------------------PhysicalOlapScan[web_sales] @@ -20,10 +20,10 @@ PhysicalTopN ------------------------------PhysicalOlapScan[date_dim] ----------------------PhysicalDistribute ------------------------PhysicalProject ---------------------------PhysicalOlapScan[ship_mode] -------------------PhysicalDistribute ---------------------PhysicalProject -----------------------PhysicalOlapScan[web_site] +--------------------------PhysicalOlapScan[web_site] +--------------------PhysicalDistribute +----------------------PhysicalProject +------------------------PhysicalOlapScan[ship_mode] ----------------PhysicalDistribute ------------------PhysicalProject --------------------PhysicalOlapScan[warehouse] diff --git a/regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query66.out b/regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query66.out index e80fc9bdd9..ec829b426c 100644 --- a/regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query66.out +++ b/regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query66.out @@ -13,8 +13,8 @@ PhysicalTopN --------------------hashAgg[LOCAL] ----------------------PhysicalProject ------------------------hashJoin[INNER_JOIN](web_sales.ws_warehouse_sk = warehouse.w_warehouse_sk) ---------------------------hashJoin[INNER_JOIN](web_sales.ws_sold_time_sk = time_dim.t_time_sk) -----------------------------PhysicalProject +--------------------------PhysicalProject +----------------------------hashJoin[INNER_JOIN](web_sales.ws_sold_time_sk = time_dim.t_time_sk) ------------------------------hashJoin[INNER_JOIN](web_sales.ws_sold_date_sk = date_dim.d_date_sk) --------------------------------hashJoin[INNER_JOIN](web_sales.ws_ship_mode_sk = ship_mode.sm_ship_mode_sk) ----------------------------------PhysicalProject @@ -27,10 +27,10 @@ PhysicalTopN ----------------------------------PhysicalProject ------------------------------------filter((date_dim.d_year = 1998)) --------------------------------------PhysicalOlapScan[date_dim] -----------------------------PhysicalDistribute -------------------------------PhysicalProject ---------------------------------filter((cast(t_time as BIGINT) <= 77621)(cast(t_time as BIGINT) >= 48821)) -----------------------------------PhysicalOlapScan[time_dim] +------------------------------PhysicalDistribute +--------------------------------PhysicalProject +----------------------------------filter((cast(t_time as BIGINT) <= 77621)(cast(t_time as BIGINT) >= 48821)) +------------------------------------PhysicalOlapScan[time_dim] --------------------------PhysicalDistribute ----------------------------PhysicalProject ------------------------------PhysicalOlapScan[warehouse] @@ -40,8 +40,8 @@ PhysicalTopN --------------------hashAgg[LOCAL] ----------------------PhysicalProject ------------------------hashJoin[INNER_JOIN](catalog_sales.cs_warehouse_sk = warehouse.w_warehouse_sk) ---------------------------hashJoin[INNER_JOIN](catalog_sales.cs_sold_time_sk = time_dim.t_time_sk) -----------------------------PhysicalProject +--------------------------PhysicalProject +----------------------------hashJoin[INNER_JOIN](catalog_sales.cs_sold_time_sk = time_dim.t_time_sk) ------------------------------hashJoin[INNER_JOIN](catalog_sales.cs_sold_date_sk = date_dim.d_date_sk) --------------------------------hashJoin[INNER_JOIN](catalog_sales.cs_ship_mode_sk = ship_mode.sm_ship_mode_sk) ----------------------------------PhysicalProject @@ -54,10 +54,10 @@ PhysicalTopN ----------------------------------PhysicalProject ------------------------------------filter((date_dim.d_year = 1998)) --------------------------------------PhysicalOlapScan[date_dim] -----------------------------PhysicalDistribute -------------------------------PhysicalProject ---------------------------------filter((cast(t_time as BIGINT) <= 77621)(cast(t_time as BIGINT) >= 48821)) -----------------------------------PhysicalOlapScan[time_dim] +------------------------------PhysicalDistribute +--------------------------------PhysicalProject +----------------------------------filter((cast(t_time as BIGINT) <= 77621)(cast(t_time as BIGINT) >= 48821)) +------------------------------------PhysicalOlapScan[time_dim] --------------------------PhysicalDistribute ----------------------------PhysicalProject ------------------------------PhysicalOlapScan[warehouse] diff --git a/regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query68.out b/regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query68.out index b8d7713b30..9479639231 100644 --- a/regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query68.out +++ b/regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query68.out @@ -23,18 +23,19 @@ PhysicalTopN --------------------------PhysicalDistribute ----------------------------PhysicalProject ------------------------------hashJoin[INNER_JOIN](store_sales.ss_hdemo_sk = household_demographics.hd_demo_sk) ---------------------------------hashJoin[INNER_JOIN](store_sales.ss_store_sk = store.s_store_sk) -----------------------------------hashJoin[INNER_JOIN](store_sales.ss_sold_date_sk = date_dim.d_date_sk) -------------------------------------PhysicalProject ---------------------------------------PhysicalOlapScan[store_sales] +--------------------------------PhysicalProject +----------------------------------hashJoin[INNER_JOIN](store_sales.ss_store_sk = store.s_store_sk) +------------------------------------hashJoin[INNER_JOIN](store_sales.ss_sold_date_sk = date_dim.d_date_sk) +--------------------------------------PhysicalProject +----------------------------------------PhysicalOlapScan[store_sales] +--------------------------------------PhysicalDistribute +----------------------------------------PhysicalProject +------------------------------------------filter((date_dim.d_dom >= 1)d_year IN (1998, 1999, 2000)(date_dim.d_dom <= 2)) +--------------------------------------------PhysicalOlapScan[date_dim] ------------------------------------PhysicalDistribute --------------------------------------PhysicalProject -----------------------------------------filter((date_dim.d_dom >= 1)d_year IN (1998, 1999, 2000)(date_dim.d_dom <= 2)) -------------------------------------------PhysicalOlapScan[date_dim] -----------------------------------PhysicalDistribute -------------------------------------PhysicalProject ---------------------------------------filter(s_city IN ('Pleasant Hill', 'Five Points')) -----------------------------------------PhysicalOlapScan[store] +----------------------------------------filter(s_city IN ('Pleasant Hill', 'Five Points')) +------------------------------------------PhysicalOlapScan[store] --------------------------------PhysicalDistribute ----------------------------------PhysicalProject ------------------------------------filter(((household_demographics.hd_dep_count = 8) OR (household_demographics.hd_vehicle_count = -1))) diff --git a/regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query99.out b/regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query99.out index e48e37418c..67c328915c 100644 --- a/regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query99.out +++ b/regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query99.out @@ -8,9 +8,9 @@ PhysicalTopN ----------hashAgg[LOCAL] ------------PhysicalProject --------------hashJoin[INNER_JOIN](catalog_sales.cs_warehouse_sk = warehouse.w_warehouse_sk) -----------------hashJoin[INNER_JOIN](catalog_sales.cs_call_center_sk = call_center.cc_call_center_sk) -------------------PhysicalProject ---------------------hashJoin[INNER_JOIN](catalog_sales.cs_ship_mode_sk = ship_mode.sm_ship_mode_sk) +----------------PhysicalProject +------------------hashJoin[INNER_JOIN](catalog_sales.cs_ship_mode_sk = ship_mode.sm_ship_mode_sk) +--------------------hashJoin[INNER_JOIN](catalog_sales.cs_call_center_sk = call_center.cc_call_center_sk) ----------------------hashJoin[INNER_JOIN](catalog_sales.cs_ship_date_sk = date_dim.d_date_sk) ------------------------PhysicalProject --------------------------PhysicalOlapScan[catalog_sales] @@ -20,10 +20,10 @@ PhysicalTopN ------------------------------PhysicalOlapScan[date_dim] ----------------------PhysicalDistribute ------------------------PhysicalProject ---------------------------PhysicalOlapScan[ship_mode] -------------------PhysicalDistribute ---------------------PhysicalProject -----------------------PhysicalOlapScan[call_center] +--------------------------PhysicalOlapScan[call_center] +--------------------PhysicalDistribute +----------------------PhysicalProject +------------------------PhysicalOlapScan[ship_mode] ----------------PhysicalDistribute ------------------PhysicalProject --------------------PhysicalOlapScan[warehouse] diff --git a/regression-test/data/nereids_tpch_shape_sf1000_p0/shape/q21.out b/regression-test/data/nereids_tpch_shape_sf1000_p0/shape/q21.out index 1ebbb4a839..722b813a7d 100644 --- a/regression-test/data/nereids_tpch_shape_sf1000_p0/shape/q21.out +++ b/regression-test/data/nereids_tpch_shape_sf1000_p0/shape/q21.out @@ -7,13 +7,13 @@ PhysicalTopN --------PhysicalDistribute ----------hashAgg[LOCAL] ------------PhysicalProject ---------------hashJoin[RIGHT_SEMI_JOIN](l2.l_orderkey = l1.l_orderkey)( not (l_suppkey = l_suppkey)) +--------------hashJoin[INNER_JOIN](orders.o_orderkey = l1.l_orderkey) ----------------PhysicalProject -------------------PhysicalOlapScan[lineitem] -----------------hashJoin[INNER_JOIN](orders.o_orderkey = l1.l_orderkey) +------------------filter((orders.o_orderstatus = 'F')) +--------------------PhysicalOlapScan[orders] +----------------hashJoin[RIGHT_SEMI_JOIN](l2.l_orderkey = l1.l_orderkey)( not (l_suppkey = l_suppkey)) ------------------PhysicalProject ---------------------filter((orders.o_orderstatus = 'F')) -----------------------PhysicalOlapScan[orders] +--------------------PhysicalOlapScan[lineitem] ------------------hashJoin[RIGHT_ANTI_JOIN](l3.l_orderkey = l1.l_orderkey)( not (l_suppkey = l_suppkey)) --------------------PhysicalProject ----------------------filter((l3.l_receiptdate > l3.l_commitdate)) diff --git a/regression-test/data/nereids_tpch_shape_sf500_p0/shape/q21.out b/regression-test/data/nereids_tpch_shape_sf500_p0/shape/q21.out index 1ebbb4a839..722b813a7d 100644 --- a/regression-test/data/nereids_tpch_shape_sf500_p0/shape/q21.out +++ b/regression-test/data/nereids_tpch_shape_sf500_p0/shape/q21.out @@ -7,13 +7,13 @@ PhysicalTopN --------PhysicalDistribute ----------hashAgg[LOCAL] ------------PhysicalProject ---------------hashJoin[RIGHT_SEMI_JOIN](l2.l_orderkey = l1.l_orderkey)( not (l_suppkey = l_suppkey)) +--------------hashJoin[INNER_JOIN](orders.o_orderkey = l1.l_orderkey) ----------------PhysicalProject -------------------PhysicalOlapScan[lineitem] -----------------hashJoin[INNER_JOIN](orders.o_orderkey = l1.l_orderkey) +------------------filter((orders.o_orderstatus = 'F')) +--------------------PhysicalOlapScan[orders] +----------------hashJoin[RIGHT_SEMI_JOIN](l2.l_orderkey = l1.l_orderkey)( not (l_suppkey = l_suppkey)) ------------------PhysicalProject ---------------------filter((orders.o_orderstatus = 'F')) -----------------------PhysicalOlapScan[orders] +--------------------PhysicalOlapScan[lineitem] ------------------hashJoin[RIGHT_ANTI_JOIN](l3.l_orderkey = l1.l_orderkey)( not (l_suppkey = l_suppkey)) --------------------PhysicalProject ----------------------filter((l3.l_receiptdate > l3.l_commitdate)) --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org