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 5ba1bd87b0..f4327d86b2 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 { @Override public Boolean visitPhysicalFilter(PhysicalFilter 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 { @Override public Boolean visitPhysicalProject(PhysicalProject 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 f4d283180f..d5326c7fd4 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 9e024c84cc..25ea75ec04 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 8abe6e598d..032d3b486f 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 0eb85c6c63..4e5a074837 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 af25bb2928..a49fcbc478 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 52024fdbe7..612c337433 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 d6681a21e4..0a7e5a71aa 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 f1160eea69..e957d489c4 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 48bfd45c96..8e854da617 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 05a891bcf7..e28adb3d4a 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 4e7004e396..a528ee4790 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 0eb85c6c63..4e5a074837 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 afe0eccb28..9bafd839ba 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 57c81103cf..f8f227d110 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]