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

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


The following commit(s) were added to refs/heads/branch-2.1 by this push:
     new 649cefd70fb [opt](Nereids) forbid distribute under project and filter 
(#39812) (#41622)
649cefd70fb is described below

commit 649cefd70fb3d64726a2114526d67042c6099c6d
Author: morrySnow <101034200+morrys...@users.noreply.github.com>
AuthorDate: Wed Oct 9 23:02:06 2024 +0800

    [opt](Nereids) forbid distribute under project and filter (#39812) (#41622)
    
    pick from master #39812
---
 .../doris/nereids/properties/ChildrenPropertiesRegulator.java       | 6 ++++++
 regression-test/data/nereids_hint_tpcds_p0/shape/query47.out        | 4 ++--
 regression-test/data/nereids_hint_tpcds_p0/shape/query57.out        | 4 ++--
 regression-test/data/nereids_hint_tpcds_p0/shape/query89.out        | 4 ++--
 .../data/nereids_tpcds_shape_sf1000_p0/shape/query17.out            | 4 ++--
 .../data/nereids_tpcds_shape_sf1000_p0/shape/query25.out            | 4 ++--
 .../data/nereids_tpcds_shape_sf1000_p0/shape/query47.out            | 4 ++--
 .../data/nereids_tpcds_shape_sf1000_p0/shape/query57.out            | 4 ++--
 .../data/nereids_tpcds_shape_sf1000_p0/shape/query89.out            | 4 ++--
 .../data/nereids_tpcds_shape_sf100_p0/rf_prune/query17.out          | 4 ++--
 .../data/nereids_tpcds_shape_sf100_p0/rf_prune/query25.out          | 4 ++--
 .../data/nereids_tpcds_shape_sf100_p0/rf_prune/query57.out          | 4 ++--
 regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query17.out | 4 ++--
 regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query25.out | 4 ++--
 regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query57.out | 4 ++--
 15 files changed, 34 insertions(+), 28 deletions(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/properties/ChildrenPropertiesRegulator.java
 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/properties/ChildrenPropertiesRegulator.java
index 5ba1bd87b05..f4327d86b21 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/properties/ChildrenPropertiesRegulator.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/properties/ChildrenPropertiesRegulator.java
@@ -200,6 +200,9 @@ public class ChildrenPropertiesRegulator extends 
PlanVisitor<Boolean, Void> {
     @Override
     public Boolean visitPhysicalFilter(PhysicalFilter<? extends Plan> filter, 
Void context) {
         // do not process must shuffle
+        if (children.get(0).getPlan() instanceof PhysicalDistribute) {
+            return false;
+        }
         return true;
     }
 
@@ -452,6 +455,9 @@ public class ChildrenPropertiesRegulator extends 
PlanVisitor<Boolean, Void> {
     @Override
     public Boolean visitPhysicalProject(PhysicalProject<? extends Plan> 
project, Void context) {
         // do not process must shuffle
+        if (children.get(0).getPlan() instanceof PhysicalDistribute) {
+            return false;
+        }
         return true;
     }
 
diff --git a/regression-test/data/nereids_hint_tpcds_p0/shape/query47.out 
b/regression-test/data/nereids_hint_tpcds_p0/shape/query47.out
index f4d283180f8..d5326c7fd44 100644
--- a/regression-test/data/nereids_hint_tpcds_p0/shape/query47.out
+++ b/regression-test/data/nereids_hint_tpcds_p0/shape/query47.out
@@ -7,8 +7,8 @@ PhysicalCteAnchor ( cteId=CTEId#0 )
 --------PhysicalQuickSort[LOCAL_SORT]
 ----------PhysicalWindow
 ------------PhysicalQuickSort[LOCAL_SORT]
---------------PhysicalProject
-----------------PhysicalDistribute[DistributionSpecHash]
+--------------PhysicalDistribute[DistributionSpecHash]
+----------------PhysicalProject
 ------------------hashAgg[GLOBAL]
 --------------------PhysicalDistribute[DistributionSpecHash]
 ----------------------hashAgg[LOCAL]
diff --git a/regression-test/data/nereids_hint_tpcds_p0/shape/query57.out 
b/regression-test/data/nereids_hint_tpcds_p0/shape/query57.out
index 9e024c84cc0..25ea75ec045 100644
--- a/regression-test/data/nereids_hint_tpcds_p0/shape/query57.out
+++ b/regression-test/data/nereids_hint_tpcds_p0/shape/query57.out
@@ -7,8 +7,8 @@ PhysicalCteAnchor ( cteId=CTEId#0 )
 --------PhysicalQuickSort[LOCAL_SORT]
 ----------PhysicalWindow
 ------------PhysicalQuickSort[LOCAL_SORT]
---------------PhysicalProject
-----------------PhysicalDistribute[DistributionSpecHash]
+--------------PhysicalDistribute[DistributionSpecHash]
+----------------PhysicalProject
 ------------------hashAgg[GLOBAL]
 --------------------PhysicalDistribute[DistributionSpecHash]
 ----------------------hashAgg[LOCAL]
diff --git a/regression-test/data/nereids_hint_tpcds_p0/shape/query89.out 
b/regression-test/data/nereids_hint_tpcds_p0/shape/query89.out
index 8abe6e598dc..032d3b486f3 100644
--- a/regression-test/data/nereids_hint_tpcds_p0/shape/query89.out
+++ b/regression-test/data/nereids_hint_tpcds_p0/shape/query89.out
@@ -9,8 +9,8 @@ PhysicalResultSink
 ------------filter((if(( not (avg_monthly_sales = 0.0000)), 
(cast(abs((sum_sales - cast(avg_monthly_sales as DECIMALV3(38, 2)))) as 
DECIMALV3(38, 10)) / avg_monthly_sales), NULL) > 0.100000))
 --------------PhysicalWindow
 ----------------PhysicalQuickSort[LOCAL_SORT]
-------------------PhysicalProject
---------------------PhysicalDistribute[DistributionSpecHash]
+------------------PhysicalDistribute[DistributionSpecHash]
+--------------------PhysicalProject
 ----------------------hashAgg[GLOBAL]
 ------------------------PhysicalDistribute[DistributionSpecHash]
 --------------------------hashAgg[LOCAL]
diff --git 
a/regression-test/data/nereids_tpcds_shape_sf1000_p0/shape/query17.out 
b/regression-test/data/nereids_tpcds_shape_sf1000_p0/shape/query17.out
index 0eb85c6c635..4e5a0748375 100644
--- a/regression-test/data/nereids_tpcds_shape_sf1000_p0/shape/query17.out
+++ b/regression-test/data/nereids_tpcds_shape_sf1000_p0/shape/query17.out
@@ -19,8 +19,8 @@ PhysicalResultSink
 ----------------------------PhysicalProject
 ------------------------------filter(d_quarter_name IN ('2001Q1', '2001Q2', 
'2001Q3'))
 --------------------------------PhysicalOlapScan[date_dim]
---------------------PhysicalProject
-----------------------PhysicalDistribute[DistributionSpecHash]
+--------------------PhysicalDistribute[DistributionSpecHash]
+----------------------PhysicalProject
 ------------------------hashJoin[INNER_JOIN] hashCondition=((store.s_store_sk 
= store_sales.ss_store_sk)) otherCondition=() build RFs:RF6 
s_store_sk->[ss_store_sk]
 --------------------------hashJoin[INNER_JOIN] hashCondition=((item.i_item_sk 
= store_sales.ss_item_sk)) otherCondition=() build RFs:RF5 
i_item_sk->[sr_item_sk,ss_item_sk]
 ----------------------------PhysicalDistribute[DistributionSpecHash]
diff --git 
a/regression-test/data/nereids_tpcds_shape_sf1000_p0/shape/query25.out 
b/regression-test/data/nereids_tpcds_shape_sf1000_p0/shape/query25.out
index af25bb29281..a49fcbc4782 100644
--- a/regression-test/data/nereids_tpcds_shape_sf1000_p0/shape/query25.out
+++ b/regression-test/data/nereids_tpcds_shape_sf1000_p0/shape/query25.out
@@ -18,8 +18,8 @@ PhysicalResultSink
 --------------------------PhysicalProject
 ----------------------------filter((d3.d_moy <= 10) and (d3.d_moy >= 4) and 
(d3.d_year = 1999))
 ------------------------------PhysicalOlapScan[date_dim]
-------------------PhysicalProject
---------------------PhysicalDistribute[DistributionSpecHash]
+------------------PhysicalDistribute[DistributionSpecHash]
+--------------------PhysicalProject
 ----------------------hashJoin[INNER_JOIN] hashCondition=((store.s_store_sk = 
store_sales.ss_store_sk)) otherCondition=() build RFs:RF6 
s_store_sk->[ss_store_sk]
 ------------------------hashJoin[INNER_JOIN] hashCondition=((item.i_item_sk = 
store_sales.ss_item_sk)) otherCondition=() build RFs:RF5 
i_item_sk->[sr_item_sk,ss_item_sk]
 --------------------------PhysicalDistribute[DistributionSpecHash]
diff --git 
a/regression-test/data/nereids_tpcds_shape_sf1000_p0/shape/query47.out 
b/regression-test/data/nereids_tpcds_shape_sf1000_p0/shape/query47.out
index 52024fdbe7a..612c3374336 100644
--- a/regression-test/data/nereids_tpcds_shape_sf1000_p0/shape/query47.out
+++ b/regression-test/data/nereids_tpcds_shape_sf1000_p0/shape/query47.out
@@ -7,8 +7,8 @@ PhysicalCteAnchor ( cteId=CTEId#0 )
 --------PhysicalQuickSort[LOCAL_SORT]
 ----------PhysicalWindow
 ------------PhysicalQuickSort[LOCAL_SORT]
---------------PhysicalProject
-----------------PhysicalDistribute[DistributionSpecHash]
+--------------PhysicalDistribute[DistributionSpecHash]
+----------------PhysicalProject
 ------------------hashAgg[GLOBAL]
 --------------------PhysicalDistribute[DistributionSpecHash]
 ----------------------hashAgg[LOCAL]
diff --git 
a/regression-test/data/nereids_tpcds_shape_sf1000_p0/shape/query57.out 
b/regression-test/data/nereids_tpcds_shape_sf1000_p0/shape/query57.out
index d6681a21e47..0a7e5a71aaf 100644
--- a/regression-test/data/nereids_tpcds_shape_sf1000_p0/shape/query57.out
+++ b/regression-test/data/nereids_tpcds_shape_sf1000_p0/shape/query57.out
@@ -7,8 +7,8 @@ PhysicalCteAnchor ( cteId=CTEId#0 )
 --------PhysicalQuickSort[LOCAL_SORT]
 ----------PhysicalWindow
 ------------PhysicalQuickSort[LOCAL_SORT]
---------------PhysicalProject
-----------------PhysicalDistribute[DistributionSpecHash]
+--------------PhysicalDistribute[DistributionSpecHash]
+----------------PhysicalProject
 ------------------hashAgg[GLOBAL]
 --------------------PhysicalDistribute[DistributionSpecHash]
 ----------------------hashAgg[LOCAL]
diff --git 
a/regression-test/data/nereids_tpcds_shape_sf1000_p0/shape/query89.out 
b/regression-test/data/nereids_tpcds_shape_sf1000_p0/shape/query89.out
index f1160eea692..e957d489c49 100644
--- a/regression-test/data/nereids_tpcds_shape_sf1000_p0/shape/query89.out
+++ b/regression-test/data/nereids_tpcds_shape_sf1000_p0/shape/query89.out
@@ -9,8 +9,8 @@ PhysicalResultSink
 ------------filter((if(( not (avg_monthly_sales = 0.0000)), 
(cast(abs((sum_sales - cast(avg_monthly_sales as DECIMALV3(38, 2)))) as 
DECIMALV3(38, 10)) / avg_monthly_sales), NULL) > 0.100000))
 --------------PhysicalWindow
 ----------------PhysicalQuickSort[LOCAL_SORT]
-------------------PhysicalProject
---------------------PhysicalDistribute[DistributionSpecHash]
+------------------PhysicalDistribute[DistributionSpecHash]
+--------------------PhysicalProject
 ----------------------hashAgg[GLOBAL]
 ------------------------PhysicalDistribute[DistributionSpecHash]
 --------------------------hashAgg[LOCAL]
diff --git 
a/regression-test/data/nereids_tpcds_shape_sf100_p0/rf_prune/query17.out 
b/regression-test/data/nereids_tpcds_shape_sf100_p0/rf_prune/query17.out
index 48bfd45c964..8e854da6176 100644
--- a/regression-test/data/nereids_tpcds_shape_sf100_p0/rf_prune/query17.out
+++ b/regression-test/data/nereids_tpcds_shape_sf100_p0/rf_prune/query17.out
@@ -19,8 +19,8 @@ PhysicalResultSink
 ----------------------------PhysicalProject
 ------------------------------filter(d_quarter_name IN ('2001Q1', '2001Q2', 
'2001Q3'))
 --------------------------------PhysicalOlapScan[date_dim]
---------------------PhysicalProject
-----------------------PhysicalDistribute[DistributionSpecHash]
+--------------------PhysicalDistribute[DistributionSpecHash]
+----------------------PhysicalProject
 ------------------------hashJoin[INNER_JOIN] hashCondition=((store.s_store_sk 
= store_sales.ss_store_sk)) otherCondition=()
 --------------------------hashJoin[INNER_JOIN] hashCondition=((item.i_item_sk 
= store_sales.ss_item_sk)) otherCondition=()
 ----------------------------PhysicalDistribute[DistributionSpecHash]
diff --git 
a/regression-test/data/nereids_tpcds_shape_sf100_p0/rf_prune/query25.out 
b/regression-test/data/nereids_tpcds_shape_sf100_p0/rf_prune/query25.out
index 05a891bcf70..e28adb3d4ab 100644
--- a/regression-test/data/nereids_tpcds_shape_sf100_p0/rf_prune/query25.out
+++ b/regression-test/data/nereids_tpcds_shape_sf100_p0/rf_prune/query25.out
@@ -18,8 +18,8 @@ PhysicalResultSink
 --------------------------PhysicalProject
 ----------------------------filter((d3.d_moy <= 10) and (d3.d_moy >= 4) and 
(d3.d_year = 2000))
 ------------------------------PhysicalOlapScan[date_dim]
-------------------PhysicalProject
---------------------PhysicalDistribute[DistributionSpecHash]
+------------------PhysicalDistribute[DistributionSpecHash]
+--------------------PhysicalProject
 ----------------------hashJoin[INNER_JOIN] hashCondition=((store.s_store_sk = 
store_sales.ss_store_sk)) otherCondition=()
 ------------------------hashJoin[INNER_JOIN] hashCondition=((item.i_item_sk = 
store_sales.ss_item_sk)) otherCondition=()
 --------------------------PhysicalDistribute[DistributionSpecHash]
diff --git 
a/regression-test/data/nereids_tpcds_shape_sf100_p0/rf_prune/query57.out 
b/regression-test/data/nereids_tpcds_shape_sf100_p0/rf_prune/query57.out
index 4e7004e396e..a528ee47907 100644
--- a/regression-test/data/nereids_tpcds_shape_sf100_p0/rf_prune/query57.out
+++ b/regression-test/data/nereids_tpcds_shape_sf100_p0/rf_prune/query57.out
@@ -7,8 +7,8 @@ PhysicalCteAnchor ( cteId=CTEId#0 )
 --------PhysicalQuickSort[LOCAL_SORT]
 ----------PhysicalWindow
 ------------PhysicalQuickSort[LOCAL_SORT]
---------------PhysicalProject
-----------------PhysicalDistribute[DistributionSpecHash]
+--------------PhysicalDistribute[DistributionSpecHash]
+----------------PhysicalProject
 ------------------hashAgg[GLOBAL]
 --------------------PhysicalDistribute[DistributionSpecHash]
 ----------------------hashAgg[LOCAL]
diff --git 
a/regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query17.out 
b/regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query17.out
index 0eb85c6c635..4e5a0748375 100644
--- a/regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query17.out
+++ b/regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query17.out
@@ -19,8 +19,8 @@ PhysicalResultSink
 ----------------------------PhysicalProject
 ------------------------------filter(d_quarter_name IN ('2001Q1', '2001Q2', 
'2001Q3'))
 --------------------------------PhysicalOlapScan[date_dim]
---------------------PhysicalProject
-----------------------PhysicalDistribute[DistributionSpecHash]
+--------------------PhysicalDistribute[DistributionSpecHash]
+----------------------PhysicalProject
 ------------------------hashJoin[INNER_JOIN] hashCondition=((store.s_store_sk 
= store_sales.ss_store_sk)) otherCondition=() build RFs:RF6 
s_store_sk->[ss_store_sk]
 --------------------------hashJoin[INNER_JOIN] hashCondition=((item.i_item_sk 
= store_sales.ss_item_sk)) otherCondition=() build RFs:RF5 
i_item_sk->[sr_item_sk,ss_item_sk]
 ----------------------------PhysicalDistribute[DistributionSpecHash]
diff --git 
a/regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query25.out 
b/regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query25.out
index afe0eccb284..9bafd839ba0 100644
--- a/regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query25.out
+++ b/regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query25.out
@@ -18,8 +18,8 @@ PhysicalResultSink
 --------------------------PhysicalProject
 ----------------------------filter((d3.d_moy <= 10) and (d3.d_moy >= 4) and 
(d3.d_year = 2000))
 ------------------------------PhysicalOlapScan[date_dim]
-------------------PhysicalProject
---------------------PhysicalDistribute[DistributionSpecHash]
+------------------PhysicalDistribute[DistributionSpecHash]
+--------------------PhysicalProject
 ----------------------hashJoin[INNER_JOIN] hashCondition=((store.s_store_sk = 
store_sales.ss_store_sk)) otherCondition=() build RFs:RF6 
s_store_sk->[ss_store_sk]
 ------------------------hashJoin[INNER_JOIN] hashCondition=((item.i_item_sk = 
store_sales.ss_item_sk)) otherCondition=() build RFs:RF5 
i_item_sk->[sr_item_sk,ss_item_sk]
 --------------------------PhysicalDistribute[DistributionSpecHash]
diff --git 
a/regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query57.out 
b/regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query57.out
index 57c81103cfc..f8f227d110b 100644
--- a/regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query57.out
+++ b/regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query57.out
@@ -7,8 +7,8 @@ PhysicalCteAnchor ( cteId=CTEId#0 )
 --------PhysicalQuickSort[LOCAL_SORT]
 ----------PhysicalWindow
 ------------PhysicalQuickSort[LOCAL_SORT]
---------------PhysicalProject
-----------------PhysicalDistribute[DistributionSpecHash]
+--------------PhysicalDistribute[DistributionSpecHash]
+----------------PhysicalProject
 ------------------hashAgg[GLOBAL]
 --------------------PhysicalDistribute[DistributionSpecHash]
 ----------------------hashAgg[LOCAL]


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

Reply via email to