This is an automated email from the ASF dual-hosted git repository.

kxiao pushed a commit to branch branch-2.0
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-2.0 by this push:
     new ec6aedd479 [fix](Nereids): mergeGroup should merge target Group into 
existed Group (#22123) (#23199)
ec6aedd479 is described below

commit ec6aedd4795234035a9640a2b7c8dbce107e29fe
Author: jakevin <jakevin...@gmail.com>
AuthorDate: Mon Aug 21 10:13:24 2023 +0800

    [fix](Nereids): mergeGroup should merge target Group into existed Group 
(#22123) (#23199)
---
 .../nereids/jobs/joinorder/hypergraph/Node.java    |   1 +
 .../hypergraph/receiver/PlanReceiver.java          |  26 ++--
 .../org/apache/doris/nereids/util/PlanChecker.java |  22 +--
 .../nereids_tpcds_shape_sf100_p0/shape/query15.out |  45 +++---
 .../nereids_tpcds_shape_sf100_p0/shape/query16.out |  63 ++++-----
 .../nereids_tpcds_shape_sf100_p0/shape/query33.out | 157 ++++++++++-----------
 .../nereids_tpcds_shape_sf100_p0/shape/query40.out |  51 ++++---
 .../nereids_tpcds_shape_sf100_p0/shape/query6.out  |  95 ++++++-------
 .../nereids_tpcds_shape_sf100_p0/shape/query62.out |  47 +++---
 .../nereids_tpcds_shape_sf100_p0/shape/query66.out | 105 +++++++-------
 .../nereids_tpcds_shape_sf100_p0/shape/query68.out |  73 +++++-----
 .../nereids_tpcds_shape_sf100_p0/shape/query99.out |  47 +++---
 .../nereids_tpch_shape_sf1000_p0/shape/q21.out     |  51 ++++---
 .../data/nereids_tpch_shape_sf500_p0/shape/q21.out |  51 ++++---
 14 files changed, 414 insertions(+), 420 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 e364edf239..f058feff77 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
@@ -57,6 +57,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;
 
@@ -132,7 +133,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);
         }
@@ -266,7 +267,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);
@@ -289,23 +290,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;
             }
@@ -313,8 +312,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;
@@ -330,7 +330,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/test/java/org/apache/doris/nereids/util/PlanChecker.java 
b/fe/fe-core/src/test/java/org/apache/doris/nereids/util/PlanChecker.java
index ea04b2df77..8082a233cb 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 abb2fe6156..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
@@ -1,29 +1,28 @@
 -- This file is automatically generated. You should know what you did if you 
want to edit this
 -- !ds_shape_15 --
-PhysicalResultSink
---PhysicalTopN
-----PhysicalDistribute
-------PhysicalTopN
---------hashAgg[GLOBAL]
-----------PhysicalDistribute
-------------hashAgg[LOCAL]
---------------PhysicalProject
-----------------hashJoin[INNER_JOIN](catalog_sales.cs_bill_customer_sk = 
customer.c_customer_sk)((substring(ca_zip, 1, 5) IN ('85669', '86197', '88274', 
'83405', '86475', '85392', '85460', '80348', '81792') OR ca_state IN ('CA', 
'WA', 'GA')) OR (catalog_sales.cs_sales_price > 500.00))
-------------------PhysicalDistribute
---------------------hashJoin[INNER_JOIN](catalog_sales.cs_sold_date_sk = 
date_dim.d_date_sk)
+PhysicalTopN
+--PhysicalDistribute
+----PhysicalTopN
+------hashAgg[GLOBAL]
+--------PhysicalDistribute
+----------hashAgg[LOCAL]
+------------PhysicalProject
+--------------hashJoin[INNER_JOIN](catalog_sales.cs_bill_customer_sk = 
customer.c_customer_sk)((substring(ca_zip, 1, 5) IN ('85669', '86197', '88274', 
'83405', '86475', '85392', '85460', '80348', '81792') OR ca_state IN ('CA', 
'WA', 'GA')) OR (catalog_sales.cs_sales_price > 500.00))
+----------------PhysicalDistribute
+------------------hashJoin[INNER_JOIN](catalog_sales.cs_sold_date_sk = 
date_dim.d_date_sk)
+--------------------PhysicalProject
+----------------------PhysicalOlapScan[catalog_sales]
+--------------------PhysicalDistribute
 ----------------------PhysicalProject
-------------------------PhysicalOlapScan[catalog_sales]
+------------------------filter((date_dim.d_qoy = 1)(date_dim.d_year = 2001))
+--------------------------PhysicalOlapScan[date_dim]
+----------------PhysicalDistribute
+------------------PhysicalProject
+--------------------hashJoin[INNER_JOIN](customer.c_current_addr_sk = 
customer_address.ca_address_sk)
 ----------------------PhysicalDistribute
 ------------------------PhysicalProject
---------------------------filter((date_dim.d_qoy = 1)(date_dim.d_year = 2001))
-----------------------------PhysicalOlapScan[date_dim]
-------------------PhysicalDistribute
---------------------PhysicalProject
-----------------------hashJoin[INNER_JOIN](customer.c_current_addr_sk = 
customer_address.ca_address_sk)
-------------------------PhysicalDistribute
---------------------------PhysicalProject
-----------------------------PhysicalOlapScan[customer]
-------------------------PhysicalDistribute
---------------------------PhysicalProject
-----------------------------PhysicalOlapScan[customer_address]
+--------------------------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 4b580416f2..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
@@ -1,39 +1,38 @@
 -- This file is automatically generated. You should know what you did if you 
want to edit this
 -- !ds_shape_16 --
-PhysicalResultSink
+PhysicalTopN
 --PhysicalTopN
-----PhysicalTopN
-------PhysicalProject
---------hashAgg[GLOBAL]
-----------PhysicalDistribute
-------------hashAgg[LOCAL]
---------------PhysicalProject
-----------------hashJoin[INNER_JOIN](cs1.cs_ship_date_sk = date_dim.d_date_sk)
-------------------PhysicalDistribute
---------------------PhysicalProject
-----------------------hashJoin[RIGHT_SEMI_JOIN](cs1.cs_order_number = 
cs2.cs_order_number)( not (cs_warehouse_sk = cs_warehouse_sk))
-------------------------PhysicalDistribute
+----PhysicalProject
+------hashAgg[GLOBAL]
+--------PhysicalDistribute
+----------hashAgg[LOCAL]
+------------PhysicalProject
+--------------hashJoin[INNER_JOIN](cs1.cs_call_center_sk = 
call_center.cc_call_center_sk)
+----------------PhysicalProject
+------------------filter(cc_county IN ('Ziebach County', 'Luce County', 
'Richland County', 'Daviess County', 'Barrow County'))
+--------------------PhysicalOlapScan[call_center]
+----------------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]
+----------------------PhysicalDistribute
+------------------------hashJoin[INNER_JOIN](cs1.cs_ship_date_sk = 
date_dim.d_date_sk)
 --------------------------PhysicalProject
-----------------------------PhysicalOlapScan[catalog_sales]
-------------------------hashJoin[INNER_JOIN](cs1.cs_call_center_sk = 
call_center.cc_call_center_sk)
---------------------------hashJoin[RIGHT_ANTI_JOIN](cs1.cs_order_number = 
cr1.cr_order_number)
-----------------------------PhysicalDistribute
-------------------------------PhysicalProject
---------------------------------PhysicalOlapScan[catalog_returns]
-----------------------------PhysicalDistribute
-------------------------------hashJoin[INNER_JOIN](cs1.cs_ship_addr_sk = 
customer_address.ca_address_sk)
+----------------------------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
-----------------------------------PhysicalOlapScan[catalog_sales]
---------------------------------PhysicalDistribute
+----------------------------------PhysicalOlapScan[catalog_returns]
+------------------------------PhysicalDistribute
+--------------------------------hashJoin[INNER_JOIN](cs1.cs_ship_addr_sk = 
customer_address.ca_address_sk)
 ----------------------------------PhysicalProject
-------------------------------------filter((cast(ca_state as VARCHAR(*)) = 
'WV'))
---------------------------------------PhysicalOlapScan[customer_address]
---------------------------PhysicalDistribute
-----------------------------PhysicalProject
-------------------------------filter(cc_county IN ('Ziebach County', 'Luce 
County', 'Richland County', 'Daviess County', 'Barrow County'))
---------------------------------PhysicalOlapScan[call_center]
-------------------PhysicalDistribute
---------------------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]
+------------------------------------PhysicalOlapScan[catalog_sales]
+----------------------------------PhysicalDistribute
+------------------------------------PhysicalProject
+--------------------------------------filter((cast(ca_state as VARCHAR(*)) = 
'WV'))
+----------------------------------------PhysicalOlapScan[customer_address]
 
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 cea4ec9ccc..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
@@ -1,57 +1,89 @@
 -- This file is automatically generated. You should know what you did if you 
want to edit this
 -- !ds_shape_33 --
-PhysicalResultSink
---PhysicalTopN
-----PhysicalDistribute
-------PhysicalTopN
---------hashAgg[GLOBAL]
-----------PhysicalDistribute
-------------hashAgg[LOCAL]
---------------PhysicalUnion
-----------------PhysicalProject
-------------------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)
+PhysicalTopN
+--PhysicalDistribute
+----PhysicalTopN
+------hashAgg[GLOBAL]
+--------PhysicalDistribute
+----------hashAgg[LOCAL]
+------------PhysicalUnion
+--------------PhysicalProject
+----------------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
-------------------------------hashJoin[LEFT_SEMI_JOIN](item.i_manufact_id = 
item.i_manufact_id)
+------------------------------------------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
-----------------------------------PhysicalOlapScan[item]
+----------------------------------filter((item.i_category = 'Home'))
+------------------------------------PhysicalOlapScan[item]
+--------------PhysicalProject
+----------------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
-------------------------------------filter((item.i_category = 'Home'))
---------------------------------------PhysicalOlapScan[item]
-----------------PhysicalProject
-------------------hashAgg[GLOBAL]
---------------------PhysicalDistribute
-----------------------hashAgg[LOCAL]
-------------------------PhysicalProject
---------------------------hashJoin[INNER_JOIN](catalog_sales.cs_item_sk = 
item.i_item_sk)
+------------------------------------hashJoin[INNER_JOIN](catalog_sales.cs_sold_date_sk
 = date_dim.d_date_sk)
+--------------------------------------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
+----------------------------hashJoin[LEFT_SEMI_JOIN](item.i_manufact_id = 
item.i_manufact_id)
+------------------------------PhysicalProject
+--------------------------------PhysicalOlapScan[item]
+------------------------------PhysicalDistribute
+--------------------------------PhysicalProject
+----------------------------------filter((item.i_category = 'Home'))
+------------------------------------PhysicalOlapScan[item]
+--------------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]
 ----------------------------PhysicalDistribute
 ------------------------------PhysicalProject
---------------------------------hashJoin[INNER_JOIN](catalog_sales.cs_bill_addr_sk
 = customer_address.ca_address_sk)
+--------------------------------hashJoin[INNER_JOIN](web_sales.ws_bill_addr_sk 
= customer_address.ca_address_sk)
 ----------------------------------PhysicalDistribute
 ------------------------------------PhysicalProject
---------------------------------------hashJoin[INNER_JOIN](catalog_sales.cs_sold_date_sk
 = date_dim.d_date_sk)
+--------------------------------------hashJoin[INNER_JOIN](web_sales.ws_sold_date_sk
 = date_dim.d_date_sk)
 ----------------------------------------PhysicalProject
-------------------------------------------PhysicalOlapScan[catalog_sales]
+------------------------------------------PhysicalOlapScan[web_sales]
 ----------------------------------------PhysicalDistribute
 ------------------------------------------PhysicalProject
 --------------------------------------------filter((date_dim.d_moy = 
1)(date_dim.d_year = 2002))
@@ -60,41 +92,8 @@ PhysicalResultSink
 ------------------------------------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]
-----------------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
+--------------------------PhysicalDistribute
+----------------------------PhysicalProject
+------------------------------filter((item.i_category = 'Home'))
 --------------------------------PhysicalOlapScan[item]
-------------------------------PhysicalDistribute
---------------------------------PhysicalProject
-----------------------------------hashJoin[INNER_JOIN](web_sales.ws_bill_addr_sk
 = customer_address.ca_address_sk)
-------------------------------------PhysicalDistribute
---------------------------------------PhysicalProject
-----------------------------------------hashJoin[INNER_JOIN](web_sales.ws_sold_date_sk
 = date_dim.d_date_sk)
-------------------------------------------PhysicalProject
---------------------------------------------PhysicalOlapScan[web_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
-------------------------------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 6c1818fbfd..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
@@ -1,31 +1,30 @@
 -- This file is automatically generated. You should know what you did if you 
want to edit this
 -- !ds_shape_40 --
-PhysicalResultSink
---PhysicalTopN
-----PhysicalDistribute
-------PhysicalTopN
---------hashAgg[GLOBAL]
-----------PhysicalDistribute
-------------hashAgg[LOCAL]
---------------PhysicalProject
-----------------hashJoin[INNER_JOIN](catalog_sales.cs_warehouse_sk = 
warehouse.w_warehouse_sk)
-------------------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)
-----------------------PhysicalProject
-------------------------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
-------------------------------filter((item.i_current_price >= 
0.99)(item.i_current_price <= 1.49))
---------------------------------PhysicalOlapScan[item]
+PhysicalTopN
+--PhysicalDistribute
+----PhysicalTopN
+------hashAgg[GLOBAL]
+--------PhysicalDistribute
+----------hashAgg[LOCAL]
+------------PhysicalProject
+--------------hashJoin[INNER_JOIN](catalog_sales.cs_warehouse_sk = 
warehouse.w_warehouse_sk)
+----------------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)
+--------------------PhysicalProject
+----------------------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
-----------------------------filter((date_dim.d_date >= 
2001-03-03)(date_dim.d_date <= 2001-05-02))
-------------------------------PhysicalOlapScan[date_dim]
-------------------PhysicalDistribute
---------------------PhysicalProject
-----------------------PhysicalOlapScan[warehouse]
+----------------------------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 fff91e211e..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
@@ -1,53 +1,52 @@
 -- This file is automatically generated. You should know what you did if you 
want to edit this
 -- !ds_shape_6 --
-PhysicalResultSink
---PhysicalTopN
-----PhysicalDistribute
-------PhysicalTopN
---------filter((cnt >= 10))
-----------hashAgg[GLOBAL]
-------------PhysicalDistribute
---------------hashAgg[LOCAL]
-----------------PhysicalProject
-------------------hashJoin[LEFT_SEMI_JOIN](j.i_category = 
i.i_category)(cast(i_current_price as DECIMALV3(38, 5)) > (1.2 * 
avg(i_current_price)))
---------------------PhysicalProject
-----------------------hashJoin[INNER_JOIN](c.c_customer_sk = s.ss_customer_sk)
-------------------------PhysicalDistribute
---------------------------PhysicalProject
-----------------------------hashJoin[INNER_JOIN](s.ss_item_sk = i.i_item_sk)
-------------------------------PhysicalDistribute
---------------------------------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
+PhysicalTopN
+--PhysicalDistribute
+----PhysicalTopN
+------filter((cnt >= 10))
+--------hashAgg[GLOBAL]
+----------PhysicalDistribute
+------------hashAgg[LOCAL]
+--------------PhysicalProject
+----------------hashJoin[LEFT_SEMI_JOIN](j.i_category = 
i.i_category)(cast(i_current_price as DECIMALV3(38, 5)) > (1.2 * 
avg(i_current_price)))
+------------------PhysicalProject
+--------------------hashJoin[INNER_JOIN](c.c_customer_sk = s.ss_customer_sk)
+----------------------PhysicalDistribute
+------------------------PhysicalProject
+--------------------------hashJoin[INNER_JOIN](s.ss_item_sk = i.i_item_sk)
+----------------------------PhysicalDistribute
+------------------------------hashJoin[INNER_JOIN](s.ss_sold_date_sk = 
d.d_date_sk)
 --------------------------------PhysicalProject
-----------------------------------PhysicalOlapScan[item]
-------------------------PhysicalDistribute
+----------------------------------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]
+----------------------PhysicalDistribute
+------------------------PhysicalProject
+--------------------------hashJoin[INNER_JOIN](a.ca_address_sk = 
c.c_current_addr_sk)
+----------------------------PhysicalDistribute
+------------------------------PhysicalProject
+--------------------------------PhysicalOlapScan[customer]
+----------------------------PhysicalDistribute
+------------------------------PhysicalProject
+--------------------------------PhysicalOlapScan[customer_address]
+------------------PhysicalDistribute
+--------------------hashAgg[GLOBAL]
+----------------------PhysicalDistribute
+------------------------hashAgg[LOCAL]
 --------------------------PhysicalProject
-----------------------------hashJoin[INNER_JOIN](a.ca_address_sk = 
c.c_current_addr_sk)
-------------------------------PhysicalDistribute
---------------------------------PhysicalProject
-----------------------------------PhysicalOlapScan[customer]
-------------------------------PhysicalDistribute
---------------------------------PhysicalProject
-----------------------------------PhysicalOlapScan[customer_address]
---------------------PhysicalDistribute
-----------------------hashAgg[GLOBAL]
-------------------------PhysicalDistribute
---------------------------hashAgg[LOCAL]
-----------------------------PhysicalProject
-------------------------------PhysicalOlapScan[item]
+----------------------------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 ec78b77b89..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
@@ -1,31 +1,30 @@
 -- This file is automatically generated. You should know what you did if you 
want to edit this
 -- !ds_shape_62 --
-PhysicalResultSink
---PhysicalTopN
-----PhysicalDistribute
-------PhysicalTopN
---------hashAgg[GLOBAL]
-----------PhysicalDistribute
-------------hashAgg[LOCAL]
---------------PhysicalProject
-----------------hashJoin[INNER_JOIN](web_sales.ws_warehouse_sk = 
warehouse.w_warehouse_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]
---------------------------PhysicalDistribute
-----------------------------PhysicalProject
-------------------------------filter((date_dim.d_month_seq >= 
1194)(date_dim.d_month_seq <= 1205))
---------------------------------PhysicalOlapScan[date_dim]
+PhysicalTopN
+--PhysicalDistribute
+----PhysicalTopN
+------hashAgg[GLOBAL]
+--------PhysicalDistribute
+----------hashAgg[LOCAL]
+------------PhysicalProject
+--------------hashJoin[INNER_JOIN](web_sales.ws_warehouse_sk = 
warehouse.w_warehouse_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]
 ------------------------PhysicalDistribute
 --------------------------PhysicalProject
-----------------------------PhysicalOlapScan[web_site]
+----------------------------filter((date_dim.d_month_seq >= 
1194)(date_dim.d_month_seq <= 1205))
+------------------------------PhysicalOlapScan[date_dim]
 ----------------------PhysicalDistribute
 ------------------------PhysicalProject
---------------------------PhysicalOlapScan[ship_mode]
-------------------PhysicalDistribute
---------------------PhysicalProject
-----------------------PhysicalOlapScan[warehouse]
+--------------------------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 d83d9cc0f0..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
@@ -1,65 +1,64 @@
 -- This file is automatically generated. You should know what you did if you 
want to edit this
 -- !ds_shape_66 --
-PhysicalResultSink
---PhysicalTopN
-----PhysicalDistribute
-------PhysicalTopN
---------hashAgg[GLOBAL]
-----------PhysicalDistribute
-------------hashAgg[LOCAL]
---------------PhysicalUnion
-----------------PhysicalProject
-------------------hashAgg[GLOBAL]
---------------------PhysicalDistribute
-----------------------hashAgg[LOCAL]
-------------------------PhysicalProject
---------------------------hashJoin[INNER_JOIN](web_sales.ws_warehouse_sk = 
warehouse.w_warehouse_sk)
-----------------------------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
---------------------------------------PhysicalOlapScan[web_sales]
-------------------------------------PhysicalDistribute
---------------------------------------PhysicalProject
-----------------------------------------filter(sm_carrier IN ('GREAT EASTERN', 
'LATVIAN'))
-------------------------------------------PhysicalOlapScan[ship_mode]
+PhysicalTopN
+--PhysicalDistribute
+----PhysicalTopN
+------hashAgg[GLOBAL]
+--------PhysicalDistribute
+----------hashAgg[LOCAL]
+------------PhysicalUnion
+--------------PhysicalProject
+----------------hashAgg[GLOBAL]
+------------------PhysicalDistribute
+--------------------hashAgg[LOCAL]
+----------------------PhysicalProject
+------------------------hashJoin[INNER_JOIN](web_sales.ws_warehouse_sk = 
warehouse.w_warehouse_sk)
+--------------------------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
+------------------------------------PhysicalOlapScan[web_sales]
 ----------------------------------PhysicalDistribute
 ------------------------------------PhysicalProject
---------------------------------------filter((date_dim.d_year = 1998))
-----------------------------------------PhysicalOlapScan[date_dim]
+--------------------------------------filter(sm_carrier IN ('GREAT EASTERN', 
'LATVIAN'))
+----------------------------------------PhysicalOlapScan[ship_mode]
 --------------------------------PhysicalDistribute
 ----------------------------------PhysicalProject
-------------------------------------filter((cast(t_time as BIGINT) <= 
77621)(cast(t_time as BIGINT) >= 48821))
---------------------------------------PhysicalOlapScan[time_dim]
-----------------------------PhysicalDistribute
-------------------------------PhysicalProject
---------------------------------PhysicalOlapScan[warehouse]
-----------------PhysicalProject
-------------------hashAgg[GLOBAL]
---------------------PhysicalDistribute
-----------------------hashAgg[LOCAL]
-------------------------PhysicalProject
---------------------------hashJoin[INNER_JOIN](catalog_sales.cs_warehouse_sk = 
warehouse.w_warehouse_sk)
+------------------------------------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
-------------------------------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
---------------------------------------PhysicalOlapScan[catalog_sales]
-------------------------------------PhysicalDistribute
---------------------------------------PhysicalProject
-----------------------------------------filter(sm_carrier IN ('GREAT EASTERN', 
'LATVIAN'))
-------------------------------------------PhysicalOlapScan[ship_mode]
+------------------------------PhysicalOlapScan[warehouse]
+--------------PhysicalProject
+----------------hashAgg[GLOBAL]
+------------------PhysicalDistribute
+--------------------hashAgg[LOCAL]
+----------------------PhysicalProject
+------------------------hashJoin[INNER_JOIN](catalog_sales.cs_warehouse_sk = 
warehouse.w_warehouse_sk)
+--------------------------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
+------------------------------------PhysicalOlapScan[catalog_sales]
 ----------------------------------PhysicalDistribute
 ------------------------------------PhysicalProject
---------------------------------------filter((date_dim.d_year = 1998))
-----------------------------------------PhysicalOlapScan[date_dim]
+--------------------------------------filter(sm_carrier IN ('GREAT EASTERN', 
'LATVIAN'))
+----------------------------------------PhysicalOlapScan[ship_mode]
 --------------------------------PhysicalDistribute
 ----------------------------------PhysicalProject
-------------------------------------filter((cast(t_time as BIGINT) <= 
77621)(cast(t_time as BIGINT) >= 48821))
---------------------------------------PhysicalOlapScan[time_dim]
-----------------------------PhysicalDistribute
-------------------------------PhysicalProject
---------------------------------PhysicalOlapScan[warehouse]
+------------------------------------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
+------------------------------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 9a98918d91..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
@@ -1,44 +1,43 @@
 -- This file is automatically generated. You should know what you did if you 
want to edit this
 -- !ds_shape_68 --
-PhysicalResultSink
---PhysicalTopN
-----PhysicalDistribute
-------PhysicalTopN
---------PhysicalProject
-----------hashJoin[INNER_JOIN](customer.c_current_addr_sk = 
current_addr.ca_address_sk)( not (ca_city = bought_city))
+PhysicalTopN
+--PhysicalDistribute
+----PhysicalTopN
+------PhysicalProject
+--------hashJoin[INNER_JOIN](customer.c_current_addr_sk = 
current_addr.ca_address_sk)( not (ca_city = bought_city))
+----------PhysicalProject
+------------PhysicalOlapScan[customer_address]
+----------PhysicalDistribute
 ------------PhysicalProject
---------------PhysicalOlapScan[customer_address]
-------------PhysicalDistribute
---------------PhysicalProject
-----------------hashJoin[INNER_JOIN](dn.ss_customer_sk = 
customer.c_customer_sk)
-------------------PhysicalDistribute
---------------------PhysicalProject
-----------------------PhysicalOlapScan[customer]
-------------------PhysicalDistribute
---------------------PhysicalProject
-----------------------hashAgg[LOCAL]
-------------------------PhysicalProject
---------------------------hashJoin[INNER_JOIN](store_sales.ss_addr_sk = 
customer_address.ca_address_sk)
+--------------hashJoin[INNER_JOIN](dn.ss_customer_sk = customer.c_customer_sk)
+----------------PhysicalDistribute
+------------------PhysicalProject
+--------------------PhysicalOlapScan[customer]
+----------------PhysicalDistribute
+------------------PhysicalProject
+--------------------hashAgg[LOCAL]
+----------------------PhysicalProject
+------------------------hashJoin[INNER_JOIN](store_sales.ss_addr_sk = 
customer_address.ca_address_sk)
+--------------------------PhysicalProject
+----------------------------PhysicalOlapScan[customer_address]
+--------------------------PhysicalDistribute
 ----------------------------PhysicalProject
-------------------------------PhysicalOlapScan[customer_address]
-----------------------------PhysicalDistribute
-------------------------------PhysicalProject
---------------------------------hashJoin[INNER_JOIN](store_sales.ss_hdemo_sk = 
household_demographics.hd_demo_sk)
-----------------------------------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]
+------------------------------hashJoin[INNER_JOIN](store_sales.ss_hdemo_sk = 
household_demographics.hd_demo_sk)
+--------------------------------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(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)))
-----------------------------------------PhysicalOlapScan[household_demographics]
+------------------------------------------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]
+--------------------------------PhysicalDistribute
+----------------------------------PhysicalProject
+------------------------------------filter(((household_demographics.hd_dep_count
 = 8) OR (household_demographics.hd_vehicle_count = -1)))
+--------------------------------------PhysicalOlapScan[household_demographics]
 
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 4f20f7bf82..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
@@ -1,31 +1,30 @@
 -- This file is automatically generated. You should know what you did if you 
want to edit this
 -- !ds_shape_99 --
-PhysicalResultSink
---PhysicalTopN
-----PhysicalDistribute
-------PhysicalTopN
---------hashAgg[GLOBAL]
-----------PhysicalDistribute
-------------hashAgg[LOCAL]
---------------PhysicalProject
-----------------hashJoin[INNER_JOIN](catalog_sales.cs_warehouse_sk = 
warehouse.w_warehouse_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]
---------------------------PhysicalDistribute
-----------------------------PhysicalProject
-------------------------------filter((date_dim.d_month_seq >= 
1224)(date_dim.d_month_seq <= 1235))
---------------------------------PhysicalOlapScan[date_dim]
+PhysicalTopN
+--PhysicalDistribute
+----PhysicalTopN
+------hashAgg[GLOBAL]
+--------PhysicalDistribute
+----------hashAgg[LOCAL]
+------------PhysicalProject
+--------------hashJoin[INNER_JOIN](catalog_sales.cs_warehouse_sk = 
warehouse.w_warehouse_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]
 ------------------------PhysicalDistribute
 --------------------------PhysicalProject
-----------------------------PhysicalOlapScan[call_center]
+----------------------------filter((date_dim.d_month_seq >= 
1224)(date_dim.d_month_seq <= 1235))
+------------------------------PhysicalOlapScan[date_dim]
 ----------------------PhysicalDistribute
 ------------------------PhysicalProject
---------------------------PhysicalOlapScan[ship_mode]
-------------------PhysicalDistribute
---------------------PhysicalProject
-----------------------PhysicalOlapScan[warehouse]
+--------------------------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 2f4348619b..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
@@ -1,34 +1,33 @@
 -- This file is automatically generated. You should know what you did if you 
want to edit this
 -- !select --
-PhysicalResultSink
---PhysicalTopN
-----PhysicalDistribute
-------PhysicalTopN
---------hashAgg[GLOBAL]
-----------PhysicalDistribute
-------------hashAgg[LOCAL]
---------------PhysicalProject
-----------------hashJoin[INNER_JOIN](orders.o_orderkey = l1.l_orderkey)
+PhysicalTopN
+--PhysicalDistribute
+----PhysicalTopN
+------hashAgg[GLOBAL]
+--------PhysicalDistribute
+----------hashAgg[LOCAL]
+------------PhysicalProject
+--------------hashJoin[INNER_JOIN](orders.o_orderkey = l1.l_orderkey)
+----------------PhysicalProject
+------------------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]
-------------------hashJoin[RIGHT_SEMI_JOIN](l2.l_orderkey = l1.l_orderkey)( 
not (l_suppkey = l_suppkey))
+--------------------PhysicalOlapScan[lineitem]
+------------------hashJoin[RIGHT_ANTI_JOIN](l3.l_orderkey = l1.l_orderkey)( 
not (l_suppkey = l_suppkey))
 --------------------PhysicalProject
-----------------------PhysicalOlapScan[lineitem]
---------------------hashJoin[RIGHT_ANTI_JOIN](l3.l_orderkey = l1.l_orderkey)( 
not (l_suppkey = l_suppkey))
+----------------------filter((l3.l_receiptdate > l3.l_commitdate))
+------------------------PhysicalOlapScan[lineitem]
+--------------------hashJoin[INNER_JOIN](supplier.s_suppkey = l1.l_suppkey)
 ----------------------PhysicalProject
-------------------------filter((l3.l_receiptdate > l3.l_commitdate))
+------------------------filter((l1.l_receiptdate > l1.l_commitdate))
 --------------------------PhysicalOlapScan[lineitem]
-----------------------hashJoin[INNER_JOIN](supplier.s_suppkey = l1.l_suppkey)
-------------------------PhysicalProject
---------------------------filter((l1.l_receiptdate > l1.l_commitdate))
-----------------------------PhysicalOlapScan[lineitem]
-------------------------PhysicalDistribute
---------------------------hashJoin[INNER_JOIN](supplier.s_nationkey = 
nation.n_nationkey)
+----------------------PhysicalDistribute
+------------------------hashJoin[INNER_JOIN](supplier.s_nationkey = 
nation.n_nationkey)
+--------------------------PhysicalProject
+----------------------------PhysicalOlapScan[supplier]
+--------------------------PhysicalDistribute
 ----------------------------PhysicalProject
-------------------------------PhysicalOlapScan[supplier]
-----------------------------PhysicalDistribute
-------------------------------PhysicalProject
---------------------------------filter((nation.n_name = 'SAUDI ARABIA'))
-----------------------------------PhysicalOlapScan[nation]
+------------------------------filter((nation.n_name = 'SAUDI ARABIA'))
+--------------------------------PhysicalOlapScan[nation]
 
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 2f4348619b..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
@@ -1,34 +1,33 @@
 -- This file is automatically generated. You should know what you did if you 
want to edit this
 -- !select --
-PhysicalResultSink
---PhysicalTopN
-----PhysicalDistribute
-------PhysicalTopN
---------hashAgg[GLOBAL]
-----------PhysicalDistribute
-------------hashAgg[LOCAL]
---------------PhysicalProject
-----------------hashJoin[INNER_JOIN](orders.o_orderkey = l1.l_orderkey)
+PhysicalTopN
+--PhysicalDistribute
+----PhysicalTopN
+------hashAgg[GLOBAL]
+--------PhysicalDistribute
+----------hashAgg[LOCAL]
+------------PhysicalProject
+--------------hashJoin[INNER_JOIN](orders.o_orderkey = l1.l_orderkey)
+----------------PhysicalProject
+------------------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]
-------------------hashJoin[RIGHT_SEMI_JOIN](l2.l_orderkey = l1.l_orderkey)( 
not (l_suppkey = l_suppkey))
+--------------------PhysicalOlapScan[lineitem]
+------------------hashJoin[RIGHT_ANTI_JOIN](l3.l_orderkey = l1.l_orderkey)( 
not (l_suppkey = l_suppkey))
 --------------------PhysicalProject
-----------------------PhysicalOlapScan[lineitem]
---------------------hashJoin[RIGHT_ANTI_JOIN](l3.l_orderkey = l1.l_orderkey)( 
not (l_suppkey = l_suppkey))
+----------------------filter((l3.l_receiptdate > l3.l_commitdate))
+------------------------PhysicalOlapScan[lineitem]
+--------------------hashJoin[INNER_JOIN](supplier.s_suppkey = l1.l_suppkey)
 ----------------------PhysicalProject
-------------------------filter((l3.l_receiptdate > l3.l_commitdate))
+------------------------filter((l1.l_receiptdate > l1.l_commitdate))
 --------------------------PhysicalOlapScan[lineitem]
-----------------------hashJoin[INNER_JOIN](supplier.s_suppkey = l1.l_suppkey)
-------------------------PhysicalProject
---------------------------filter((l1.l_receiptdate > l1.l_commitdate))
-----------------------------PhysicalOlapScan[lineitem]
-------------------------PhysicalDistribute
---------------------------hashJoin[INNER_JOIN](supplier.s_nationkey = 
nation.n_nationkey)
+----------------------PhysicalDistribute
+------------------------hashJoin[INNER_JOIN](supplier.s_nationkey = 
nation.n_nationkey)
+--------------------------PhysicalProject
+----------------------------PhysicalOlapScan[supplier]
+--------------------------PhysicalDistribute
 ----------------------------PhysicalProject
-------------------------------PhysicalOlapScan[supplier]
-----------------------------PhysicalDistribute
-------------------------------PhysicalProject
---------------------------------filter((nation.n_name = 'SAUDI ARABIA'))
-----------------------------------PhysicalOlapScan[nation]
+------------------------------filter((nation.n_name = 'SAUDI ARABIA'))
+--------------------------------PhysicalOlapScan[nation]
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to