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

morningman pushed a commit to branch tpcds
in repository https://gitbox.apache.org/repos/asf/doris.git

commit d39a5e03e59fca99ef2f3d9c6f946b8cf860ee06
Author: jakevin <jakevin...@gmail.com>
AuthorDate: Thu Jan 18 17:18:41 2024 +0800

    [fix](Nereids): fix AssertNumRows StatsCalculator (#30053)
---
 .../doris/nereids/stats/StatsCalculator.java       | 44 +++++++++++---
 .../shape/query54.out                              | 59 +++++++++++++++++-
 .../nereids_tpcds_shape_sf1000_p0/shape/query6.out | 68 ++++++++++-----------
 .../noStatsRfPrune/query58.out                     | 21 +++----
 .../no_stats_shape/query58.out                     | 21 +++----
 .../rf_prune/query54.out                           | 71 ++++++++++++++++++++--
 .../rf_prune/query6.out                            |  7 +--
 .../nereids_tpcds_shape_sf100_p0/shape/query54.out | 71 ++++++++++++++++++++--
 .../nereids_tpcds_shape_sf100_p0/shape/query6.out  |  9 ++-
 9 files changed, 284 insertions(+), 87 deletions(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/stats/StatsCalculator.java 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/stats/StatsCalculator.java
index 14ead9990aa..76587bcffb5 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/stats/StatsCalculator.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/stats/StatsCalculator.java
@@ -26,6 +26,7 @@ import org.apache.doris.nereids.CascadesContext;
 import org.apache.doris.nereids.memo.Group;
 import org.apache.doris.nereids.memo.GroupExpression;
 import org.apache.doris.nereids.trees.expressions.Alias;
+import org.apache.doris.nereids.trees.expressions.AssertNumRowsElement;
 import org.apache.doris.nereids.trees.expressions.CTEId;
 import org.apache.doris.nereids.trees.expressions.Expression;
 import org.apache.doris.nereids.trees.expressions.NamedExpression;
@@ -167,7 +168,7 @@ public class StatsCalculator extends 
DefaultPlanVisitor<Statistics, Void> {
     private CascadesContext cascadesContext;
 
     private StatsCalculator(GroupExpression groupExpression, boolean 
forbidUnknownColStats,
-                                Map<String, ColumnStatistic> 
columnStatisticMap, boolean isPlayNereidsDump,
+            Map<String, ColumnStatistic> columnStatisticMap, boolean 
isPlayNereidsDump,
             Map<CTEId, Statistics> cteIdToStats, CascadesContext context) {
         this.groupExpression = groupExpression;
         this.forbidUnknownColStats = forbidUnknownColStats;
@@ -193,7 +194,7 @@ public class StatsCalculator extends 
DefaultPlanVisitor<Statistics, Void> {
      * estimate stats
      */
     public static StatsCalculator estimate(GroupExpression groupExpression, 
boolean forbidUnknownColStats,
-                                           Map<String, ColumnStatistic> 
columnStatisticMap, boolean isPlayNereidsDump,
+            Map<String, ColumnStatistic> columnStatisticMap, boolean 
isPlayNereidsDump,
             Map<CTEId, Statistics> cteIdToStats, CascadesContext context) {
         StatsCalculator statsCalculator = new StatsCalculator(
                 groupExpression, forbidUnknownColStats, columnStatisticMap, 
isPlayNereidsDump, cteIdToStats, context);
@@ -369,7 +370,7 @@ public class StatsCalculator extends 
DefaultPlanVisitor<Statistics, Void> {
     @Override
     public Statistics visitLogicalAssertNumRows(
             LogicalAssertNumRows<? extends Plan> assertNumRows, Void context) {
-        return 
computeAssertNumRows(assertNumRows.getAssertNumRowsElement().getDesiredNumOfRows());
+        return computeAssertNumRows(assertNumRows.getAssertNumRowsElement());
     }
 
     @Override
@@ -533,7 +534,7 @@ public class StatsCalculator extends 
DefaultPlanVisitor<Statistics, Void> {
     @Override
     public Statistics visitPhysicalAssertNumRows(PhysicalAssertNumRows<? 
extends Plan> assertNumRows,
             Void context) {
-        return 
computeAssertNumRows(assertNumRows.getAssertNumRowsElement().getDesiredNumOfRows());
+        return computeAssertNumRows(assertNumRows.getAssertNumRowsElement());
     }
 
     @Override
@@ -556,11 +557,34 @@ public class StatsCalculator extends 
DefaultPlanVisitor<Statistics, Void> {
         return computeGenerate(generate);
     }
 
-    private Statistics computeAssertNumRows(long desiredNumOfRows) {
+    private Statistics computeAssertNumRows(AssertNumRowsElement 
assertNumRowsElement) {
         Statistics statistics = groupExpression.childStatistics(0);
-        statistics.withRowCountAndEnforceValid(Math.min(1, 
statistics.getRowCount()));
-        statistics = new 
StatisticsBuilder(statistics).setWidthInJoinCluster(1).build();
-        return statistics;
+        long newRowCount;
+        long rowCount = (long) statistics.getRowCount();
+        long desiredNumOfRows = assertNumRowsElement.getDesiredNumOfRows();
+        switch (assertNumRowsElement.getAssertion()) {
+            case EQ:
+                newRowCount = desiredNumOfRows;
+                break;
+            case GE:
+                newRowCount = statistics.getRowCount() >= desiredNumOfRows ? 
rowCount : desiredNumOfRows;
+                break;
+            case GT:
+                newRowCount = statistics.getRowCount() > desiredNumOfRows ? 
rowCount : desiredNumOfRows;
+                break;
+            case LE:
+                newRowCount = statistics.getRowCount() <= desiredNumOfRows ? 
rowCount : desiredNumOfRows;
+                break;
+            case LT:
+                newRowCount = statistics.getRowCount() < desiredNumOfRows ? 
rowCount : desiredNumOfRows;
+                break;
+            case NE:
+                return statistics;
+            default:
+                throw new IllegalArgumentException("Unknown assertion: " + 
assertNumRowsElement.getAssertion());
+        }
+        Statistics newStatistics = 
statistics.withRowCountAndEnforceValid(newRowCount);
+        return new 
StatisticsBuilder(newStatistics).setWidthInJoinCluster(1).build();
     }
 
     private Statistics computeFilter(Filter filter) {
@@ -610,7 +634,7 @@ public class StatsCalculator extends 
DefaultPlanVisitor<Statistics, Void> {
             }
         } else {
             return 
Env.getCurrentEnv().getStatisticsCache().getColumnStatistics(
-                catalogId, dbId, table.getId(), colName);
+                    catalogId, dbId, table.getId(), colName);
         }
     }
 
@@ -701,7 +725,7 @@ public class StatsCalculator extends 
DefaultPlanVisitor<Statistics, Void> {
                 rowCount = rowCount * DEFAULT_COLUMN_NDV_RATIO;
             } else {
                 rowCount = Math.min(rowCount, 
partitionByKeyStats.stream().map(s -> s.ndv)
-                    .max(Double::compare).get() * 
partitionTopN.getPartitionLimit());
+                        .max(Double::compare).get() * 
partitionTopN.getPartitionLimit());
             }
         } else {
             rowCount = Math.min(rowCount, partitionTopN.getPartitionLimit());
diff --git 
a/regression-test/data/nereids_tpcds_shape_sf1000_p0/shape/query54.out 
b/regression-test/data/nereids_tpcds_shape_sf1000_p0/shape/query54.out
index a732fd81b3b..23f67fe4b3c 100644
--- a/regression-test/data/nereids_tpcds_shape_sf1000_p0/shape/query54.out
+++ b/regression-test/data/nereids_tpcds_shape_sf1000_p0/shape/query54.out
@@ -15,10 +15,62 @@ PhysicalResultSink
 ------------------------PhysicalProject
 --------------------------hashJoin[INNER_JOIN] 
hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) 
otherCondition=() build RFs:RF6 ss_sold_date_sk->[d_date_sk]
 ----------------------------PhysicalProject
-------------------------------NestedLoopJoin[INNER_JOIN](cast(d_month_seq as 
BIGINT) <= (d_month_seq + 3))
---------------------------------NestedLoopJoin[INNER_JOIN](cast(d_month_seq as 
BIGINT) >= (d_month_seq + 1))
+------------------------------hashJoin[INNER_JOIN] 
hashCondition=((my_customers.c_customer_sk = store_sales.ss_customer_sk)) 
otherCondition=() build RFs:RF6 c_customer_sk->[ss_customer_sk]
+--------------------------------PhysicalProject
+----------------------------------PhysicalOlapScan[store_sales] apply RFs: RF6 
RF7
+--------------------------------PhysicalDistribute[DistributionSpecReplicated]
 ----------------------------------PhysicalProject
 ------------------------------------PhysicalOlapScan[date_dim] apply RFs: RF6
+----------------------------------------PhysicalProject
+------------------------------------------PhysicalOlapScan[customer_address] 
apply RFs: RF3 RF4 RF5
+----------------------------------------PhysicalDistribute[DistributionSpecHash]
+------------------------------------------PhysicalProject
+--------------------------------------------hashAgg[GLOBAL]
+----------------------------------------------PhysicalDistribute[DistributionSpecHash]
+------------------------------------------------hashAgg[LOCAL]
+--------------------------------------------------PhysicalProject
+----------------------------------------------------hashJoin[INNER_JOIN] 
hashCondition=((customer.c_customer_sk = cs_or_ws_sales.customer_sk)) 
otherCondition=() build RFs:RF2 customer_sk->[c_customer_sk]
+------------------------------------------------------PhysicalProject
+--------------------------------------------------------PhysicalOlapScan[customer]
 apply RFs: RF2
+------------------------------------------------------PhysicalDistribute[DistributionSpecReplicated]
+--------------------------------------------------------PhysicalProject
+----------------------------------------------------------hashJoin[INNER_JOIN] 
hashCondition=((cs_or_ws_sales.sold_date_sk = date_dim.d_date_sk)) 
otherCondition=() build RFs:RF1 d_date_sk->[cs_sold_date_sk,ws_sold_date_sk]
+------------------------------------------------------------PhysicalProject
+--------------------------------------------------------------hashJoin[INNER_JOIN]
 hashCondition=((cs_or_ws_sales.item_sk = item.i_item_sk)) otherCondition=() 
build RFs:RF0 i_item_sk->[cs_item_sk,ws_item_sk]
+----------------------------------------------------------------PhysicalUnion
+------------------------------------------------------------------PhysicalDistribute[DistributionSpecHash]
+--------------------------------------------------------------------PhysicalProject
+----------------------------------------------------------------------PhysicalOlapScan[catalog_sales]
 apply RFs: RF0 RF1
+------------------------------------------------------------------PhysicalDistribute[DistributionSpecHash]
+--------------------------------------------------------------------PhysicalProject
+----------------------------------------------------------------------PhysicalOlapScan[web_sales]
 apply RFs: RF0 RF1
+----------------------------------------------------------------PhysicalDistribute[DistributionSpecReplicated]
+------------------------------------------------------------------PhysicalProject
+--------------------------------------------------------------------filter((item.i_category
 = 'Music') and (item.i_class = 'country'))
+----------------------------------------------------------------------PhysicalOlapScan[item]
+------------------------------------------------------------PhysicalDistribute[DistributionSpecReplicated]
+--------------------------------------------------------------PhysicalProject
+----------------------------------------------------------------filter((date_dim.d_moy
 = 1) and (date_dim.d_year = 1999))
+------------------------------------------------------------------PhysicalOlapScan[date_dim]
+--------------------------------------PhysicalDistribute[DistributionSpecReplicated]
+----------------------------------------PhysicalProject
+------------------------------------------PhysicalOlapScan[store]
+----------------------------PhysicalDistribute[DistributionSpecReplicated]
+------------------------------PhysicalProject
+--------------------------------NestedLoopJoin[INNER_JOIN](cast(d_month_seq as 
BIGINT) <= (d_month_seq + 3))
+----------------------------------NestedLoopJoin[INNER_JOIN](cast(d_month_seq 
as BIGINT) >= (d_month_seq + 1))
+------------------------------------PhysicalProject
+--------------------------------------PhysicalOlapScan[date_dim]
+------------------------------------PhysicalDistribute[DistributionSpecReplicated]
+--------------------------------------PhysicalAssertNumRows
+----------------------------------------PhysicalDistribute[DistributionSpecGather]
+------------------------------------------hashAgg[GLOBAL]
+--------------------------------------------PhysicalDistribute[DistributionSpecHash]
+----------------------------------------------hashAgg[LOCAL]
+------------------------------------------------PhysicalProject
+--------------------------------------------------filter((date_dim.d_moy = 1) 
and (date_dim.d_year = 1999))
+----------------------------------------------------PhysicalOlapScan[date_dim]
+>>>>>>> 9c7d4b518e ([fix](Nereids): fix AssertNumRows StatsCalculator (#30053))
 
----------------------------------PhysicalDistribute[DistributionSpecReplicated]
 ------------------------------------PhysicalAssertNumRows
 
--------------------------------------PhysicalDistribute[DistributionSpecGather]
@@ -28,6 +80,7 @@ PhysicalResultSink
 ----------------------------------------------PhysicalProject
 ------------------------------------------------filter((date_dim.d_moy = 1) 
and (date_dim.d_year = 1999))
 --------------------------------------------------PhysicalOlapScan[date_dim]
+<<<<<<< HEAD
 --------------------------------PhysicalDistribute[DistributionSpecReplicated]
 ----------------------------------PhysicalAssertNumRows
 ------------------------------------PhysicalDistribute[DistributionSpecGather]
@@ -80,4 +133,6 @@ PhysicalResultSink
 
----------------------------------------PhysicalDistribute[DistributionSpecReplicated]
 ------------------------------------------PhysicalProject
 --------------------------------------------PhysicalOlapScan[store]
+=======
+>>>>>>> 9c7d4b518e ([fix](Nereids): fix AssertNumRows StatsCalculator (#30053))
 
diff --git 
a/regression-test/data/nereids_tpcds_shape_sf1000_p0/shape/query6.out 
b/regression-test/data/nereids_tpcds_shape_sf1000_p0/shape/query6.out
index b09c0da2bb3..889a34c0eb0 100644
--- a/regression-test/data/nereids_tpcds_shape_sf1000_p0/shape/query6.out
+++ b/regression-test/data/nereids_tpcds_shape_sf1000_p0/shape/query6.out
@@ -10,44 +10,44 @@ PhysicalResultSink
 --------------PhysicalDistribute[DistributionSpecHash]
 ----------------hashAgg[LOCAL]
 ------------------PhysicalProject
---------------------hashJoin[INNER_JOIN] hashCondition=((c.c_customer_sk = 
s.ss_customer_sk)) otherCondition=() build RFs:RF5 
c_customer_sk->[ss_customer_sk]
+--------------------hashJoin[INNER_JOIN] hashCondition=((a.ca_address_sk = 
c.c_current_addr_sk)) otherCondition=() build RFs:RF5 
c_current_addr_sk->[ca_address_sk]
+----------------------PhysicalProject
+------------------------PhysicalOlapScan[customer_address] apply RFs: RF5
 ----------------------PhysicalDistribute[DistributionSpecHash]
 ------------------------PhysicalProject
---------------------------hashJoin[INNER_JOIN] hashCondition=((s.ss_item_sk = 
i.i_item_sk)) otherCondition=() build RFs:RF4 i_item_sk->[ss_item_sk]
-----------------------------PhysicalProject
-------------------------------hashJoin[INNER_JOIN] 
hashCondition=((s.ss_sold_date_sk = d.d_date_sk)) otherCondition=() build 
RFs:RF3 d_date_sk->[ss_sold_date_sk]
---------------------------------PhysicalProject
-----------------------------------PhysicalOlapScan[store_sales] apply RFs: RF3 
RF4 RF5
---------------------------------PhysicalDistribute[DistributionSpecReplicated]
-----------------------------------hashJoin[INNER_JOIN] 
hashCondition=((d.d_month_seq = date_dim.d_month_seq)) otherCondition=() build 
RFs:RF2 d_month_seq->[d_month_seq]
-------------------------------------PhysicalProject
---------------------------------------PhysicalOlapScan[date_dim] apply RFs: RF2
-------------------------------------PhysicalDistribute[DistributionSpecReplicated]
---------------------------------------PhysicalAssertNumRows
-----------------------------------------PhysicalDistribute[DistributionSpecGather]
-------------------------------------------hashAgg[GLOBAL]
---------------------------------------------PhysicalDistribute[DistributionSpecHash]
-----------------------------------------------hashAgg[LOCAL]
-------------------------------------------------PhysicalProject
---------------------------------------------------filter((date_dim.d_moy = 3) 
and (date_dim.d_year = 2002))
-----------------------------------------------------PhysicalOlapScan[date_dim]
-----------------------------PhysicalDistribute[DistributionSpecReplicated]
-------------------------------hashJoin[INNER_JOIN] 
hashCondition=((j.i_category = i.i_category)) 
otherCondition=((cast(i_current_price as DECIMALV3(38, 5)) > (1.2 * 
avg(cast(i_current_price as DECIMALV3(9, 4)))))) build RFs:RF1 
i_category->[i_category]
---------------------------------PhysicalProject
-----------------------------------PhysicalOlapScan[item] apply RFs: RF1
---------------------------------PhysicalDistribute[DistributionSpecReplicated]
-----------------------------------hashAgg[GLOBAL]
-------------------------------------PhysicalDistribute[DistributionSpecHash]
---------------------------------------hashAgg[LOCAL]
-----------------------------------------PhysicalProject
-------------------------------------------PhysicalOlapScan[item]
-----------------------PhysicalDistribute[DistributionSpecHash]
-------------------------PhysicalProject
---------------------------hashJoin[INNER_JOIN] hashCondition=((a.ca_address_sk 
= c.c_current_addr_sk)) otherCondition=() build RFs:RF0 
ca_address_sk->[c_current_addr_sk]
+--------------------------hashJoin[INNER_JOIN] hashCondition=((c.c_customer_sk 
= s.ss_customer_sk)) otherCondition=() build RFs:RF4 
ss_customer_sk->[c_customer_sk]
 ----------------------------PhysicalDistribute[DistributionSpecHash]
 ------------------------------PhysicalProject
---------------------------------PhysicalOlapScan[customer] apply RFs: RF0
+--------------------------------PhysicalOlapScan[customer] apply RFs: RF4
 ----------------------------PhysicalDistribute[DistributionSpecHash]
 ------------------------------PhysicalProject
---------------------------------PhysicalOlapScan[customer_address]
+--------------------------------hashJoin[INNER_JOIN] 
hashCondition=((s.ss_item_sk = i.i_item_sk)) otherCondition=() build RFs:RF3 
i_item_sk->[ss_item_sk]
+----------------------------------PhysicalDistribute[DistributionSpecHash]
+------------------------------------PhysicalProject
+--------------------------------------hashJoin[INNER_JOIN] 
hashCondition=((s.ss_sold_date_sk = d.d_date_sk)) otherCondition=() build 
RFs:RF2 d_date_sk->[ss_sold_date_sk]
+----------------------------------------PhysicalProject
+------------------------------------------PhysicalOlapScan[store_sales] apply 
RFs: RF2 RF3
+----------------------------------------PhysicalDistribute[DistributionSpecReplicated]
+------------------------------------------hashJoin[INNER_JOIN] 
hashCondition=((d.d_month_seq = date_dim.d_month_seq)) otherCondition=() build 
RFs:RF1 d_month_seq->[d_month_seq]
+--------------------------------------------PhysicalProject
+----------------------------------------------PhysicalOlapScan[date_dim] apply 
RFs: RF1
+--------------------------------------------PhysicalDistribute[DistributionSpecReplicated]
+----------------------------------------------PhysicalAssertNumRows
+------------------------------------------------PhysicalDistribute[DistributionSpecGather]
+--------------------------------------------------hashAgg[GLOBAL]
+----------------------------------------------------PhysicalDistribute[DistributionSpecHash]
+------------------------------------------------------hashAgg[LOCAL]
+--------------------------------------------------------PhysicalProject
+----------------------------------------------------------filter((date_dim.d_moy
 = 3) and (date_dim.d_year = 2002))
+------------------------------------------------------------PhysicalOlapScan[date_dim]
+----------------------------------PhysicalDistribute[DistributionSpecHash]
+------------------------------------hashJoin[INNER_JOIN] 
hashCondition=((j.i_category = i.i_category)) 
otherCondition=((cast(i_current_price as DECIMALV3(38, 5)) > (1.2 * 
avg(cast(i_current_price as DECIMALV3(9, 4)))))) build RFs:RF0 
i_category->[i_category]
+--------------------------------------PhysicalProject
+----------------------------------------PhysicalOlapScan[item] apply RFs: RF0
+--------------------------------------PhysicalDistribute[DistributionSpecReplicated]
+----------------------------------------hashAgg[GLOBAL]
+------------------------------------------PhysicalDistribute[DistributionSpecHash]
+--------------------------------------------hashAgg[LOCAL]
+----------------------------------------------PhysicalProject
+------------------------------------------------PhysicalOlapScan[item]
 
diff --git 
a/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query58.out 
b/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query58.out
index c59907df29c..c0082e8cea0 100644
--- 
a/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query58.out
+++ 
b/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query58.out
@@ -28,10 +28,9 @@ PhysicalResultSink
 ------------------------------------PhysicalDistribute[DistributionSpecHash]
 --------------------------------------PhysicalProject
 ----------------------------------------hashJoin[INNER_JOIN] 
hashCondition=((date_dim.d_week_seq = date_dim.d_week_seq)) otherCondition=() 
build RFs:RF8 d_week_seq->[d_week_seq]
-------------------------------------------PhysicalDistribute[DistributionSpecHash]
---------------------------------------------PhysicalProject
-----------------------------------------------PhysicalOlapScan[date_dim] apply 
RFs: RF8
-------------------------------------------PhysicalDistribute[DistributionSpecHash]
+------------------------------------------PhysicalProject
+--------------------------------------------PhysicalOlapScan[date_dim] apply 
RFs: RF8
+------------------------------------------PhysicalDistribute[DistributionSpecReplicated]
 --------------------------------------------PhysicalAssertNumRows
 
----------------------------------------------PhysicalDistribute[DistributionSpecGather]
 ------------------------------------------------PhysicalProject
@@ -59,10 +58,9 @@ PhysicalResultSink
 ------------------------------------PhysicalDistribute[DistributionSpecHash]
 --------------------------------------PhysicalProject
 ----------------------------------------hashJoin[INNER_JOIN] 
hashCondition=((date_dim.d_week_seq = date_dim.d_week_seq)) otherCondition=() 
build RFs:RF4 d_week_seq->[d_week_seq]
-------------------------------------------PhysicalDistribute[DistributionSpecHash]
---------------------------------------------PhysicalProject
-----------------------------------------------PhysicalOlapScan[date_dim] apply 
RFs: RF4
-------------------------------------------PhysicalDistribute[DistributionSpecHash]
+------------------------------------------PhysicalProject
+--------------------------------------------PhysicalOlapScan[date_dim] apply 
RFs: RF4
+------------------------------------------PhysicalDistribute[DistributionSpecReplicated]
 --------------------------------------------PhysicalAssertNumRows
 
----------------------------------------------PhysicalDistribute[DistributionSpecGather]
 ------------------------------------------------PhysicalProject
@@ -90,10 +88,9 @@ PhysicalResultSink
 --------------------------------PhysicalDistribute[DistributionSpecHash]
 ----------------------------------PhysicalProject
 ------------------------------------hashJoin[INNER_JOIN] 
hashCondition=((date_dim.d_week_seq = date_dim.d_week_seq)) otherCondition=() 
build RFs:RF0 d_week_seq->[d_week_seq]
---------------------------------------PhysicalDistribute[DistributionSpecHash]
-----------------------------------------PhysicalProject
-------------------------------------------PhysicalOlapScan[date_dim] apply 
RFs: RF0
---------------------------------------PhysicalDistribute[DistributionSpecHash]
+--------------------------------------PhysicalProject
+----------------------------------------PhysicalOlapScan[date_dim] apply RFs: 
RF0
+--------------------------------------PhysicalDistribute[DistributionSpecReplicated]
 ----------------------------------------PhysicalAssertNumRows
 
------------------------------------------PhysicalDistribute[DistributionSpecGather]
 --------------------------------------------PhysicalProject
diff --git 
a/regression-test/data/nereids_tpcds_shape_sf100_p0/no_stats_shape/query58.out 
b/regression-test/data/nereids_tpcds_shape_sf100_p0/no_stats_shape/query58.out
index a449bf2addb..2814b83c308 100644
--- 
a/regression-test/data/nereids_tpcds_shape_sf100_p0/no_stats_shape/query58.out
+++ 
b/regression-test/data/nereids_tpcds_shape_sf100_p0/no_stats_shape/query58.out
@@ -28,10 +28,9 @@ PhysicalResultSink
 ------------------------------------PhysicalDistribute[DistributionSpecHash]
 --------------------------------------PhysicalProject
 ----------------------------------------hashJoin[INNER_JOIN] 
hashCondition=((date_dim.d_week_seq = date_dim.d_week_seq)) otherCondition=() 
build RFs:RF8 d_week_seq->[d_week_seq]
-------------------------------------------PhysicalDistribute[DistributionSpecHash]
---------------------------------------------PhysicalProject
-----------------------------------------------PhysicalOlapScan[date_dim] apply 
RFs: RF8 RF9
-------------------------------------------PhysicalDistribute[DistributionSpecHash]
+------------------------------------------PhysicalProject
+--------------------------------------------PhysicalOlapScan[date_dim] apply 
RFs: RF8 RF9
+------------------------------------------PhysicalDistribute[DistributionSpecReplicated]
 --------------------------------------------PhysicalAssertNumRows
 
----------------------------------------------PhysicalDistribute[DistributionSpecGather]
 ------------------------------------------------PhysicalProject
@@ -59,10 +58,9 @@ PhysicalResultSink
 ------------------------------------PhysicalDistribute[DistributionSpecHash]
 --------------------------------------PhysicalProject
 ----------------------------------------hashJoin[INNER_JOIN] 
hashCondition=((date_dim.d_week_seq = date_dim.d_week_seq)) otherCondition=() 
build RFs:RF4 d_week_seq->[d_week_seq]
-------------------------------------------PhysicalDistribute[DistributionSpecHash]
---------------------------------------------PhysicalProject
-----------------------------------------------PhysicalOlapScan[date_dim] apply 
RFs: RF4 RF5
-------------------------------------------PhysicalDistribute[DistributionSpecHash]
+------------------------------------------PhysicalProject
+--------------------------------------------PhysicalOlapScan[date_dim] apply 
RFs: RF4 RF5
+------------------------------------------PhysicalDistribute[DistributionSpecReplicated]
 --------------------------------------------PhysicalAssertNumRows
 
----------------------------------------------PhysicalDistribute[DistributionSpecGather]
 ------------------------------------------------PhysicalProject
@@ -90,10 +88,9 @@ PhysicalResultSink
 --------------------------------PhysicalDistribute[DistributionSpecHash]
 ----------------------------------PhysicalProject
 ------------------------------------hashJoin[INNER_JOIN] 
hashCondition=((date_dim.d_week_seq = date_dim.d_week_seq)) otherCondition=() 
build RFs:RF0 d_week_seq->[d_week_seq]
---------------------------------------PhysicalDistribute[DistributionSpecHash]
-----------------------------------------PhysicalProject
-------------------------------------------PhysicalOlapScan[date_dim] apply 
RFs: RF0 RF1
---------------------------------------PhysicalDistribute[DistributionSpecHash]
+--------------------------------------PhysicalProject
+----------------------------------------PhysicalOlapScan[date_dim] apply RFs: 
RF0 RF1
+--------------------------------------PhysicalDistribute[DistributionSpecReplicated]
 ----------------------------------------PhysicalAssertNumRows
 
------------------------------------------PhysicalDistribute[DistributionSpecGather]
 --------------------------------------------PhysicalProject
diff --git 
a/regression-test/data/nereids_tpcds_shape_sf100_p0/rf_prune/query54.out 
b/regression-test/data/nereids_tpcds_shape_sf100_p0/rf_prune/query54.out
index 1bacc9f548a..317cf663ecd 100644
--- a/regression-test/data/nereids_tpcds_shape_sf100_p0/rf_prune/query54.out
+++ b/regression-test/data/nereids_tpcds_shape_sf100_p0/rf_prune/query54.out
@@ -13,10 +13,11 @@ PhysicalResultSink
 --------------------PhysicalDistribute[DistributionSpecHash]
 ----------------------hashAgg[LOCAL]
 ------------------------PhysicalProject
---------------------------NestedLoopJoin[INNER_JOIN](cast(d_month_seq as 
BIGINT) <= (d_month_seq + 3))
+--------------------------hashJoin[INNER_JOIN] 
hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) 
otherCondition=() build RFs:RF7 d_date_sk->[ss_sold_date_sk]
 ----------------------------PhysicalProject
-------------------------------NestedLoopJoin[INNER_JOIN](cast(d_month_seq as 
BIGINT) >= (d_month_seq + 1))
+------------------------------hashJoin[INNER_JOIN] 
hashCondition=((my_customers.c_customer_sk = store_sales.ss_customer_sk)) 
otherCondition=() build RFs:RF6 c_customer_sk->[ss_customer_sk]
 --------------------------------PhysicalProject
+<<<<<<< HEAD
 ----------------------------------hashJoin[INNER_JOIN] 
hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) 
otherCondition=()
 ------------------------------------PhysicalDistribute[DistributionSpecHash]
 --------------------------------------PhysicalProject
@@ -79,7 +80,69 @@ PhysicalResultSink
 ----------------------------------hashAgg[GLOBAL]
 ------------------------------------PhysicalDistribute[DistributionSpecHash]
 --------------------------------------hashAgg[LOCAL]
+=======
+----------------------------------PhysicalOlapScan[store_sales] apply RFs: RF6 
RF7
+--------------------------------PhysicalDistribute[DistributionSpecReplicated]
+----------------------------------PhysicalProject
+------------------------------------hashJoin[INNER_JOIN] 
hashCondition=((customer_address.ca_county = store.s_county) and 
(customer_address.ca_state = store.s_state)) otherCondition=() build RFs:RF4 
s_county->[ca_county];RF5 s_state->[ca_state]
+--------------------------------------hashJoin[INNER_JOIN] 
hashCondition=((my_customers.c_current_addr_sk = 
customer_address.ca_address_sk)) otherCondition=() build RFs:RF3 
c_current_addr_sk->[ca_address_sk]
 ----------------------------------------PhysicalProject
-------------------------------------------filter((date_dim.d_moy = 5) and 
(date_dim.d_year = 1998))
---------------------------------------------PhysicalOlapScan[date_dim]
+------------------------------------------PhysicalOlapScan[customer_address] 
apply RFs: RF3 RF4 RF5
+----------------------------------------PhysicalDistribute[DistributionSpecHash]
+------------------------------------------PhysicalProject
+--------------------------------------------hashAgg[GLOBAL]
+----------------------------------------------PhysicalDistribute[DistributionSpecHash]
+------------------------------------------------hashAgg[LOCAL]
+--------------------------------------------------PhysicalProject
+----------------------------------------------------hashJoin[INNER_JOIN] 
hashCondition=((customer.c_customer_sk = cs_or_ws_sales.customer_sk)) 
otherCondition=() build RFs:RF2 customer_sk->[c_customer_sk]
+------------------------------------------------------PhysicalProject
+--------------------------------------------------------PhysicalOlapScan[customer]
 apply RFs: RF2
+------------------------------------------------------PhysicalDistribute[DistributionSpecReplicated]
+--------------------------------------------------------PhysicalProject
+----------------------------------------------------------hashJoin[INNER_JOIN] 
hashCondition=((cs_or_ws_sales.sold_date_sk = date_dim.d_date_sk)) 
otherCondition=() build RFs:RF1 d_date_sk->[cs_sold_date_sk,ws_sold_date_sk]
+------------------------------------------------------------PhysicalProject
+--------------------------------------------------------------hashJoin[INNER_JOIN]
 hashCondition=((cs_or_ws_sales.item_sk = item.i_item_sk)) otherCondition=() 
build RFs:RF0 i_item_sk->[cs_item_sk,ws_item_sk]
+----------------------------------------------------------------PhysicalUnion
+------------------------------------------------------------------PhysicalDistribute[DistributionSpecHash]
+--------------------------------------------------------------------PhysicalProject
+----------------------------------------------------------------------PhysicalOlapScan[catalog_sales]
 apply RFs: RF0 RF1
+------------------------------------------------------------------PhysicalDistribute[DistributionSpecHash]
+--------------------------------------------------------------------PhysicalProject
+----------------------------------------------------------------------PhysicalOlapScan[web_sales]
 apply RFs: RF0 RF1
+----------------------------------------------------------------PhysicalDistribute[DistributionSpecReplicated]
+------------------------------------------------------------------PhysicalProject
+--------------------------------------------------------------------filter((item.i_category
 = 'Women') and (item.i_class = 'maternity'))
+----------------------------------------------------------------------PhysicalOlapScan[item]
+------------------------------------------------------------PhysicalDistribute[DistributionSpecReplicated]
+--------------------------------------------------------------PhysicalProject
+----------------------------------------------------------------filter((date_dim.d_moy
 = 5) and (date_dim.d_year = 1998))
+------------------------------------------------------------------PhysicalOlapScan[date_dim]
+--------------------------------------PhysicalDistribute[DistributionSpecReplicated]
+>>>>>>> 9c7d4b518e ([fix](Nereids): fix AssertNumRows StatsCalculator (#30053))
+----------------------------------------PhysicalProject
+------------------------------------------PhysicalOlapScan[store]
+----------------------------PhysicalDistribute[DistributionSpecReplicated]
+------------------------------PhysicalProject
+--------------------------------NestedLoopJoin[INNER_JOIN](cast(d_month_seq as 
BIGINT) <= (d_month_seq + 3))
+----------------------------------NestedLoopJoin[INNER_JOIN](cast(d_month_seq 
as BIGINT) >= (d_month_seq + 1))
+------------------------------------PhysicalProject
+--------------------------------------PhysicalOlapScan[date_dim]
+------------------------------------PhysicalDistribute[DistributionSpecReplicated]
+--------------------------------------PhysicalAssertNumRows
+----------------------------------------PhysicalDistribute[DistributionSpecGather]
+------------------------------------------hashAgg[GLOBAL]
+--------------------------------------------PhysicalDistribute[DistributionSpecHash]
+----------------------------------------------hashAgg[LOCAL]
+------------------------------------------------PhysicalProject
+--------------------------------------------------filter((date_dim.d_moy = 5) 
and (date_dim.d_year = 1998))
+----------------------------------------------------PhysicalOlapScan[date_dim]
+----------------------------------PhysicalDistribute[DistributionSpecReplicated]
+------------------------------------PhysicalAssertNumRows
+--------------------------------------PhysicalDistribute[DistributionSpecGather]
+----------------------------------------hashAgg[GLOBAL]
+------------------------------------------PhysicalDistribute[DistributionSpecHash]
+--------------------------------------------hashAgg[LOCAL]
+----------------------------------------------PhysicalProject
+------------------------------------------------filter((date_dim.d_moy = 5) 
and (date_dim.d_year = 1998))
+--------------------------------------------------PhysicalOlapScan[date_dim]
 
diff --git 
a/regression-test/data/nereids_tpcds_shape_sf100_p0/rf_prune/query6.out 
b/regression-test/data/nereids_tpcds_shape_sf100_p0/rf_prune/query6.out
index 07fa54e46ba..28f53e05bbe 100644
--- a/regression-test/data/nereids_tpcds_shape_sf100_p0/rf_prune/query6.out
+++ b/regression-test/data/nereids_tpcds_shape_sf100_p0/rf_prune/query6.out
@@ -10,7 +10,9 @@ PhysicalResultSink
 --------------PhysicalDistribute[DistributionSpecHash]
 ----------------hashAgg[LOCAL]
 ------------------PhysicalProject
---------------------hashJoin[INNER_JOIN] hashCondition=((a.ca_address_sk = 
c.c_current_addr_sk)) otherCondition=()
+--------------------hashJoin[INNER_JOIN] hashCondition=((a.ca_address_sk = 
c.c_current_addr_sk)) otherCondition=() build RFs:RF5 
c_current_addr_sk->[ca_address_sk]
+----------------------PhysicalProject
+------------------------PhysicalOlapScan[customer_address] apply RFs: RF5
 ----------------------PhysicalDistribute[DistributionSpecHash]
 ------------------------PhysicalProject
 --------------------------hashJoin[INNER_JOIN] hashCondition=((c.c_customer_sk 
= s.ss_customer_sk)) otherCondition=() build RFs:RF4 
ss_customer_sk->[c_customer_sk]
@@ -48,7 +50,4 @@ PhysicalResultSink
 --------------------------------------------hashAgg[LOCAL]
 ----------------------------------------------PhysicalProject
 ------------------------------------------------PhysicalOlapScan[item]
-----------------------PhysicalDistribute[DistributionSpecHash]
-------------------------PhysicalProject
---------------------------PhysicalOlapScan[customer_address]
 
diff --git 
a/regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query54.out 
b/regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query54.out
index b4f27acdc19..258f66e9c6a 100644
--- a/regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query54.out
+++ b/regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query54.out
@@ -13,10 +13,11 @@ PhysicalResultSink
 --------------------PhysicalDistribute[DistributionSpecHash]
 ----------------------hashAgg[LOCAL]
 ------------------------PhysicalProject
---------------------------NestedLoopJoin[INNER_JOIN](cast(d_month_seq as 
BIGINT) <= (d_month_seq + 3))
+--------------------------hashJoin[INNER_JOIN] 
hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) 
otherCondition=() build RFs:RF7 d_date_sk->[ss_sold_date_sk]
 ----------------------------PhysicalProject
-------------------------------NestedLoopJoin[INNER_JOIN](cast(d_month_seq as 
BIGINT) >= (d_month_seq + 1))
+------------------------------hashJoin[INNER_JOIN] 
hashCondition=((my_customers.c_customer_sk = store_sales.ss_customer_sk)) 
otherCondition=() build RFs:RF6 c_customer_sk->[ss_customer_sk]
 --------------------------------PhysicalProject
+<<<<<<< HEAD
 ----------------------------------hashJoin[INNER_JOIN] 
hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) 
otherCondition=() build RFs:RF6 d_date_sk->[ss_sold_date_sk]
 ------------------------------------PhysicalDistribute[DistributionSpecHash]
 --------------------------------------PhysicalProject
@@ -79,7 +80,69 @@ PhysicalResultSink
 ----------------------------------hashAgg[GLOBAL]
 ------------------------------------PhysicalDistribute[DistributionSpecHash]
 --------------------------------------hashAgg[LOCAL]
+=======
+----------------------------------PhysicalOlapScan[store_sales] apply RFs: RF6 
RF7
+--------------------------------PhysicalDistribute[DistributionSpecReplicated]
+----------------------------------PhysicalProject
+------------------------------------hashJoin[INNER_JOIN] 
hashCondition=((customer_address.ca_county = store.s_county) and 
(customer_address.ca_state = store.s_state)) otherCondition=() build RFs:RF4 
s_county->[ca_county];RF5 s_state->[ca_state]
+--------------------------------------hashJoin[INNER_JOIN] 
hashCondition=((my_customers.c_current_addr_sk = 
customer_address.ca_address_sk)) otherCondition=() build RFs:RF3 
c_current_addr_sk->[ca_address_sk]
 ----------------------------------------PhysicalProject
-------------------------------------------filter((date_dim.d_moy = 5) and 
(date_dim.d_year = 1998))
---------------------------------------------PhysicalOlapScan[date_dim]
+------------------------------------------PhysicalOlapScan[customer_address] 
apply RFs: RF3 RF4 RF5
+----------------------------------------PhysicalDistribute[DistributionSpecHash]
+------------------------------------------PhysicalProject
+--------------------------------------------hashAgg[GLOBAL]
+----------------------------------------------PhysicalDistribute[DistributionSpecHash]
+------------------------------------------------hashAgg[LOCAL]
+--------------------------------------------------PhysicalProject
+----------------------------------------------------hashJoin[INNER_JOIN] 
hashCondition=((customer.c_customer_sk = cs_or_ws_sales.customer_sk)) 
otherCondition=() build RFs:RF2 customer_sk->[c_customer_sk]
+------------------------------------------------------PhysicalProject
+--------------------------------------------------------PhysicalOlapScan[customer]
 apply RFs: RF2
+------------------------------------------------------PhysicalDistribute[DistributionSpecReplicated]
+--------------------------------------------------------PhysicalProject
+----------------------------------------------------------hashJoin[INNER_JOIN] 
hashCondition=((cs_or_ws_sales.sold_date_sk = date_dim.d_date_sk)) 
otherCondition=() build RFs:RF1 d_date_sk->[cs_sold_date_sk,ws_sold_date_sk]
+------------------------------------------------------------PhysicalProject
+--------------------------------------------------------------hashJoin[INNER_JOIN]
 hashCondition=((cs_or_ws_sales.item_sk = item.i_item_sk)) otherCondition=() 
build RFs:RF0 i_item_sk->[cs_item_sk,ws_item_sk]
+----------------------------------------------------------------PhysicalUnion
+------------------------------------------------------------------PhysicalDistribute[DistributionSpecHash]
+--------------------------------------------------------------------PhysicalProject
+----------------------------------------------------------------------PhysicalOlapScan[catalog_sales]
 apply RFs: RF0 RF1
+------------------------------------------------------------------PhysicalDistribute[DistributionSpecHash]
+--------------------------------------------------------------------PhysicalProject
+----------------------------------------------------------------------PhysicalOlapScan[web_sales]
 apply RFs: RF0 RF1
+----------------------------------------------------------------PhysicalDistribute[DistributionSpecReplicated]
+------------------------------------------------------------------PhysicalProject
+--------------------------------------------------------------------filter((item.i_category
 = 'Women') and (item.i_class = 'maternity'))
+----------------------------------------------------------------------PhysicalOlapScan[item]
+------------------------------------------------------------PhysicalDistribute[DistributionSpecReplicated]
+--------------------------------------------------------------PhysicalProject
+----------------------------------------------------------------filter((date_dim.d_moy
 = 5) and (date_dim.d_year = 1998))
+------------------------------------------------------------------PhysicalOlapScan[date_dim]
+--------------------------------------PhysicalDistribute[DistributionSpecReplicated]
+>>>>>>> 9c7d4b518e ([fix](Nereids): fix AssertNumRows StatsCalculator (#30053))
+----------------------------------------PhysicalProject
+------------------------------------------PhysicalOlapScan[store]
+----------------------------PhysicalDistribute[DistributionSpecReplicated]
+------------------------------PhysicalProject
+--------------------------------NestedLoopJoin[INNER_JOIN](cast(d_month_seq as 
BIGINT) <= (d_month_seq + 3))
+----------------------------------NestedLoopJoin[INNER_JOIN](cast(d_month_seq 
as BIGINT) >= (d_month_seq + 1))
+------------------------------------PhysicalProject
+--------------------------------------PhysicalOlapScan[date_dim]
+------------------------------------PhysicalDistribute[DistributionSpecReplicated]
+--------------------------------------PhysicalAssertNumRows
+----------------------------------------PhysicalDistribute[DistributionSpecGather]
+------------------------------------------hashAgg[GLOBAL]
+--------------------------------------------PhysicalDistribute[DistributionSpecHash]
+----------------------------------------------hashAgg[LOCAL]
+------------------------------------------------PhysicalProject
+--------------------------------------------------filter((date_dim.d_moy = 5) 
and (date_dim.d_year = 1998))
+----------------------------------------------------PhysicalOlapScan[date_dim]
+----------------------------------PhysicalDistribute[DistributionSpecReplicated]
+------------------------------------PhysicalAssertNumRows
+--------------------------------------PhysicalDistribute[DistributionSpecGather]
+----------------------------------------hashAgg[GLOBAL]
+------------------------------------------PhysicalDistribute[DistributionSpecHash]
+--------------------------------------------hashAgg[LOCAL]
+----------------------------------------------PhysicalProject
+------------------------------------------------filter((date_dim.d_moy = 5) 
and (date_dim.d_year = 1998))
+--------------------------------------------------PhysicalOlapScan[date_dim]
 
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 000b390d023..889a34c0eb0 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
@@ -10,13 +10,15 @@ PhysicalResultSink
 --------------PhysicalDistribute[DistributionSpecHash]
 ----------------hashAgg[LOCAL]
 ------------------PhysicalProject
---------------------hashJoin[INNER_JOIN] hashCondition=((a.ca_address_sk = 
c.c_current_addr_sk)) otherCondition=() build RFs:RF5 
ca_address_sk->[c_current_addr_sk]
+--------------------hashJoin[INNER_JOIN] hashCondition=((a.ca_address_sk = 
c.c_current_addr_sk)) otherCondition=() build RFs:RF5 
c_current_addr_sk->[ca_address_sk]
+----------------------PhysicalProject
+------------------------PhysicalOlapScan[customer_address] apply RFs: RF5
 ----------------------PhysicalDistribute[DistributionSpecHash]
 ------------------------PhysicalProject
 --------------------------hashJoin[INNER_JOIN] hashCondition=((c.c_customer_sk 
= s.ss_customer_sk)) otherCondition=() build RFs:RF4 
ss_customer_sk->[c_customer_sk]
 ----------------------------PhysicalDistribute[DistributionSpecHash]
 ------------------------------PhysicalProject
---------------------------------PhysicalOlapScan[customer] apply RFs: RF4 RF5
+--------------------------------PhysicalOlapScan[customer] apply RFs: RF4
 ----------------------------PhysicalDistribute[DistributionSpecHash]
 ------------------------------PhysicalProject
 --------------------------------hashJoin[INNER_JOIN] 
hashCondition=((s.ss_item_sk = i.i_item_sk)) otherCondition=() build RFs:RF3 
i_item_sk->[ss_item_sk]
@@ -48,7 +50,4 @@ PhysicalResultSink
 --------------------------------------------hashAgg[LOCAL]
 ----------------------------------------------PhysicalProject
 ------------------------------------------------PhysicalOlapScan[item]
-----------------------PhysicalDistribute[DistributionSpecHash]
-------------------------PhysicalProject
---------------------------PhysicalOlapScan[customer_address]
 


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


Reply via email to