This is an automated email from the ASF dual-hosted git repository.
jakevin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new 05331556f31 [minor](Nereids): enable PushDownTopNDistinctThroughJoin
(#30275)
05331556f31 is described below
commit 05331556f318b549a4cee3e46704eddbd26ea3e1
Author: jakevin <[email protected]>
AuthorDate: Wed Jan 24 22:19:28 2024 +0800
[minor](Nereids): enable PushDownTopNDistinctThroughJoin (#30275)
---
.../doris/nereids/jobs/executor/Rewriter.java | 3 +-
.../org/apache/doris/nereids/rules/RuleType.java | 3 +-
.../rewrite/PushDownTopNDistinctThroughUnion.java | 8 +-
.../org/apache/doris/nereids/util/PlanUtils.java | 6 +-
.../push_down_top_n_distinct_through_union.out | 138 ++++++++++++-----
.../shape/query49.out | 162 +++++++++++---------
.../noStatsRfPrune/query49.out | 168 ++++++++++++---------
.../no_stats_shape/query49.out | 168 ++++++++++++---------
.../rf_prune/query49.out | 162 +++++++++++---------
.../nereids_tpcds_shape_sf100_p0/shape/query49.out | 162 +++++++++++---------
.../limit_push_down/order_push_down.groovy | 1 +
11 files changed, 573 insertions(+), 408 deletions(-)
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/nereids/jobs/executor/Rewriter.java
b/fe/fe-core/src/main/java/org/apache/doris/nereids/jobs/executor/Rewriter.java
index c4b2945e7cd..4304933f752 100644
---
a/fe/fe-core/src/main/java/org/apache/doris/nereids/jobs/executor/Rewriter.java
+++
b/fe/fe-core/src/main/java/org/apache/doris/nereids/jobs/executor/Rewriter.java
@@ -109,6 +109,7 @@ import
org.apache.doris.nereids.rules.rewrite.PushDownMinMaxThroughJoin;
import org.apache.doris.nereids.rules.rewrite.PushDownSumThroughJoin;
import org.apache.doris.nereids.rules.rewrite.PushDownSumThroughJoinOneSide;
import org.apache.doris.nereids.rules.rewrite.PushDownTopNDistinctThroughJoin;
+import org.apache.doris.nereids.rules.rewrite.PushDownTopNDistinctThroughUnion;
import org.apache.doris.nereids.rules.rewrite.PushDownTopNThroughJoin;
import org.apache.doris.nereids.rules.rewrite.PushDownTopNThroughUnion;
import org.apache.doris.nereids.rules.rewrite.PushDownTopNThroughWindow;
@@ -334,7 +335,7 @@ public class Rewriter extends AbstractBatchJobExecutor {
new PushDownLimitDistinctThroughJoin(),
new PushDownLimitDistinctThroughUnion(),
new PushDownTopNDistinctThroughJoin(),
- // new PushDownTopNDistinctThroughUnion(),
+ new PushDownTopNDistinctThroughUnion(),
new PushDownTopNThroughJoin(),
new PushDownTopNThroughWindow(),
new PushDownTopNThroughUnion()
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/RuleType.java
b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/RuleType.java
index 248fec7de3f..29c053a8b34 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/RuleType.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/RuleType.java
@@ -271,8 +271,7 @@ public enum RuleType {
PUSH_DOWN_TOP_N_THROUGH_PROJECT_WINDOW(RuleTypeClass.REWRITE),
PUSH_DOWN_TOP_N_THROUGH_WINDOW(RuleTypeClass.REWRITE),
PUSH_DOWN_TOP_N_THROUGH_UNION(RuleTypeClass.REWRITE),
- PUSH_DOWN_TOP_N_LIMIT_THROUGH_UNION(RuleTypeClass.REWRITE),
- // limit distinct push down
+ PUSH_DOWN_TOP_N_DISTINCT_THROUGH_UNION(RuleTypeClass.REWRITE),
PUSH_DOWN_LIMIT_DISTINCT_THROUGH_JOIN(RuleTypeClass.REWRITE),
PUSH_DOWN_LIMIT_DISTINCT_THROUGH_PROJECT_JOIN(RuleTypeClass.REWRITE),
PUSH_DOWN_LIMIT_DISTINCT_THROUGH_UNION(RuleTypeClass.REWRITE),
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/PushDownTopNDistinctThroughUnion.java
b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/PushDownTopNDistinctThroughUnion.java
index 7563ecd5165..f6e944a7a91 100644
---
a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/PushDownTopNDistinctThroughUnion.java
+++
b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/PushDownTopNDistinctThroughUnion.java
@@ -28,6 +28,7 @@ import
org.apache.doris.nereids.trees.plans.logical.LogicalAggregate;
import org.apache.doris.nereids.trees.plans.logical.LogicalTopN;
import org.apache.doris.nereids.trees.plans.logical.LogicalUnion;
import org.apache.doris.nereids.util.ExpressionUtils;
+import org.apache.doris.nereids.util.PlanUtils;
import com.google.common.collect.ImmutableList;
@@ -73,20 +74,19 @@ public class PushDownTopNDistinctThroughUnion implements
RewriteRuleFactory {
NamedExpression output =
union.getOutputs().get(i);
replaceMap.put(output,
child.getOutput().get(i));
}
-
List<OrderKey> orderKeys =
topN.getOrderKeys().stream()
.map(orderKey ->
orderKey.withExpression(
ExpressionUtils.replace(orderKey.getExpr(), replaceMap)))
.collect(ImmutableList.toImmutableList());
- newChildren.add(
- new LogicalTopN<>(orderKeys,
topN.getLimit() + topN.getOffset(), 0, child));
+ newChildren.add(new LogicalTopN<>(orderKeys,
topN.getLimit() + topN.getOffset(), 0,
+ PlanUtils.distinct(child)));
}
if (union.children().equals(newChildren)) {
return null;
}
return
topN.withChildren(agg.withChildren(union.withChildren(newChildren)));
})
- .toRule(RuleType.PUSH_DOWN_TOP_N_THROUGH_UNION)
+
.toRule(RuleType.PUSH_DOWN_TOP_N_DISTINCT_THROUGH_UNION)
);
}
}
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/nereids/util/PlanUtils.java
b/fe/fe-core/src/main/java/org/apache/doris/nereids/util/PlanUtils.java
index 94c0755642e..405d0282d8c 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/nereids/util/PlanUtils.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/util/PlanUtils.java
@@ -73,7 +73,11 @@ public class PlanUtils {
}
public static LogicalAggregate<Plan> distinct(Plan plan) {
- return new LogicalAggregate<>(ImmutableList.copyOf(plan.getOutput()),
false, plan);
+ if (plan instanceof LogicalAggregate && ((LogicalAggregate<?>)
plan).isDistinct()) {
+ return (LogicalAggregate<Plan>) plan;
+ } else {
+ return new
LogicalAggregate<>(ImmutableList.copyOf(plan.getOutput()), false, plan);
+ }
}
/**
diff --git
a/regression-test/data/nereids_rules_p0/push_down_top_n/push_down_top_n_distinct_through_union.out
b/regression-test/data/nereids_rules_p0/push_down_top_n/push_down_top_n_distinct_through_union.out
index 58dfe43639a..5874800e24f 100644
---
a/regression-test/data/nereids_rules_p0/push_down_top_n/push_down_top_n_distinct_through_union.out
+++
b/regression-test/data/nereids_rules_p0/push_down_top_n/push_down_top_n_distinct_through_union.out
@@ -6,8 +6,14 @@ PhysicalResultSink
------hashAgg[GLOBAL]
--------hashAgg[LOCAL]
----------PhysicalUnion
-------------PhysicalOlapScan[table2]
-------------PhysicalOlapScan[table2]
+------------PhysicalTopN[MERGE_SORT]
+--------------PhysicalTopN[LOCAL_SORT]
+----------------hashAgg[LOCAL]
+------------------PhysicalOlapScan[table2]
+------------PhysicalTopN[MERGE_SORT]
+--------------PhysicalTopN[LOCAL_SORT]
+----------------hashAgg[LOCAL]
+------------------PhysicalOlapScan[table2]
-- !push_down_topn_union_with_conditions --
PhysicalResultSink
@@ -16,12 +22,21 @@ PhysicalResultSink
------hashAgg[GLOBAL]
--------hashAgg[LOCAL]
----------PhysicalUnion
-------------filter((t1.score > 10))
---------------PhysicalOlapScan[table2]
-------------filter((t2.name = 'Test'))
---------------PhysicalOlapScan[table2]
-------------filter((t3.id < 5))
---------------PhysicalOlapScan[table2]
+------------PhysicalTopN[MERGE_SORT]
+--------------PhysicalTopN[LOCAL_SORT]
+----------------hashAgg[LOCAL]
+------------------filter((t1.score > 10))
+--------------------PhysicalOlapScan[table2]
+------------PhysicalTopN[MERGE_SORT]
+--------------PhysicalTopN[LOCAL_SORT]
+----------------hashAgg[LOCAL]
+------------------filter((t2.name = 'Test'))
+--------------------PhysicalOlapScan[table2]
+------------PhysicalTopN[MERGE_SORT]
+--------------PhysicalTopN[LOCAL_SORT]
+----------------hashAgg[LOCAL]
+------------------filter((t3.id < 5))
+--------------------PhysicalOlapScan[table2]
-- !push_down_topn_union_with_order_by --
PhysicalResultSink
@@ -30,9 +45,18 @@ PhysicalResultSink
------hashAgg[GLOBAL]
--------hashAgg[LOCAL]
----------PhysicalUnion
-------------PhysicalOlapScan[table2]
-------------PhysicalOlapScan[table2]
-------------PhysicalOlapScan[table2]
+------------PhysicalTopN[MERGE_SORT]
+--------------PhysicalTopN[LOCAL_SORT]
+----------------hashAgg[LOCAL]
+------------------PhysicalOlapScan[table2]
+------------PhysicalTopN[MERGE_SORT]
+--------------PhysicalTopN[LOCAL_SORT]
+----------------hashAgg[LOCAL]
+------------------PhysicalOlapScan[table2]
+------------PhysicalTopN[MERGE_SORT]
+--------------PhysicalTopN[LOCAL_SORT]
+----------------hashAgg[LOCAL]
+------------------PhysicalOlapScan[table2]
-- !push_down_topn_nested_union --
PhysicalResultSink
@@ -41,10 +65,22 @@ PhysicalResultSink
------hashAgg[GLOBAL]
--------hashAgg[LOCAL]
----------PhysicalUnion
-------------PhysicalOlapScan[table2]
-------------PhysicalOlapScan[table2]
-------------PhysicalOlapScan[table2]
-------------PhysicalOlapScan[table2]
+------------PhysicalTopN[MERGE_SORT]
+--------------PhysicalTopN[LOCAL_SORT]
+----------------hashAgg[LOCAL]
+------------------PhysicalOlapScan[table2]
+------------PhysicalTopN[MERGE_SORT]
+--------------PhysicalTopN[LOCAL_SORT]
+----------------hashAgg[LOCAL]
+------------------PhysicalOlapScan[table2]
+------------PhysicalTopN[MERGE_SORT]
+--------------PhysicalTopN[LOCAL_SORT]
+----------------hashAgg[LOCAL]
+------------------PhysicalOlapScan[table2]
+------------PhysicalTopN[MERGE_SORT]
+--------------PhysicalTopN[LOCAL_SORT]
+----------------hashAgg[LOCAL]
+------------------PhysicalOlapScan[table2]
-- !push_down_topn_union_after_join --
PhysicalResultSink
@@ -53,10 +89,16 @@ PhysicalResultSink
------hashAgg[GLOBAL]
--------hashAgg[LOCAL]
----------PhysicalUnion
-------------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id))
otherCondition=()
---------------PhysicalOlapScan[table2]
---------------PhysicalOlapScan[table2]
-------------PhysicalOlapScan[table2]
+------------PhysicalTopN[MERGE_SORT]
+--------------PhysicalTopN[LOCAL_SORT]
+----------------hashAgg[LOCAL]
+------------------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id))
otherCondition=()
+--------------------PhysicalOlapScan[table2]
+--------------------PhysicalOlapScan[table2]
+------------PhysicalTopN[MERGE_SORT]
+--------------PhysicalTopN[LOCAL_SORT]
+----------------hashAgg[LOCAL]
+------------------PhysicalOlapScan[table2]
-- !push_down_topn_union_different_projections --
PhysicalResultSink
@@ -65,8 +107,16 @@ PhysicalResultSink
------hashAgg[GLOBAL]
--------hashAgg[LOCAL]
----------PhysicalUnion
-------------PhysicalOlapScan[table2]
-------------PhysicalOlapScan[table2]
+------------PhysicalTopN[MERGE_SORT]
+--------------PhysicalTopN[LOCAL_SORT]
+----------------hashAgg[GLOBAL]
+------------------hashAgg[LOCAL]
+--------------------PhysicalOlapScan[table2]
+------------PhysicalTopN[MERGE_SORT]
+--------------PhysicalTopN[LOCAL_SORT]
+----------------hashAgg[GLOBAL]
+------------------hashAgg[LOCAL]
+--------------------PhysicalOlapScan[table2]
-- !push_down_topn_union_with_subquery --
PhysicalResultSink
@@ -75,9 +125,15 @@ PhysicalResultSink
------hashAgg[GLOBAL]
--------hashAgg[LOCAL]
----------PhysicalUnion
-------------filter((table2.score > 20))
---------------PhysicalOlapScan[table2]
-------------PhysicalOlapScan[table2]
+------------PhysicalTopN[MERGE_SORT]
+--------------PhysicalTopN[LOCAL_SORT]
+----------------hashAgg[LOCAL]
+------------------filter((table2.score > 20))
+--------------------PhysicalOlapScan[table2]
+------------PhysicalTopN[MERGE_SORT]
+--------------PhysicalTopN[LOCAL_SORT]
+----------------hashAgg[LOCAL]
+------------------PhysicalOlapScan[table2]
-- !push_down_topn_union_with_limit --
PhysicalResultSink
@@ -86,12 +142,20 @@ PhysicalResultSink
------hashAgg[GLOBAL]
--------hashAgg[LOCAL]
----------PhysicalUnion
-------------PhysicalLimit[GLOBAL]
---------------PhysicalLimit[LOCAL]
-----------------PhysicalOlapScan[table2]
-------------PhysicalLimit[GLOBAL]
---------------PhysicalLimit[LOCAL]
-----------------PhysicalOlapScan[table2]
+------------PhysicalTopN[MERGE_SORT]
+--------------PhysicalTopN[LOCAL_SORT]
+----------------hashAgg[GLOBAL]
+------------------hashAgg[LOCAL]
+--------------------PhysicalLimit[GLOBAL]
+----------------------PhysicalLimit[LOCAL]
+------------------------PhysicalOlapScan[table2]
+------------PhysicalTopN[MERGE_SORT]
+--------------PhysicalTopN[LOCAL_SORT]
+----------------hashAgg[GLOBAL]
+------------------hashAgg[LOCAL]
+--------------------PhysicalLimit[GLOBAL]
+----------------------PhysicalLimit[LOCAL]
+------------------------PhysicalOlapScan[table2]
-- !push_down_topn_union_complex_conditions --
PhysicalResultSink
@@ -100,8 +164,14 @@ PhysicalResultSink
------hashAgg[GLOBAL]
--------hashAgg[LOCAL]
----------PhysicalUnion
-------------filter((t1.name = 'Test') and (t1.score > 10))
---------------PhysicalOlapScan[table2]
-------------filter((t2.id < 5) and (t2.score < 20))
---------------PhysicalOlapScan[table2]
+------------PhysicalTopN[MERGE_SORT]
+--------------PhysicalTopN[LOCAL_SORT]
+----------------hashAgg[LOCAL]
+------------------filter((t1.name = 'Test') and (t1.score > 10))
+--------------------PhysicalOlapScan[table2]
+------------PhysicalTopN[MERGE_SORT]
+--------------PhysicalTopN[LOCAL_SORT]
+----------------hashAgg[LOCAL]
+------------------filter((t2.id < 5) and (t2.score < 20))
+--------------------PhysicalOlapScan[table2]
diff --git
a/regression-test/data/nereids_tpcds_shape_sf1000_p0/shape/query49.out
b/regression-test/data/nereids_tpcds_shape_sf1000_p0/shape/query49.out
index 6a040ee78b3..76b88bd85d5 100644
--- a/regression-test/data/nereids_tpcds_shape_sf1000_p0/shape/query49.out
+++ b/regression-test/data/nereids_tpcds_shape_sf1000_p0/shape/query49.out
@@ -9,81 +9,99 @@ PhysicalResultSink
------------hashAgg[LOCAL]
--------------PhysicalUnion
----------------PhysicalDistribute[DistributionSpecExecutionAny]
-------------------PhysicalProject
---------------------filter(((return_rank <= 10) OR (currency_rank <= 10)))
-----------------------PhysicalWindow
-------------------------PhysicalQuickSort[LOCAL_SORT]
---------------------------PhysicalWindow
-----------------------------PhysicalQuickSort[MERGE_SORT]
-------------------------------PhysicalDistribute[DistributionSpecGather]
---------------------------------PhysicalQuickSort[LOCAL_SORT]
-----------------------------------PhysicalProject
-------------------------------------hashAgg[GLOBAL]
---------------------------------------PhysicalDistribute[DistributionSpecHash]
-----------------------------------------hashAgg[LOCAL]
-------------------------------------------PhysicalProject
---------------------------------------------hashJoin[INNER_JOIN]
hashCondition=((ws.ws_item_sk = wr.wr_item_sk) and (ws.ws_order_number =
wr.wr_order_number)) otherCondition=() build RFs:RF1
ws_order_number->[wr_order_number];RF2 ws_item_sk->[wr_item_sk]
+------------------PhysicalTopN[MERGE_SORT]
+--------------------PhysicalDistribute[DistributionSpecGather]
+----------------------PhysicalTopN[LOCAL_SORT]
+------------------------hashAgg[GLOBAL]
+--------------------------PhysicalDistribute[DistributionSpecHash]
+----------------------------hashAgg[LOCAL]
+------------------------------PhysicalProject
+--------------------------------filter(((return_rank <= 10) OR (currency_rank
<= 10)))
+----------------------------------PhysicalWindow
+------------------------------------PhysicalQuickSort[LOCAL_SORT]
+--------------------------------------PhysicalWindow
+----------------------------------------PhysicalQuickSort[MERGE_SORT]
+------------------------------------------PhysicalDistribute[DistributionSpecGather]
+--------------------------------------------PhysicalQuickSort[LOCAL_SORT]
----------------------------------------------PhysicalProject
-------------------------------------------------filter((wr.wr_return_amt >
10000.00))
---------------------------------------------------PhysicalOlapScan[web_returns]
apply RFs: RF1 RF2
-----------------------------------------------hashJoin[INNER_JOIN]
hashCondition=((ws.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=()
build RFs:RF0 d_date_sk->[ws_sold_date_sk]
-------------------------------------------------PhysicalProject
---------------------------------------------------filter((ws.ws_net_paid >
0.00) and (ws.ws_net_profit > 1.00) and (ws.ws_quantity > 0))
-----------------------------------------------------PhysicalOlapScan[web_sales]
apply RFs: RF0
-------------------------------------------------PhysicalDistribute[DistributionSpecReplicated]
---------------------------------------------------PhysicalProject
-----------------------------------------------------filter((date_dim.d_moy =
11) and (date_dim.d_year = 1998))
-------------------------------------------------------PhysicalOlapScan[date_dim]
+------------------------------------------------hashAgg[GLOBAL]
+--------------------------------------------------PhysicalDistribute[DistributionSpecHash]
+----------------------------------------------------hashAgg[LOCAL]
+------------------------------------------------------PhysicalProject
+--------------------------------------------------------hashJoin[INNER_JOIN]
hashCondition=((ws.ws_item_sk = wr.wr_item_sk) and (ws.ws_order_number =
wr.wr_order_number)) otherCondition=() build RFs:RF1
ws_order_number->[wr_order_number];RF2 ws_item_sk->[wr_item_sk]
+----------------------------------------------------------PhysicalProject
+------------------------------------------------------------filter((wr.wr_return_amt
> 10000.00))
+--------------------------------------------------------------PhysicalOlapScan[web_returns]
apply RFs: RF1 RF2
+----------------------------------------------------------hashJoin[INNER_JOIN]
hashCondition=((ws.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=()
build RFs:RF0 d_date_sk->[ws_sold_date_sk]
+------------------------------------------------------------PhysicalProject
+--------------------------------------------------------------filter((ws.ws_net_paid
> 0.00) and (ws.ws_net_profit > 1.00) and (ws.ws_quantity > 0))
+----------------------------------------------------------------PhysicalOlapScan[web_sales]
apply RFs: RF0
+------------------------------------------------------------PhysicalDistribute[DistributionSpecReplicated]
+--------------------------------------------------------------PhysicalProject
+----------------------------------------------------------------filter((date_dim.d_moy
= 11) and (date_dim.d_year = 1998))
+------------------------------------------------------------------PhysicalOlapScan[date_dim]
----------------PhysicalDistribute[DistributionSpecExecutionAny]
-------------------PhysicalProject
---------------------filter(((return_rank <= 10) OR (currency_rank <= 10)))
-----------------------PhysicalWindow
-------------------------PhysicalQuickSort[LOCAL_SORT]
---------------------------PhysicalWindow
-----------------------------PhysicalQuickSort[MERGE_SORT]
-------------------------------PhysicalDistribute[DistributionSpecGather]
---------------------------------PhysicalQuickSort[LOCAL_SORT]
-----------------------------------PhysicalProject
-------------------------------------hashAgg[GLOBAL]
---------------------------------------PhysicalDistribute[DistributionSpecHash]
-----------------------------------------hashAgg[LOCAL]
-------------------------------------------PhysicalProject
---------------------------------------------hashJoin[INNER_JOIN]
hashCondition=((cs.cs_item_sk = cr.cr_item_sk) and (cs.cs_order_number =
cr.cr_order_number)) otherCondition=() build RFs:RF4
cs_order_number->[cr_order_number];RF5 cs_item_sk->[cr_item_sk]
+------------------PhysicalTopN[MERGE_SORT]
+--------------------PhysicalDistribute[DistributionSpecGather]
+----------------------PhysicalTopN[LOCAL_SORT]
+------------------------hashAgg[GLOBAL]
+--------------------------PhysicalDistribute[DistributionSpecHash]
+----------------------------hashAgg[LOCAL]
+------------------------------PhysicalProject
+--------------------------------filter(((return_rank <= 10) OR (currency_rank
<= 10)))
+----------------------------------PhysicalWindow
+------------------------------------PhysicalQuickSort[LOCAL_SORT]
+--------------------------------------PhysicalWindow
+----------------------------------------PhysicalQuickSort[MERGE_SORT]
+------------------------------------------PhysicalDistribute[DistributionSpecGather]
+--------------------------------------------PhysicalQuickSort[LOCAL_SORT]
----------------------------------------------PhysicalProject
-------------------------------------------------filter((cr.cr_return_amount >
10000.00))
---------------------------------------------------PhysicalOlapScan[catalog_returns]
apply RFs: RF4 RF5
-----------------------------------------------hashJoin[INNER_JOIN]
hashCondition=((cs.cs_sold_date_sk = date_dim.d_date_sk)) otherCondition=()
build RFs:RF3 d_date_sk->[cs_sold_date_sk]
-------------------------------------------------PhysicalProject
---------------------------------------------------filter((cs.cs_net_paid >
0.00) and (cs.cs_net_profit > 1.00) and (cs.cs_quantity > 0))
-----------------------------------------------------PhysicalOlapScan[catalog_sales]
apply RFs: RF3
-------------------------------------------------PhysicalDistribute[DistributionSpecReplicated]
---------------------------------------------------PhysicalProject
-----------------------------------------------------filter((date_dim.d_moy =
11) and (date_dim.d_year = 1998))
-------------------------------------------------------PhysicalOlapScan[date_dim]
+------------------------------------------------hashAgg[GLOBAL]
+--------------------------------------------------PhysicalDistribute[DistributionSpecHash]
+----------------------------------------------------hashAgg[LOCAL]
+------------------------------------------------------PhysicalProject
+--------------------------------------------------------hashJoin[INNER_JOIN]
hashCondition=((cs.cs_item_sk = cr.cr_item_sk) and (cs.cs_order_number =
cr.cr_order_number)) otherCondition=() build RFs:RF4
cs_order_number->[cr_order_number];RF5 cs_item_sk->[cr_item_sk]
+----------------------------------------------------------PhysicalProject
+------------------------------------------------------------filter((cr.cr_return_amount
> 10000.00))
+--------------------------------------------------------------PhysicalOlapScan[catalog_returns]
apply RFs: RF4 RF5
+----------------------------------------------------------hashJoin[INNER_JOIN]
hashCondition=((cs.cs_sold_date_sk = date_dim.d_date_sk)) otherCondition=()
build RFs:RF3 d_date_sk->[cs_sold_date_sk]
+------------------------------------------------------------PhysicalProject
+--------------------------------------------------------------filter((cs.cs_net_paid
> 0.00) and (cs.cs_net_profit > 1.00) and (cs.cs_quantity > 0))
+----------------------------------------------------------------PhysicalOlapScan[catalog_sales]
apply RFs: RF3
+------------------------------------------------------------PhysicalDistribute[DistributionSpecReplicated]
+--------------------------------------------------------------PhysicalProject
+----------------------------------------------------------------filter((date_dim.d_moy
= 11) and (date_dim.d_year = 1998))
+------------------------------------------------------------------PhysicalOlapScan[date_dim]
----------------PhysicalDistribute[DistributionSpecExecutionAny]
-------------------PhysicalProject
---------------------filter(((return_rank <= 10) OR (currency_rank <= 10)))
-----------------------PhysicalWindow
-------------------------PhysicalQuickSort[LOCAL_SORT]
---------------------------PhysicalWindow
-----------------------------PhysicalQuickSort[MERGE_SORT]
-------------------------------PhysicalDistribute[DistributionSpecGather]
---------------------------------PhysicalQuickSort[LOCAL_SORT]
-----------------------------------PhysicalProject
-------------------------------------hashAgg[GLOBAL]
---------------------------------------PhysicalDistribute[DistributionSpecHash]
-----------------------------------------hashAgg[LOCAL]
-------------------------------------------PhysicalProject
---------------------------------------------hashJoin[INNER_JOIN]
hashCondition=((sts.ss_item_sk = sr.sr_item_sk) and (sts.ss_ticket_number =
sr.sr_ticket_number)) otherCondition=() build RFs:RF7
ss_ticket_number->[sr_ticket_number];RF8 ss_item_sk->[sr_item_sk]
+------------------PhysicalTopN[MERGE_SORT]
+--------------------PhysicalDistribute[DistributionSpecGather]
+----------------------PhysicalTopN[LOCAL_SORT]
+------------------------hashAgg[GLOBAL]
+--------------------------PhysicalDistribute[DistributionSpecHash]
+----------------------------hashAgg[LOCAL]
+------------------------------PhysicalProject
+--------------------------------filter(((return_rank <= 10) OR (currency_rank
<= 10)))
+----------------------------------PhysicalWindow
+------------------------------------PhysicalQuickSort[LOCAL_SORT]
+--------------------------------------PhysicalWindow
+----------------------------------------PhysicalQuickSort[MERGE_SORT]
+------------------------------------------PhysicalDistribute[DistributionSpecGather]
+--------------------------------------------PhysicalQuickSort[LOCAL_SORT]
----------------------------------------------PhysicalProject
-------------------------------------------------filter((sr.sr_return_amt >
10000.00))
---------------------------------------------------PhysicalOlapScan[store_returns]
apply RFs: RF7 RF8
-----------------------------------------------hashJoin[INNER_JOIN]
hashCondition=((sts.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=()
build RFs:RF6 d_date_sk->[ss_sold_date_sk]
-------------------------------------------------PhysicalProject
---------------------------------------------------filter((sts.ss_net_paid >
0.00) and (sts.ss_net_profit > 1.00) and (sts.ss_quantity > 0))
-----------------------------------------------------PhysicalOlapScan[store_sales]
apply RFs: RF6
-------------------------------------------------PhysicalDistribute[DistributionSpecReplicated]
---------------------------------------------------PhysicalProject
-----------------------------------------------------filter((date_dim.d_moy =
11) and (date_dim.d_year = 1998))
-------------------------------------------------------PhysicalOlapScan[date_dim]
+------------------------------------------------hashAgg[GLOBAL]
+--------------------------------------------------PhysicalDistribute[DistributionSpecHash]
+----------------------------------------------------hashAgg[LOCAL]
+------------------------------------------------------PhysicalProject
+--------------------------------------------------------hashJoin[INNER_JOIN]
hashCondition=((sts.ss_item_sk = sr.sr_item_sk) and (sts.ss_ticket_number =
sr.sr_ticket_number)) otherCondition=() build RFs:RF7
ss_ticket_number->[sr_ticket_number];RF8 ss_item_sk->[sr_item_sk]
+----------------------------------------------------------PhysicalProject
+------------------------------------------------------------filter((sr.sr_return_amt
> 10000.00))
+--------------------------------------------------------------PhysicalOlapScan[store_returns]
apply RFs: RF7 RF8
+----------------------------------------------------------hashJoin[INNER_JOIN]
hashCondition=((sts.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=()
build RFs:RF6 d_date_sk->[ss_sold_date_sk]
+------------------------------------------------------------PhysicalProject
+--------------------------------------------------------------filter((sts.ss_net_paid
> 0.00) and (sts.ss_net_profit > 1.00) and (sts.ss_quantity > 0))
+----------------------------------------------------------------PhysicalOlapScan[store_sales]
apply RFs: RF6
+------------------------------------------------------------PhysicalDistribute[DistributionSpecReplicated]
+--------------------------------------------------------------PhysicalProject
+----------------------------------------------------------------filter((date_dim.d_moy
= 11) and (date_dim.d_year = 1998))
+------------------------------------------------------------------PhysicalOlapScan[date_dim]
diff --git
a/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query49.out
b/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query49.out
index 402043b9cda..4edce3d0ff6 100644
---
a/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query49.out
+++
b/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query49.out
@@ -9,84 +9,102 @@ PhysicalResultSink
------------hashAgg[LOCAL]
--------------PhysicalUnion
----------------PhysicalDistribute[DistributionSpecExecutionAny]
-------------------PhysicalProject
---------------------filter(((return_rank <= 10) OR (currency_rank <= 10)))
-----------------------PhysicalWindow
-------------------------PhysicalQuickSort[LOCAL_SORT]
---------------------------PhysicalWindow
-----------------------------PhysicalQuickSort[MERGE_SORT]
-------------------------------PhysicalDistribute[DistributionSpecGather]
---------------------------------PhysicalQuickSort[LOCAL_SORT]
-----------------------------------PhysicalProject
-------------------------------------hashAgg[GLOBAL]
---------------------------------------PhysicalDistribute[DistributionSpecHash]
-----------------------------------------hashAgg[LOCAL]
-------------------------------------------PhysicalProject
---------------------------------------------hashJoin[INNER_JOIN]
hashCondition=((ws.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=()
build RFs:RF2 d_date_sk->[ws_sold_date_sk]
+------------------PhysicalTopN[MERGE_SORT]
+--------------------PhysicalDistribute[DistributionSpecGather]
+----------------------PhysicalTopN[LOCAL_SORT]
+------------------------hashAgg[GLOBAL]
+--------------------------PhysicalDistribute[DistributionSpecHash]
+----------------------------hashAgg[LOCAL]
+------------------------------PhysicalProject
+--------------------------------filter(((return_rank <= 10) OR (currency_rank
<= 10)))
+----------------------------------PhysicalWindow
+------------------------------------PhysicalQuickSort[LOCAL_SORT]
+--------------------------------------PhysicalWindow
+----------------------------------------PhysicalQuickSort[MERGE_SORT]
+------------------------------------------PhysicalDistribute[DistributionSpecGather]
+--------------------------------------------PhysicalQuickSort[LOCAL_SORT]
----------------------------------------------PhysicalProject
-------------------------------------------------hashJoin[INNER_JOIN]
hashCondition=((ws.ws_item_sk = wr.wr_item_sk) and (ws.ws_order_number =
wr.wr_order_number)) otherCondition=() build RFs:RF0
wr_order_number->[ws_order_number];RF1 wr_item_sk->[ws_item_sk]
---------------------------------------------------PhysicalProject
-----------------------------------------------------filter((ws.ws_net_paid >
0.00) and (ws.ws_net_profit > 1.00) and (ws.ws_quantity > 0))
-------------------------------------------------------PhysicalOlapScan[web_sales]
apply RFs: RF0 RF1 RF2
---------------------------------------------------PhysicalProject
-----------------------------------------------------filter((wr.wr_return_amt >
10000.00))
-------------------------------------------------------PhysicalOlapScan[web_returns]
-----------------------------------------------PhysicalDistribute[DistributionSpecReplicated]
-------------------------------------------------PhysicalProject
---------------------------------------------------filter((date_dim.d_moy = 12)
and (date_dim.d_year = 1999))
-----------------------------------------------------PhysicalOlapScan[date_dim]
+------------------------------------------------hashAgg[GLOBAL]
+--------------------------------------------------PhysicalDistribute[DistributionSpecHash]
+----------------------------------------------------hashAgg[LOCAL]
+------------------------------------------------------PhysicalProject
+--------------------------------------------------------hashJoin[INNER_JOIN]
hashCondition=((ws.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=()
build RFs:RF2 d_date_sk->[ws_sold_date_sk]
+----------------------------------------------------------PhysicalProject
+------------------------------------------------------------hashJoin[INNER_JOIN]
hashCondition=((ws.ws_item_sk = wr.wr_item_sk) and (ws.ws_order_number =
wr.wr_order_number)) otherCondition=() build RFs:RF0
wr_order_number->[ws_order_number];RF1 wr_item_sk->[ws_item_sk]
+--------------------------------------------------------------PhysicalProject
+----------------------------------------------------------------filter((ws.ws_net_paid
> 0.00) and (ws.ws_net_profit > 1.00) and (ws.ws_quantity > 0))
+------------------------------------------------------------------PhysicalOlapScan[web_sales]
apply RFs: RF0 RF1 RF2
+--------------------------------------------------------------PhysicalProject
+----------------------------------------------------------------filter((wr.wr_return_amt
> 10000.00))
+------------------------------------------------------------------PhysicalOlapScan[web_returns]
+----------------------------------------------------------PhysicalDistribute[DistributionSpecReplicated]
+------------------------------------------------------------PhysicalProject
+--------------------------------------------------------------filter((date_dim.d_moy
= 12) and (date_dim.d_year = 1999))
+----------------------------------------------------------------PhysicalOlapScan[date_dim]
----------------PhysicalDistribute[DistributionSpecExecutionAny]
-------------------PhysicalProject
---------------------filter(((return_rank <= 10) OR (currency_rank <= 10)))
-----------------------PhysicalWindow
-------------------------PhysicalQuickSort[LOCAL_SORT]
---------------------------PhysicalWindow
-----------------------------PhysicalQuickSort[MERGE_SORT]
-------------------------------PhysicalDistribute[DistributionSpecGather]
---------------------------------PhysicalQuickSort[LOCAL_SORT]
-----------------------------------PhysicalProject
-------------------------------------hashAgg[GLOBAL]
---------------------------------------PhysicalDistribute[DistributionSpecHash]
-----------------------------------------hashAgg[LOCAL]
-------------------------------------------PhysicalProject
---------------------------------------------hashJoin[INNER_JOIN]
hashCondition=((cs.cs_sold_date_sk = date_dim.d_date_sk)) otherCondition=()
build RFs:RF5 d_date_sk->[cs_sold_date_sk]
+------------------PhysicalTopN[MERGE_SORT]
+--------------------PhysicalDistribute[DistributionSpecGather]
+----------------------PhysicalTopN[LOCAL_SORT]
+------------------------hashAgg[GLOBAL]
+--------------------------PhysicalDistribute[DistributionSpecHash]
+----------------------------hashAgg[LOCAL]
+------------------------------PhysicalProject
+--------------------------------filter(((return_rank <= 10) OR (currency_rank
<= 10)))
+----------------------------------PhysicalWindow
+------------------------------------PhysicalQuickSort[LOCAL_SORT]
+--------------------------------------PhysicalWindow
+----------------------------------------PhysicalQuickSort[MERGE_SORT]
+------------------------------------------PhysicalDistribute[DistributionSpecGather]
+--------------------------------------------PhysicalQuickSort[LOCAL_SORT]
----------------------------------------------PhysicalProject
-------------------------------------------------hashJoin[INNER_JOIN]
hashCondition=((cs.cs_item_sk = cr.cr_item_sk) and (cs.cs_order_number =
cr.cr_order_number)) otherCondition=() build RFs:RF3
cr_order_number->[cs_order_number];RF4 cr_item_sk->[cs_item_sk]
---------------------------------------------------PhysicalProject
-----------------------------------------------------filter((cs.cs_net_paid >
0.00) and (cs.cs_net_profit > 1.00) and (cs.cs_quantity > 0))
-------------------------------------------------------PhysicalOlapScan[catalog_sales]
apply RFs: RF3 RF4 RF5
---------------------------------------------------PhysicalProject
-----------------------------------------------------filter((cr.cr_return_amount
> 10000.00))
-------------------------------------------------------PhysicalOlapScan[catalog_returns]
-----------------------------------------------PhysicalDistribute[DistributionSpecReplicated]
-------------------------------------------------PhysicalProject
---------------------------------------------------filter((date_dim.d_moy = 12)
and (date_dim.d_year = 1999))
-----------------------------------------------------PhysicalOlapScan[date_dim]
+------------------------------------------------hashAgg[GLOBAL]
+--------------------------------------------------PhysicalDistribute[DistributionSpecHash]
+----------------------------------------------------hashAgg[LOCAL]
+------------------------------------------------------PhysicalProject
+--------------------------------------------------------hashJoin[INNER_JOIN]
hashCondition=((cs.cs_sold_date_sk = date_dim.d_date_sk)) otherCondition=()
build RFs:RF5 d_date_sk->[cs_sold_date_sk]
+----------------------------------------------------------PhysicalProject
+------------------------------------------------------------hashJoin[INNER_JOIN]
hashCondition=((cs.cs_item_sk = cr.cr_item_sk) and (cs.cs_order_number =
cr.cr_order_number)) otherCondition=() build RFs:RF3
cr_order_number->[cs_order_number];RF4 cr_item_sk->[cs_item_sk]
+--------------------------------------------------------------PhysicalProject
+----------------------------------------------------------------filter((cs.cs_net_paid
> 0.00) and (cs.cs_net_profit > 1.00) and (cs.cs_quantity > 0))
+------------------------------------------------------------------PhysicalOlapScan[catalog_sales]
apply RFs: RF3 RF4 RF5
+--------------------------------------------------------------PhysicalProject
+----------------------------------------------------------------filter((cr.cr_return_amount
> 10000.00))
+------------------------------------------------------------------PhysicalOlapScan[catalog_returns]
+----------------------------------------------------------PhysicalDistribute[DistributionSpecReplicated]
+------------------------------------------------------------PhysicalProject
+--------------------------------------------------------------filter((date_dim.d_moy
= 12) and (date_dim.d_year = 1999))
+----------------------------------------------------------------PhysicalOlapScan[date_dim]
----------------PhysicalDistribute[DistributionSpecExecutionAny]
-------------------PhysicalProject
---------------------filter(((return_rank <= 10) OR (currency_rank <= 10)))
-----------------------PhysicalWindow
-------------------------PhysicalQuickSort[LOCAL_SORT]
---------------------------PhysicalWindow
-----------------------------PhysicalQuickSort[MERGE_SORT]
-------------------------------PhysicalDistribute[DistributionSpecGather]
---------------------------------PhysicalQuickSort[LOCAL_SORT]
-----------------------------------PhysicalProject
-------------------------------------hashAgg[GLOBAL]
---------------------------------------PhysicalDistribute[DistributionSpecHash]
-----------------------------------------hashAgg[LOCAL]
-------------------------------------------PhysicalProject
---------------------------------------------hashJoin[INNER_JOIN]
hashCondition=((sts.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=()
build RFs:RF8 d_date_sk->[ss_sold_date_sk]
+------------------PhysicalTopN[MERGE_SORT]
+--------------------PhysicalDistribute[DistributionSpecGather]
+----------------------PhysicalTopN[LOCAL_SORT]
+------------------------hashAgg[GLOBAL]
+--------------------------PhysicalDistribute[DistributionSpecHash]
+----------------------------hashAgg[LOCAL]
+------------------------------PhysicalProject
+--------------------------------filter(((return_rank <= 10) OR (currency_rank
<= 10)))
+----------------------------------PhysicalWindow
+------------------------------------PhysicalQuickSort[LOCAL_SORT]
+--------------------------------------PhysicalWindow
+----------------------------------------PhysicalQuickSort[MERGE_SORT]
+------------------------------------------PhysicalDistribute[DistributionSpecGather]
+--------------------------------------------PhysicalQuickSort[LOCAL_SORT]
----------------------------------------------PhysicalProject
-------------------------------------------------hashJoin[INNER_JOIN]
hashCondition=((sts.ss_item_sk = sr.sr_item_sk) and (sts.ss_ticket_number =
sr.sr_ticket_number)) otherCondition=() build RFs:RF6
sr_ticket_number->[ss_ticket_number];RF7 sr_item_sk->[ss_item_sk]
---------------------------------------------------PhysicalProject
-----------------------------------------------------filter((sts.ss_net_paid >
0.00) and (sts.ss_net_profit > 1.00) and (sts.ss_quantity > 0))
-------------------------------------------------------PhysicalOlapScan[store_sales]
apply RFs: RF6 RF7 RF8
---------------------------------------------------PhysicalProject
-----------------------------------------------------filter((sr.sr_return_amt >
10000.00))
-------------------------------------------------------PhysicalOlapScan[store_returns]
-----------------------------------------------PhysicalDistribute[DistributionSpecReplicated]
-------------------------------------------------PhysicalProject
---------------------------------------------------filter((date_dim.d_moy = 12)
and (date_dim.d_year = 1999))
-----------------------------------------------------PhysicalOlapScan[date_dim]
+------------------------------------------------hashAgg[GLOBAL]
+--------------------------------------------------PhysicalDistribute[DistributionSpecHash]
+----------------------------------------------------hashAgg[LOCAL]
+------------------------------------------------------PhysicalProject
+--------------------------------------------------------hashJoin[INNER_JOIN]
hashCondition=((sts.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=()
build RFs:RF8 d_date_sk->[ss_sold_date_sk]
+----------------------------------------------------------PhysicalProject
+------------------------------------------------------------hashJoin[INNER_JOIN]
hashCondition=((sts.ss_item_sk = sr.sr_item_sk) and (sts.ss_ticket_number =
sr.sr_ticket_number)) otherCondition=() build RFs:RF6
sr_ticket_number->[ss_ticket_number];RF7 sr_item_sk->[ss_item_sk]
+--------------------------------------------------------------PhysicalProject
+----------------------------------------------------------------filter((sts.ss_net_paid
> 0.00) and (sts.ss_net_profit > 1.00) and (sts.ss_quantity > 0))
+------------------------------------------------------------------PhysicalOlapScan[store_sales]
apply RFs: RF6 RF7 RF8
+--------------------------------------------------------------PhysicalProject
+----------------------------------------------------------------filter((sr.sr_return_amt
> 10000.00))
+------------------------------------------------------------------PhysicalOlapScan[store_returns]
+----------------------------------------------------------PhysicalDistribute[DistributionSpecReplicated]
+------------------------------------------------------------PhysicalProject
+--------------------------------------------------------------filter((date_dim.d_moy
= 12) and (date_dim.d_year = 1999))
+----------------------------------------------------------------PhysicalOlapScan[date_dim]
diff --git
a/regression-test/data/nereids_tpcds_shape_sf100_p0/no_stats_shape/query49.out
b/regression-test/data/nereids_tpcds_shape_sf100_p0/no_stats_shape/query49.out
index 402043b9cda..4edce3d0ff6 100644
---
a/regression-test/data/nereids_tpcds_shape_sf100_p0/no_stats_shape/query49.out
+++
b/regression-test/data/nereids_tpcds_shape_sf100_p0/no_stats_shape/query49.out
@@ -9,84 +9,102 @@ PhysicalResultSink
------------hashAgg[LOCAL]
--------------PhysicalUnion
----------------PhysicalDistribute[DistributionSpecExecutionAny]
-------------------PhysicalProject
---------------------filter(((return_rank <= 10) OR (currency_rank <= 10)))
-----------------------PhysicalWindow
-------------------------PhysicalQuickSort[LOCAL_SORT]
---------------------------PhysicalWindow
-----------------------------PhysicalQuickSort[MERGE_SORT]
-------------------------------PhysicalDistribute[DistributionSpecGather]
---------------------------------PhysicalQuickSort[LOCAL_SORT]
-----------------------------------PhysicalProject
-------------------------------------hashAgg[GLOBAL]
---------------------------------------PhysicalDistribute[DistributionSpecHash]
-----------------------------------------hashAgg[LOCAL]
-------------------------------------------PhysicalProject
---------------------------------------------hashJoin[INNER_JOIN]
hashCondition=((ws.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=()
build RFs:RF2 d_date_sk->[ws_sold_date_sk]
+------------------PhysicalTopN[MERGE_SORT]
+--------------------PhysicalDistribute[DistributionSpecGather]
+----------------------PhysicalTopN[LOCAL_SORT]
+------------------------hashAgg[GLOBAL]
+--------------------------PhysicalDistribute[DistributionSpecHash]
+----------------------------hashAgg[LOCAL]
+------------------------------PhysicalProject
+--------------------------------filter(((return_rank <= 10) OR (currency_rank
<= 10)))
+----------------------------------PhysicalWindow
+------------------------------------PhysicalQuickSort[LOCAL_SORT]
+--------------------------------------PhysicalWindow
+----------------------------------------PhysicalQuickSort[MERGE_SORT]
+------------------------------------------PhysicalDistribute[DistributionSpecGather]
+--------------------------------------------PhysicalQuickSort[LOCAL_SORT]
----------------------------------------------PhysicalProject
-------------------------------------------------hashJoin[INNER_JOIN]
hashCondition=((ws.ws_item_sk = wr.wr_item_sk) and (ws.ws_order_number =
wr.wr_order_number)) otherCondition=() build RFs:RF0
wr_order_number->[ws_order_number];RF1 wr_item_sk->[ws_item_sk]
---------------------------------------------------PhysicalProject
-----------------------------------------------------filter((ws.ws_net_paid >
0.00) and (ws.ws_net_profit > 1.00) and (ws.ws_quantity > 0))
-------------------------------------------------------PhysicalOlapScan[web_sales]
apply RFs: RF0 RF1 RF2
---------------------------------------------------PhysicalProject
-----------------------------------------------------filter((wr.wr_return_amt >
10000.00))
-------------------------------------------------------PhysicalOlapScan[web_returns]
-----------------------------------------------PhysicalDistribute[DistributionSpecReplicated]
-------------------------------------------------PhysicalProject
---------------------------------------------------filter((date_dim.d_moy = 12)
and (date_dim.d_year = 1999))
-----------------------------------------------------PhysicalOlapScan[date_dim]
+------------------------------------------------hashAgg[GLOBAL]
+--------------------------------------------------PhysicalDistribute[DistributionSpecHash]
+----------------------------------------------------hashAgg[LOCAL]
+------------------------------------------------------PhysicalProject
+--------------------------------------------------------hashJoin[INNER_JOIN]
hashCondition=((ws.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=()
build RFs:RF2 d_date_sk->[ws_sold_date_sk]
+----------------------------------------------------------PhysicalProject
+------------------------------------------------------------hashJoin[INNER_JOIN]
hashCondition=((ws.ws_item_sk = wr.wr_item_sk) and (ws.ws_order_number =
wr.wr_order_number)) otherCondition=() build RFs:RF0
wr_order_number->[ws_order_number];RF1 wr_item_sk->[ws_item_sk]
+--------------------------------------------------------------PhysicalProject
+----------------------------------------------------------------filter((ws.ws_net_paid
> 0.00) and (ws.ws_net_profit > 1.00) and (ws.ws_quantity > 0))
+------------------------------------------------------------------PhysicalOlapScan[web_sales]
apply RFs: RF0 RF1 RF2
+--------------------------------------------------------------PhysicalProject
+----------------------------------------------------------------filter((wr.wr_return_amt
> 10000.00))
+------------------------------------------------------------------PhysicalOlapScan[web_returns]
+----------------------------------------------------------PhysicalDistribute[DistributionSpecReplicated]
+------------------------------------------------------------PhysicalProject
+--------------------------------------------------------------filter((date_dim.d_moy
= 12) and (date_dim.d_year = 1999))
+----------------------------------------------------------------PhysicalOlapScan[date_dim]
----------------PhysicalDistribute[DistributionSpecExecutionAny]
-------------------PhysicalProject
---------------------filter(((return_rank <= 10) OR (currency_rank <= 10)))
-----------------------PhysicalWindow
-------------------------PhysicalQuickSort[LOCAL_SORT]
---------------------------PhysicalWindow
-----------------------------PhysicalQuickSort[MERGE_SORT]
-------------------------------PhysicalDistribute[DistributionSpecGather]
---------------------------------PhysicalQuickSort[LOCAL_SORT]
-----------------------------------PhysicalProject
-------------------------------------hashAgg[GLOBAL]
---------------------------------------PhysicalDistribute[DistributionSpecHash]
-----------------------------------------hashAgg[LOCAL]
-------------------------------------------PhysicalProject
---------------------------------------------hashJoin[INNER_JOIN]
hashCondition=((cs.cs_sold_date_sk = date_dim.d_date_sk)) otherCondition=()
build RFs:RF5 d_date_sk->[cs_sold_date_sk]
+------------------PhysicalTopN[MERGE_SORT]
+--------------------PhysicalDistribute[DistributionSpecGather]
+----------------------PhysicalTopN[LOCAL_SORT]
+------------------------hashAgg[GLOBAL]
+--------------------------PhysicalDistribute[DistributionSpecHash]
+----------------------------hashAgg[LOCAL]
+------------------------------PhysicalProject
+--------------------------------filter(((return_rank <= 10) OR (currency_rank
<= 10)))
+----------------------------------PhysicalWindow
+------------------------------------PhysicalQuickSort[LOCAL_SORT]
+--------------------------------------PhysicalWindow
+----------------------------------------PhysicalQuickSort[MERGE_SORT]
+------------------------------------------PhysicalDistribute[DistributionSpecGather]
+--------------------------------------------PhysicalQuickSort[LOCAL_SORT]
----------------------------------------------PhysicalProject
-------------------------------------------------hashJoin[INNER_JOIN]
hashCondition=((cs.cs_item_sk = cr.cr_item_sk) and (cs.cs_order_number =
cr.cr_order_number)) otherCondition=() build RFs:RF3
cr_order_number->[cs_order_number];RF4 cr_item_sk->[cs_item_sk]
---------------------------------------------------PhysicalProject
-----------------------------------------------------filter((cs.cs_net_paid >
0.00) and (cs.cs_net_profit > 1.00) and (cs.cs_quantity > 0))
-------------------------------------------------------PhysicalOlapScan[catalog_sales]
apply RFs: RF3 RF4 RF5
---------------------------------------------------PhysicalProject
-----------------------------------------------------filter((cr.cr_return_amount
> 10000.00))
-------------------------------------------------------PhysicalOlapScan[catalog_returns]
-----------------------------------------------PhysicalDistribute[DistributionSpecReplicated]
-------------------------------------------------PhysicalProject
---------------------------------------------------filter((date_dim.d_moy = 12)
and (date_dim.d_year = 1999))
-----------------------------------------------------PhysicalOlapScan[date_dim]
+------------------------------------------------hashAgg[GLOBAL]
+--------------------------------------------------PhysicalDistribute[DistributionSpecHash]
+----------------------------------------------------hashAgg[LOCAL]
+------------------------------------------------------PhysicalProject
+--------------------------------------------------------hashJoin[INNER_JOIN]
hashCondition=((cs.cs_sold_date_sk = date_dim.d_date_sk)) otherCondition=()
build RFs:RF5 d_date_sk->[cs_sold_date_sk]
+----------------------------------------------------------PhysicalProject
+------------------------------------------------------------hashJoin[INNER_JOIN]
hashCondition=((cs.cs_item_sk = cr.cr_item_sk) and (cs.cs_order_number =
cr.cr_order_number)) otherCondition=() build RFs:RF3
cr_order_number->[cs_order_number];RF4 cr_item_sk->[cs_item_sk]
+--------------------------------------------------------------PhysicalProject
+----------------------------------------------------------------filter((cs.cs_net_paid
> 0.00) and (cs.cs_net_profit > 1.00) and (cs.cs_quantity > 0))
+------------------------------------------------------------------PhysicalOlapScan[catalog_sales]
apply RFs: RF3 RF4 RF5
+--------------------------------------------------------------PhysicalProject
+----------------------------------------------------------------filter((cr.cr_return_amount
> 10000.00))
+------------------------------------------------------------------PhysicalOlapScan[catalog_returns]
+----------------------------------------------------------PhysicalDistribute[DistributionSpecReplicated]
+------------------------------------------------------------PhysicalProject
+--------------------------------------------------------------filter((date_dim.d_moy
= 12) and (date_dim.d_year = 1999))
+----------------------------------------------------------------PhysicalOlapScan[date_dim]
----------------PhysicalDistribute[DistributionSpecExecutionAny]
-------------------PhysicalProject
---------------------filter(((return_rank <= 10) OR (currency_rank <= 10)))
-----------------------PhysicalWindow
-------------------------PhysicalQuickSort[LOCAL_SORT]
---------------------------PhysicalWindow
-----------------------------PhysicalQuickSort[MERGE_SORT]
-------------------------------PhysicalDistribute[DistributionSpecGather]
---------------------------------PhysicalQuickSort[LOCAL_SORT]
-----------------------------------PhysicalProject
-------------------------------------hashAgg[GLOBAL]
---------------------------------------PhysicalDistribute[DistributionSpecHash]
-----------------------------------------hashAgg[LOCAL]
-------------------------------------------PhysicalProject
---------------------------------------------hashJoin[INNER_JOIN]
hashCondition=((sts.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=()
build RFs:RF8 d_date_sk->[ss_sold_date_sk]
+------------------PhysicalTopN[MERGE_SORT]
+--------------------PhysicalDistribute[DistributionSpecGather]
+----------------------PhysicalTopN[LOCAL_SORT]
+------------------------hashAgg[GLOBAL]
+--------------------------PhysicalDistribute[DistributionSpecHash]
+----------------------------hashAgg[LOCAL]
+------------------------------PhysicalProject
+--------------------------------filter(((return_rank <= 10) OR (currency_rank
<= 10)))
+----------------------------------PhysicalWindow
+------------------------------------PhysicalQuickSort[LOCAL_SORT]
+--------------------------------------PhysicalWindow
+----------------------------------------PhysicalQuickSort[MERGE_SORT]
+------------------------------------------PhysicalDistribute[DistributionSpecGather]
+--------------------------------------------PhysicalQuickSort[LOCAL_SORT]
----------------------------------------------PhysicalProject
-------------------------------------------------hashJoin[INNER_JOIN]
hashCondition=((sts.ss_item_sk = sr.sr_item_sk) and (sts.ss_ticket_number =
sr.sr_ticket_number)) otherCondition=() build RFs:RF6
sr_ticket_number->[ss_ticket_number];RF7 sr_item_sk->[ss_item_sk]
---------------------------------------------------PhysicalProject
-----------------------------------------------------filter((sts.ss_net_paid >
0.00) and (sts.ss_net_profit > 1.00) and (sts.ss_quantity > 0))
-------------------------------------------------------PhysicalOlapScan[store_sales]
apply RFs: RF6 RF7 RF8
---------------------------------------------------PhysicalProject
-----------------------------------------------------filter((sr.sr_return_amt >
10000.00))
-------------------------------------------------------PhysicalOlapScan[store_returns]
-----------------------------------------------PhysicalDistribute[DistributionSpecReplicated]
-------------------------------------------------PhysicalProject
---------------------------------------------------filter((date_dim.d_moy = 12)
and (date_dim.d_year = 1999))
-----------------------------------------------------PhysicalOlapScan[date_dim]
+------------------------------------------------hashAgg[GLOBAL]
+--------------------------------------------------PhysicalDistribute[DistributionSpecHash]
+----------------------------------------------------hashAgg[LOCAL]
+------------------------------------------------------PhysicalProject
+--------------------------------------------------------hashJoin[INNER_JOIN]
hashCondition=((sts.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=()
build RFs:RF8 d_date_sk->[ss_sold_date_sk]
+----------------------------------------------------------PhysicalProject
+------------------------------------------------------------hashJoin[INNER_JOIN]
hashCondition=((sts.ss_item_sk = sr.sr_item_sk) and (sts.ss_ticket_number =
sr.sr_ticket_number)) otherCondition=() build RFs:RF6
sr_ticket_number->[ss_ticket_number];RF7 sr_item_sk->[ss_item_sk]
+--------------------------------------------------------------PhysicalProject
+----------------------------------------------------------------filter((sts.ss_net_paid
> 0.00) and (sts.ss_net_profit > 1.00) and (sts.ss_quantity > 0))
+------------------------------------------------------------------PhysicalOlapScan[store_sales]
apply RFs: RF6 RF7 RF8
+--------------------------------------------------------------PhysicalProject
+----------------------------------------------------------------filter((sr.sr_return_amt
> 10000.00))
+------------------------------------------------------------------PhysicalOlapScan[store_returns]
+----------------------------------------------------------PhysicalDistribute[DistributionSpecReplicated]
+------------------------------------------------------------PhysicalProject
+--------------------------------------------------------------filter((date_dim.d_moy
= 12) and (date_dim.d_year = 1999))
+----------------------------------------------------------------PhysicalOlapScan[date_dim]
diff --git
a/regression-test/data/nereids_tpcds_shape_sf100_p0/rf_prune/query49.out
b/regression-test/data/nereids_tpcds_shape_sf100_p0/rf_prune/query49.out
index 7fb023642df..a52f8f454fd 100644
--- a/regression-test/data/nereids_tpcds_shape_sf100_p0/rf_prune/query49.out
+++ b/regression-test/data/nereids_tpcds_shape_sf100_p0/rf_prune/query49.out
@@ -9,81 +9,99 @@ PhysicalResultSink
------------hashAgg[LOCAL]
--------------PhysicalUnion
----------------PhysicalDistribute[DistributionSpecExecutionAny]
-------------------PhysicalProject
---------------------filter(((return_rank <= 10) OR (currency_rank <= 10)))
-----------------------PhysicalWindow
-------------------------PhysicalQuickSort[LOCAL_SORT]
---------------------------PhysicalWindow
-----------------------------PhysicalQuickSort[MERGE_SORT]
-------------------------------PhysicalDistribute[DistributionSpecGather]
---------------------------------PhysicalQuickSort[LOCAL_SORT]
-----------------------------------PhysicalProject
-------------------------------------hashAgg[GLOBAL]
---------------------------------------PhysicalDistribute[DistributionSpecHash]
-----------------------------------------hashAgg[LOCAL]
-------------------------------------------PhysicalProject
---------------------------------------------hashJoin[INNER_JOIN]
hashCondition=((ws.ws_item_sk = wr.wr_item_sk) and (ws.ws_order_number =
wr.wr_order_number)) otherCondition=() build RFs:RF1
ws_order_number->[wr_order_number];RF2 ws_item_sk->[wr_item_sk]
+------------------PhysicalTopN[MERGE_SORT]
+--------------------PhysicalDistribute[DistributionSpecGather]
+----------------------PhysicalTopN[LOCAL_SORT]
+------------------------hashAgg[GLOBAL]
+--------------------------PhysicalDistribute[DistributionSpecHash]
+----------------------------hashAgg[LOCAL]
+------------------------------PhysicalProject
+--------------------------------filter(((return_rank <= 10) OR (currency_rank
<= 10)))
+----------------------------------PhysicalWindow
+------------------------------------PhysicalQuickSort[LOCAL_SORT]
+--------------------------------------PhysicalWindow
+----------------------------------------PhysicalQuickSort[MERGE_SORT]
+------------------------------------------PhysicalDistribute[DistributionSpecGather]
+--------------------------------------------PhysicalQuickSort[LOCAL_SORT]
----------------------------------------------PhysicalProject
-------------------------------------------------filter((wr.wr_return_amt >
10000.00))
---------------------------------------------------PhysicalOlapScan[web_returns]
apply RFs: RF1 RF2
-----------------------------------------------hashJoin[INNER_JOIN]
hashCondition=((ws.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=()
build RFs:RF0 d_date_sk->[ws_sold_date_sk]
-------------------------------------------------PhysicalProject
---------------------------------------------------filter((ws.ws_net_paid >
0.00) and (ws.ws_net_profit > 1.00) and (ws.ws_quantity > 0))
-----------------------------------------------------PhysicalOlapScan[web_sales]
apply RFs: RF0
-------------------------------------------------PhysicalDistribute[DistributionSpecReplicated]
---------------------------------------------------PhysicalProject
-----------------------------------------------------filter((date_dim.d_moy =
12) and (date_dim.d_year = 1999))
-------------------------------------------------------PhysicalOlapScan[date_dim]
+------------------------------------------------hashAgg[GLOBAL]
+--------------------------------------------------PhysicalDistribute[DistributionSpecHash]
+----------------------------------------------------hashAgg[LOCAL]
+------------------------------------------------------PhysicalProject
+--------------------------------------------------------hashJoin[INNER_JOIN]
hashCondition=((ws.ws_item_sk = wr.wr_item_sk) and (ws.ws_order_number =
wr.wr_order_number)) otherCondition=() build RFs:RF1
ws_order_number->[wr_order_number];RF2 ws_item_sk->[wr_item_sk]
+----------------------------------------------------------PhysicalProject
+------------------------------------------------------------filter((wr.wr_return_amt
> 10000.00))
+--------------------------------------------------------------PhysicalOlapScan[web_returns]
apply RFs: RF1 RF2
+----------------------------------------------------------hashJoin[INNER_JOIN]
hashCondition=((ws.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=()
build RFs:RF0 d_date_sk->[ws_sold_date_sk]
+------------------------------------------------------------PhysicalProject
+--------------------------------------------------------------filter((ws.ws_net_paid
> 0.00) and (ws.ws_net_profit > 1.00) and (ws.ws_quantity > 0))
+----------------------------------------------------------------PhysicalOlapScan[web_sales]
apply RFs: RF0
+------------------------------------------------------------PhysicalDistribute[DistributionSpecReplicated]
+--------------------------------------------------------------PhysicalProject
+----------------------------------------------------------------filter((date_dim.d_moy
= 12) and (date_dim.d_year = 1999))
+------------------------------------------------------------------PhysicalOlapScan[date_dim]
----------------PhysicalDistribute[DistributionSpecExecutionAny]
-------------------PhysicalProject
---------------------filter(((return_rank <= 10) OR (currency_rank <= 10)))
-----------------------PhysicalWindow
-------------------------PhysicalQuickSort[LOCAL_SORT]
---------------------------PhysicalWindow
-----------------------------PhysicalQuickSort[MERGE_SORT]
-------------------------------PhysicalDistribute[DistributionSpecGather]
---------------------------------PhysicalQuickSort[LOCAL_SORT]
-----------------------------------PhysicalProject
-------------------------------------hashAgg[GLOBAL]
---------------------------------------PhysicalDistribute[DistributionSpecHash]
-----------------------------------------hashAgg[LOCAL]
-------------------------------------------PhysicalProject
---------------------------------------------hashJoin[INNER_JOIN]
hashCondition=((cs.cs_item_sk = cr.cr_item_sk) and (cs.cs_order_number =
cr.cr_order_number)) otherCondition=() build RFs:RF4
cs_order_number->[cr_order_number];RF5 cs_item_sk->[cr_item_sk]
+------------------PhysicalTopN[MERGE_SORT]
+--------------------PhysicalDistribute[DistributionSpecGather]
+----------------------PhysicalTopN[LOCAL_SORT]
+------------------------hashAgg[GLOBAL]
+--------------------------PhysicalDistribute[DistributionSpecHash]
+----------------------------hashAgg[LOCAL]
+------------------------------PhysicalProject
+--------------------------------filter(((return_rank <= 10) OR (currency_rank
<= 10)))
+----------------------------------PhysicalWindow
+------------------------------------PhysicalQuickSort[LOCAL_SORT]
+--------------------------------------PhysicalWindow
+----------------------------------------PhysicalQuickSort[MERGE_SORT]
+------------------------------------------PhysicalDistribute[DistributionSpecGather]
+--------------------------------------------PhysicalQuickSort[LOCAL_SORT]
----------------------------------------------PhysicalProject
-------------------------------------------------filter((cr.cr_return_amount >
10000.00))
---------------------------------------------------PhysicalOlapScan[catalog_returns]
apply RFs: RF4 RF5
-----------------------------------------------hashJoin[INNER_JOIN]
hashCondition=((cs.cs_sold_date_sk = date_dim.d_date_sk)) otherCondition=()
build RFs:RF3 d_date_sk->[cs_sold_date_sk]
-------------------------------------------------PhysicalProject
---------------------------------------------------filter((cs.cs_net_paid >
0.00) and (cs.cs_net_profit > 1.00) and (cs.cs_quantity > 0))
-----------------------------------------------------PhysicalOlapScan[catalog_sales]
apply RFs: RF3
-------------------------------------------------PhysicalDistribute[DistributionSpecReplicated]
---------------------------------------------------PhysicalProject
-----------------------------------------------------filter((date_dim.d_moy =
12) and (date_dim.d_year = 1999))
-------------------------------------------------------PhysicalOlapScan[date_dim]
+------------------------------------------------hashAgg[GLOBAL]
+--------------------------------------------------PhysicalDistribute[DistributionSpecHash]
+----------------------------------------------------hashAgg[LOCAL]
+------------------------------------------------------PhysicalProject
+--------------------------------------------------------hashJoin[INNER_JOIN]
hashCondition=((cs.cs_item_sk = cr.cr_item_sk) and (cs.cs_order_number =
cr.cr_order_number)) otherCondition=() build RFs:RF4
cs_order_number->[cr_order_number];RF5 cs_item_sk->[cr_item_sk]
+----------------------------------------------------------PhysicalProject
+------------------------------------------------------------filter((cr.cr_return_amount
> 10000.00))
+--------------------------------------------------------------PhysicalOlapScan[catalog_returns]
apply RFs: RF4 RF5
+----------------------------------------------------------hashJoin[INNER_JOIN]
hashCondition=((cs.cs_sold_date_sk = date_dim.d_date_sk)) otherCondition=()
build RFs:RF3 d_date_sk->[cs_sold_date_sk]
+------------------------------------------------------------PhysicalProject
+--------------------------------------------------------------filter((cs.cs_net_paid
> 0.00) and (cs.cs_net_profit > 1.00) and (cs.cs_quantity > 0))
+----------------------------------------------------------------PhysicalOlapScan[catalog_sales]
apply RFs: RF3
+------------------------------------------------------------PhysicalDistribute[DistributionSpecReplicated]
+--------------------------------------------------------------PhysicalProject
+----------------------------------------------------------------filter((date_dim.d_moy
= 12) and (date_dim.d_year = 1999))
+------------------------------------------------------------------PhysicalOlapScan[date_dim]
----------------PhysicalDistribute[DistributionSpecExecutionAny]
-------------------PhysicalProject
---------------------filter(((return_rank <= 10) OR (currency_rank <= 10)))
-----------------------PhysicalWindow
-------------------------PhysicalQuickSort[LOCAL_SORT]
---------------------------PhysicalWindow
-----------------------------PhysicalQuickSort[MERGE_SORT]
-------------------------------PhysicalDistribute[DistributionSpecGather]
---------------------------------PhysicalQuickSort[LOCAL_SORT]
-----------------------------------PhysicalProject
-------------------------------------hashAgg[GLOBAL]
---------------------------------------PhysicalDistribute[DistributionSpecHash]
-----------------------------------------hashAgg[LOCAL]
-------------------------------------------PhysicalProject
---------------------------------------------hashJoin[INNER_JOIN]
hashCondition=((sts.ss_item_sk = sr.sr_item_sk) and (sts.ss_ticket_number =
sr.sr_ticket_number)) otherCondition=() build RFs:RF7
ss_ticket_number->[sr_ticket_number];RF8 ss_item_sk->[sr_item_sk]
+------------------PhysicalTopN[MERGE_SORT]
+--------------------PhysicalDistribute[DistributionSpecGather]
+----------------------PhysicalTopN[LOCAL_SORT]
+------------------------hashAgg[GLOBAL]
+--------------------------PhysicalDistribute[DistributionSpecHash]
+----------------------------hashAgg[LOCAL]
+------------------------------PhysicalProject
+--------------------------------filter(((return_rank <= 10) OR (currency_rank
<= 10)))
+----------------------------------PhysicalWindow
+------------------------------------PhysicalQuickSort[LOCAL_SORT]
+--------------------------------------PhysicalWindow
+----------------------------------------PhysicalQuickSort[MERGE_SORT]
+------------------------------------------PhysicalDistribute[DistributionSpecGather]
+--------------------------------------------PhysicalQuickSort[LOCAL_SORT]
----------------------------------------------PhysicalProject
-------------------------------------------------filter((sr.sr_return_amt >
10000.00))
---------------------------------------------------PhysicalOlapScan[store_returns]
apply RFs: RF7 RF8
-----------------------------------------------hashJoin[INNER_JOIN]
hashCondition=((sts.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=()
build RFs:RF6 d_date_sk->[ss_sold_date_sk]
-------------------------------------------------PhysicalProject
---------------------------------------------------filter((sts.ss_net_paid >
0.00) and (sts.ss_net_profit > 1.00) and (sts.ss_quantity > 0))
-----------------------------------------------------PhysicalOlapScan[store_sales]
apply RFs: RF6
-------------------------------------------------PhysicalDistribute[DistributionSpecReplicated]
---------------------------------------------------PhysicalProject
-----------------------------------------------------filter((date_dim.d_moy =
12) and (date_dim.d_year = 1999))
-------------------------------------------------------PhysicalOlapScan[date_dim]
+------------------------------------------------hashAgg[GLOBAL]
+--------------------------------------------------PhysicalDistribute[DistributionSpecHash]
+----------------------------------------------------hashAgg[LOCAL]
+------------------------------------------------------PhysicalProject
+--------------------------------------------------------hashJoin[INNER_JOIN]
hashCondition=((sts.ss_item_sk = sr.sr_item_sk) and (sts.ss_ticket_number =
sr.sr_ticket_number)) otherCondition=() build RFs:RF7
ss_ticket_number->[sr_ticket_number];RF8 ss_item_sk->[sr_item_sk]
+----------------------------------------------------------PhysicalProject
+------------------------------------------------------------filter((sr.sr_return_amt
> 10000.00))
+--------------------------------------------------------------PhysicalOlapScan[store_returns]
apply RFs: RF7 RF8
+----------------------------------------------------------hashJoin[INNER_JOIN]
hashCondition=((sts.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=()
build RFs:RF6 d_date_sk->[ss_sold_date_sk]
+------------------------------------------------------------PhysicalProject
+--------------------------------------------------------------filter((sts.ss_net_paid
> 0.00) and (sts.ss_net_profit > 1.00) and (sts.ss_quantity > 0))
+----------------------------------------------------------------PhysicalOlapScan[store_sales]
apply RFs: RF6
+------------------------------------------------------------PhysicalDistribute[DistributionSpecReplicated]
+--------------------------------------------------------------PhysicalProject
+----------------------------------------------------------------filter((date_dim.d_moy
= 12) and (date_dim.d_year = 1999))
+------------------------------------------------------------------PhysicalOlapScan[date_dim]
diff --git
a/regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query49.out
b/regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query49.out
index 7fb023642df..a52f8f454fd 100644
--- a/regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query49.out
+++ b/regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query49.out
@@ -9,81 +9,99 @@ PhysicalResultSink
------------hashAgg[LOCAL]
--------------PhysicalUnion
----------------PhysicalDistribute[DistributionSpecExecutionAny]
-------------------PhysicalProject
---------------------filter(((return_rank <= 10) OR (currency_rank <= 10)))
-----------------------PhysicalWindow
-------------------------PhysicalQuickSort[LOCAL_SORT]
---------------------------PhysicalWindow
-----------------------------PhysicalQuickSort[MERGE_SORT]
-------------------------------PhysicalDistribute[DistributionSpecGather]
---------------------------------PhysicalQuickSort[LOCAL_SORT]
-----------------------------------PhysicalProject
-------------------------------------hashAgg[GLOBAL]
---------------------------------------PhysicalDistribute[DistributionSpecHash]
-----------------------------------------hashAgg[LOCAL]
-------------------------------------------PhysicalProject
---------------------------------------------hashJoin[INNER_JOIN]
hashCondition=((ws.ws_item_sk = wr.wr_item_sk) and (ws.ws_order_number =
wr.wr_order_number)) otherCondition=() build RFs:RF1
ws_order_number->[wr_order_number];RF2 ws_item_sk->[wr_item_sk]
+------------------PhysicalTopN[MERGE_SORT]
+--------------------PhysicalDistribute[DistributionSpecGather]
+----------------------PhysicalTopN[LOCAL_SORT]
+------------------------hashAgg[GLOBAL]
+--------------------------PhysicalDistribute[DistributionSpecHash]
+----------------------------hashAgg[LOCAL]
+------------------------------PhysicalProject
+--------------------------------filter(((return_rank <= 10) OR (currency_rank
<= 10)))
+----------------------------------PhysicalWindow
+------------------------------------PhysicalQuickSort[LOCAL_SORT]
+--------------------------------------PhysicalWindow
+----------------------------------------PhysicalQuickSort[MERGE_SORT]
+------------------------------------------PhysicalDistribute[DistributionSpecGather]
+--------------------------------------------PhysicalQuickSort[LOCAL_SORT]
----------------------------------------------PhysicalProject
-------------------------------------------------filter((wr.wr_return_amt >
10000.00))
---------------------------------------------------PhysicalOlapScan[web_returns]
apply RFs: RF1 RF2
-----------------------------------------------hashJoin[INNER_JOIN]
hashCondition=((ws.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=()
build RFs:RF0 d_date_sk->[ws_sold_date_sk]
-------------------------------------------------PhysicalProject
---------------------------------------------------filter((ws.ws_net_paid >
0.00) and (ws.ws_net_profit > 1.00) and (ws.ws_quantity > 0))
-----------------------------------------------------PhysicalOlapScan[web_sales]
apply RFs: RF0
-------------------------------------------------PhysicalDistribute[DistributionSpecReplicated]
---------------------------------------------------PhysicalProject
-----------------------------------------------------filter((date_dim.d_moy =
12) and (date_dim.d_year = 1999))
-------------------------------------------------------PhysicalOlapScan[date_dim]
+------------------------------------------------hashAgg[GLOBAL]
+--------------------------------------------------PhysicalDistribute[DistributionSpecHash]
+----------------------------------------------------hashAgg[LOCAL]
+------------------------------------------------------PhysicalProject
+--------------------------------------------------------hashJoin[INNER_JOIN]
hashCondition=((ws.ws_item_sk = wr.wr_item_sk) and (ws.ws_order_number =
wr.wr_order_number)) otherCondition=() build RFs:RF1
ws_order_number->[wr_order_number];RF2 ws_item_sk->[wr_item_sk]
+----------------------------------------------------------PhysicalProject
+------------------------------------------------------------filter((wr.wr_return_amt
> 10000.00))
+--------------------------------------------------------------PhysicalOlapScan[web_returns]
apply RFs: RF1 RF2
+----------------------------------------------------------hashJoin[INNER_JOIN]
hashCondition=((ws.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=()
build RFs:RF0 d_date_sk->[ws_sold_date_sk]
+------------------------------------------------------------PhysicalProject
+--------------------------------------------------------------filter((ws.ws_net_paid
> 0.00) and (ws.ws_net_profit > 1.00) and (ws.ws_quantity > 0))
+----------------------------------------------------------------PhysicalOlapScan[web_sales]
apply RFs: RF0
+------------------------------------------------------------PhysicalDistribute[DistributionSpecReplicated]
+--------------------------------------------------------------PhysicalProject
+----------------------------------------------------------------filter((date_dim.d_moy
= 12) and (date_dim.d_year = 1999))
+------------------------------------------------------------------PhysicalOlapScan[date_dim]
----------------PhysicalDistribute[DistributionSpecExecutionAny]
-------------------PhysicalProject
---------------------filter(((return_rank <= 10) OR (currency_rank <= 10)))
-----------------------PhysicalWindow
-------------------------PhysicalQuickSort[LOCAL_SORT]
---------------------------PhysicalWindow
-----------------------------PhysicalQuickSort[MERGE_SORT]
-------------------------------PhysicalDistribute[DistributionSpecGather]
---------------------------------PhysicalQuickSort[LOCAL_SORT]
-----------------------------------PhysicalProject
-------------------------------------hashAgg[GLOBAL]
---------------------------------------PhysicalDistribute[DistributionSpecHash]
-----------------------------------------hashAgg[LOCAL]
-------------------------------------------PhysicalProject
---------------------------------------------hashJoin[INNER_JOIN]
hashCondition=((cs.cs_item_sk = cr.cr_item_sk) and (cs.cs_order_number =
cr.cr_order_number)) otherCondition=() build RFs:RF4
cs_order_number->[cr_order_number];RF5 cs_item_sk->[cr_item_sk]
+------------------PhysicalTopN[MERGE_SORT]
+--------------------PhysicalDistribute[DistributionSpecGather]
+----------------------PhysicalTopN[LOCAL_SORT]
+------------------------hashAgg[GLOBAL]
+--------------------------PhysicalDistribute[DistributionSpecHash]
+----------------------------hashAgg[LOCAL]
+------------------------------PhysicalProject
+--------------------------------filter(((return_rank <= 10) OR (currency_rank
<= 10)))
+----------------------------------PhysicalWindow
+------------------------------------PhysicalQuickSort[LOCAL_SORT]
+--------------------------------------PhysicalWindow
+----------------------------------------PhysicalQuickSort[MERGE_SORT]
+------------------------------------------PhysicalDistribute[DistributionSpecGather]
+--------------------------------------------PhysicalQuickSort[LOCAL_SORT]
----------------------------------------------PhysicalProject
-------------------------------------------------filter((cr.cr_return_amount >
10000.00))
---------------------------------------------------PhysicalOlapScan[catalog_returns]
apply RFs: RF4 RF5
-----------------------------------------------hashJoin[INNER_JOIN]
hashCondition=((cs.cs_sold_date_sk = date_dim.d_date_sk)) otherCondition=()
build RFs:RF3 d_date_sk->[cs_sold_date_sk]
-------------------------------------------------PhysicalProject
---------------------------------------------------filter((cs.cs_net_paid >
0.00) and (cs.cs_net_profit > 1.00) and (cs.cs_quantity > 0))
-----------------------------------------------------PhysicalOlapScan[catalog_sales]
apply RFs: RF3
-------------------------------------------------PhysicalDistribute[DistributionSpecReplicated]
---------------------------------------------------PhysicalProject
-----------------------------------------------------filter((date_dim.d_moy =
12) and (date_dim.d_year = 1999))
-------------------------------------------------------PhysicalOlapScan[date_dim]
+------------------------------------------------hashAgg[GLOBAL]
+--------------------------------------------------PhysicalDistribute[DistributionSpecHash]
+----------------------------------------------------hashAgg[LOCAL]
+------------------------------------------------------PhysicalProject
+--------------------------------------------------------hashJoin[INNER_JOIN]
hashCondition=((cs.cs_item_sk = cr.cr_item_sk) and (cs.cs_order_number =
cr.cr_order_number)) otherCondition=() build RFs:RF4
cs_order_number->[cr_order_number];RF5 cs_item_sk->[cr_item_sk]
+----------------------------------------------------------PhysicalProject
+------------------------------------------------------------filter((cr.cr_return_amount
> 10000.00))
+--------------------------------------------------------------PhysicalOlapScan[catalog_returns]
apply RFs: RF4 RF5
+----------------------------------------------------------hashJoin[INNER_JOIN]
hashCondition=((cs.cs_sold_date_sk = date_dim.d_date_sk)) otherCondition=()
build RFs:RF3 d_date_sk->[cs_sold_date_sk]
+------------------------------------------------------------PhysicalProject
+--------------------------------------------------------------filter((cs.cs_net_paid
> 0.00) and (cs.cs_net_profit > 1.00) and (cs.cs_quantity > 0))
+----------------------------------------------------------------PhysicalOlapScan[catalog_sales]
apply RFs: RF3
+------------------------------------------------------------PhysicalDistribute[DistributionSpecReplicated]
+--------------------------------------------------------------PhysicalProject
+----------------------------------------------------------------filter((date_dim.d_moy
= 12) and (date_dim.d_year = 1999))
+------------------------------------------------------------------PhysicalOlapScan[date_dim]
----------------PhysicalDistribute[DistributionSpecExecutionAny]
-------------------PhysicalProject
---------------------filter(((return_rank <= 10) OR (currency_rank <= 10)))
-----------------------PhysicalWindow
-------------------------PhysicalQuickSort[LOCAL_SORT]
---------------------------PhysicalWindow
-----------------------------PhysicalQuickSort[MERGE_SORT]
-------------------------------PhysicalDistribute[DistributionSpecGather]
---------------------------------PhysicalQuickSort[LOCAL_SORT]
-----------------------------------PhysicalProject
-------------------------------------hashAgg[GLOBAL]
---------------------------------------PhysicalDistribute[DistributionSpecHash]
-----------------------------------------hashAgg[LOCAL]
-------------------------------------------PhysicalProject
---------------------------------------------hashJoin[INNER_JOIN]
hashCondition=((sts.ss_item_sk = sr.sr_item_sk) and (sts.ss_ticket_number =
sr.sr_ticket_number)) otherCondition=() build RFs:RF7
ss_ticket_number->[sr_ticket_number];RF8 ss_item_sk->[sr_item_sk]
+------------------PhysicalTopN[MERGE_SORT]
+--------------------PhysicalDistribute[DistributionSpecGather]
+----------------------PhysicalTopN[LOCAL_SORT]
+------------------------hashAgg[GLOBAL]
+--------------------------PhysicalDistribute[DistributionSpecHash]
+----------------------------hashAgg[LOCAL]
+------------------------------PhysicalProject
+--------------------------------filter(((return_rank <= 10) OR (currency_rank
<= 10)))
+----------------------------------PhysicalWindow
+------------------------------------PhysicalQuickSort[LOCAL_SORT]
+--------------------------------------PhysicalWindow
+----------------------------------------PhysicalQuickSort[MERGE_SORT]
+------------------------------------------PhysicalDistribute[DistributionSpecGather]
+--------------------------------------------PhysicalQuickSort[LOCAL_SORT]
----------------------------------------------PhysicalProject
-------------------------------------------------filter((sr.sr_return_amt >
10000.00))
---------------------------------------------------PhysicalOlapScan[store_returns]
apply RFs: RF7 RF8
-----------------------------------------------hashJoin[INNER_JOIN]
hashCondition=((sts.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=()
build RFs:RF6 d_date_sk->[ss_sold_date_sk]
-------------------------------------------------PhysicalProject
---------------------------------------------------filter((sts.ss_net_paid >
0.00) and (sts.ss_net_profit > 1.00) and (sts.ss_quantity > 0))
-----------------------------------------------------PhysicalOlapScan[store_sales]
apply RFs: RF6
-------------------------------------------------PhysicalDistribute[DistributionSpecReplicated]
---------------------------------------------------PhysicalProject
-----------------------------------------------------filter((date_dim.d_moy =
12) and (date_dim.d_year = 1999))
-------------------------------------------------------PhysicalOlapScan[date_dim]
+------------------------------------------------hashAgg[GLOBAL]
+--------------------------------------------------PhysicalDistribute[DistributionSpecHash]
+----------------------------------------------------hashAgg[LOCAL]
+------------------------------------------------------PhysicalProject
+--------------------------------------------------------hashJoin[INNER_JOIN]
hashCondition=((sts.ss_item_sk = sr.sr_item_sk) and (sts.ss_ticket_number =
sr.sr_ticket_number)) otherCondition=() build RFs:RF7
ss_ticket_number->[sr_ticket_number];RF8 ss_item_sk->[sr_item_sk]
+----------------------------------------------------------PhysicalProject
+------------------------------------------------------------filter((sr.sr_return_amt
> 10000.00))
+--------------------------------------------------------------PhysicalOlapScan[store_returns]
apply RFs: RF7 RF8
+----------------------------------------------------------hashJoin[INNER_JOIN]
hashCondition=((sts.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=()
build RFs:RF6 d_date_sk->[ss_sold_date_sk]
+------------------------------------------------------------PhysicalProject
+--------------------------------------------------------------filter((sts.ss_net_paid
> 0.00) and (sts.ss_net_profit > 1.00) and (sts.ss_quantity > 0))
+----------------------------------------------------------------PhysicalOlapScan[store_sales]
apply RFs: RF6
+------------------------------------------------------------PhysicalDistribute[DistributionSpecReplicated]
+--------------------------------------------------------------PhysicalProject
+----------------------------------------------------------------filter((date_dim.d_moy
= 12) and (date_dim.d_year = 1999))
+------------------------------------------------------------------PhysicalOlapScan[date_dim]
diff --git
a/regression-test/suites/nereids_rules_p0/limit_push_down/order_push_down.groovy
b/regression-test/suites/nereids_rules_p0/limit_push_down/order_push_down.groovy
index dae89145d7a..e97856fbe43 100644
---
a/regression-test/suites/nereids_rules_p0/limit_push_down/order_push_down.groovy
+++
b/regression-test/suites/nereids_rules_p0/limit_push_down/order_push_down.groovy
@@ -24,6 +24,7 @@ suite("order_push_down") {
sql "SET ignore_shape_nodes='PhysicalDistribute,PhysicalProject'"
sql "SET disable_join_reorder=true"
sql 'set be_number_for_test=3'
+ sql "set disable_nereids_rules='push_down_top_n_distinct_through_union'"
//`limit 1 offset 1 + sort, project`:
qt_limit_offset_sort_project """ explain shape plan SELECT t1.id FROM t1
ORDER BY id LIMIT 1 OFFSET 1; """
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]