Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

import org.apache.doris.nereids.CascadesContext;
import org.apache.doris.nereids.processor.post.PlanPostProcessor;
import org.apache.doris.nereids.trees.expressions.Expression;
import org.apache.doris.nereids.trees.expressions.Slot;
import org.apache.doris.nereids.trees.plans.AbstractPlan;
import org.apache.doris.nereids.trees.plans.Plan;
Expand Down Expand Up @@ -61,25 +62,27 @@ private void computeRuntimeFilterForIntersectAndExcept(PhysicalSetOperation setO
&& child0.getStats().getRowCount()
< ConnectContext.get().getSessionVariable().runtimeFilterMaxBuildRowCount) {
for (int slotIdx : chooseSourceSlots(setOp)) {
Expression sourceExpression = setOp.getRegularChildrenOutputs().get(0).get(slotIdx);
for (int childId = 1; childId < setOp.children().size(); childId++) {
Plan child = setOp.children().get(childId);
Expression targetExpression = setOp.getRegularChildrenOutputs().get(childId).get(slotIdx);
Statistics stats = child0.getStats();
long buildNdvOrRowCount = -1;
if (stats != null) {
buildNdvOrRowCount = (long) stats.getRowCount();
ColumnStatistic colStats = stats.findColumnStatistics(
setOp.child(0).getOutput().get(slotIdx));
sourceExpression);
if (colStats != null && !colStats.isUnKnown) {
buildNdvOrRowCount = Math.max(1, (long) colStats.ndv);
}
}
PushDownContext pushDownContext = new PushDownContext(
context.getRuntimeFilterV2Context(),
setOp,
setOp.child(0).getOutput().get(slotIdx),
sourceExpression,
buildNdvOrRowCount,
slotIdx,
setOp.child(childId).getOutput().get(slotIdx));
targetExpression);
child.accept(PushDownVisitor.INSTANCE, pushDownContext);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ PhysicalResultSink
--------PhysicalDistribute[DistributionSpecGather]
----------hashAgg[LOCAL]
------------PhysicalProject
--------------PhysicalIntersect RFV2: RF6[d_date->d_date] RF7[d_date->ss_customer_sk] RF8[d_date->c_customer_sk]
--------------PhysicalIntersect RFV2: RF6[c_last_name->c_last_name] RF7[c_last_name->c_last_name]
----------------PhysicalDistribute[DistributionSpecHash]
------------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_bill_customer_sk = customer.c_customer_sk)) otherCondition=()
--------------------hashAgg[GLOBAL]
Expand All @@ -32,8 +32,8 @@ PhysicalResultSink
--------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF2
------------------------------PhysicalProject
--------------------------------filter((date_dim.d_month_seq <= 1194) and (date_dim.d_month_seq >= 1183))
----------------------------------PhysicalOlapScan[date_dim] RFV2: RF6
--------------------PhysicalOlapScan[customer]
----------------------------------PhysicalOlapScan[date_dim]
--------------------PhysicalOlapScan[customer] RFV2: RF6
----------------PhysicalDistribute[DistributionSpecHash]
------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_customer_sk = customer.c_customer_sk)) otherCondition=()
--------------------hashAgg[GLOBAL]
Expand All @@ -42,9 +42,9 @@ PhysicalResultSink
--------------------------PhysicalProject
----------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF4 d_date_sk->[ss_sold_date_sk]
------------------------------PhysicalProject
--------------------------------PhysicalOlapScan[store_sales] apply RFs: RF4 RFV2: RF7
--------------------------------PhysicalOlapScan[store_sales] apply RFs: RF4
------------------------------PhysicalProject
--------------------------------filter((date_dim.d_month_seq <= 1194) and (date_dim.d_month_seq >= 1183))
----------------------------------PhysicalOlapScan[date_dim]
--------------------PhysicalOlapScan[customer] RFV2: RF8
--------------------PhysicalOlapScan[customer] RFV2: RF7

Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ PhysicalResultSink
--------PhysicalDistribute[DistributionSpecGather]
----------hashAgg[LOCAL]
------------PhysicalProject
--------------PhysicalIntersect RFV2: RF6[d_date->d_date] RF7[d_date->ss_customer_sk] RF8[d_date->c_customer_sk]
--------------PhysicalIntersect RFV2: RF6[c_last_name->c_last_name] RF7[c_last_name->c_last_name]
----------------PhysicalDistribute[DistributionSpecHash]
------------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_bill_customer_sk = customer.c_customer_sk)) otherCondition=() build RFs:RF1 c_customer_sk->[ws_bill_customer_sk]
--------------------hashAgg[GLOBAL]
Expand All @@ -32,8 +32,8 @@ PhysicalResultSink
--------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF2 RF3
------------------------------PhysicalProject
--------------------------------filter((date_dim.d_month_seq <= 1194) and (date_dim.d_month_seq >= 1183))
----------------------------------PhysicalOlapScan[date_dim] RFV2: RF6
--------------------PhysicalOlapScan[customer]
----------------------------------PhysicalOlapScan[date_dim]
--------------------PhysicalOlapScan[customer] RFV2: RF6
----------------PhysicalDistribute[DistributionSpecHash]
------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_customer_sk = customer.c_customer_sk)) otherCondition=() build RFs:RF5 c_customer_sk->[ss_customer_sk]
--------------------hashAgg[GLOBAL]
Expand All @@ -42,9 +42,9 @@ PhysicalResultSink
--------------------------PhysicalProject
----------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF4 d_date_sk->[ss_sold_date_sk]
------------------------------PhysicalProject
--------------------------------PhysicalOlapScan[store_sales] apply RFs: RF4 RF5 RFV2: RF7
--------------------------------PhysicalOlapScan[store_sales] apply RFs: RF4 RF5
------------------------------PhysicalProject
--------------------------------filter((date_dim.d_month_seq <= 1194) and (date_dim.d_month_seq >= 1183))
----------------------------------PhysicalOlapScan[date_dim]
--------------------PhysicalOlapScan[customer] RFV2: RF8
--------------------PhysicalOlapScan[customer] RFV2: RF7

Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ PhysicalResultSink
--------PhysicalDistribute[DistributionSpecGather]
----------hashAgg[LOCAL]
------------PhysicalProject
--------------PhysicalIntersect RFV2: RF6[d_date->d_date] RF7[d_date->ss_customer_sk] RF8[d_date->c_customer_sk]
--------------PhysicalIntersect RFV2: RF6[c_last_name->c_last_name] RF7[c_last_name->c_last_name]
----------------PhysicalDistribute[DistributionSpecHash]
------------------hashJoin[INNER_JOIN shuffle] hashCondition=((web_sales.ws_bill_customer_sk = customer.c_customer_sk)) otherCondition=()
--------------------hashAgg[GLOBAL]
Expand All @@ -32,8 +32,8 @@ PhysicalResultSink
--------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF2
------------------------------PhysicalProject
--------------------------------filter((date_dim.d_month_seq <= 1194) and (date_dim.d_month_seq >= 1183))
----------------------------------PhysicalOlapScan[date_dim] RFV2: RF6
--------------------PhysicalOlapScan[customer]
----------------------------------PhysicalOlapScan[date_dim]
--------------------PhysicalOlapScan[customer] RFV2: RF6
----------------PhysicalDistribute[DistributionSpecHash]
------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_customer_sk = customer.c_customer_sk)) otherCondition=()
--------------------hashAgg[GLOBAL]
Expand All @@ -42,9 +42,9 @@ PhysicalResultSink
--------------------------PhysicalProject
----------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF4 d_date_sk->[ss_sold_date_sk]
------------------------------PhysicalProject
--------------------------------PhysicalOlapScan[store_sales] apply RFs: RF4 RFV2: RF7
--------------------------------PhysicalOlapScan[store_sales] apply RFs: RF4
------------------------------PhysicalProject
--------------------------------filter((date_dim.d_month_seq <= 1194) and (date_dim.d_month_seq >= 1183))
----------------------------------PhysicalOlapScan[date_dim]
--------------------PhysicalOlapScan[customer] RFV2: RF8
--------------------PhysicalOlapScan[customer] RFV2: RF7

Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ PhysicalResultSink
----PhysicalDistribute[DistributionSpecGather]
------hashAgg[LOCAL]
--------PhysicalProject
----------PhysicalExcept RFV2: RF6[ss_customer_sk->d_date] RF7[ss_customer_sk->d_date]
----------PhysicalExcept RFV2: RF6[c_last_name->c_last_name] RF7[c_last_name->c_last_name]
------------PhysicalDistribute[DistributionSpecHash]
--------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_customer_sk = customer.c_customer_sk)) otherCondition=()
----------------hashAgg[GLOBAL]
Expand All @@ -30,8 +30,8 @@ PhysicalResultSink
----------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF2
--------------------------PhysicalProject
----------------------------filter((date_dim.d_month_seq <= 1195) and (date_dim.d_month_seq >= 1184))
------------------------------PhysicalOlapScan[date_dim] RFV2: RF6
----------------PhysicalOlapScan[customer]
------------------------------PhysicalOlapScan[date_dim]
----------------PhysicalOlapScan[customer] RFV2: RF6
------------PhysicalDistribute[DistributionSpecHash]
--------------hashJoin[INNER_JOIN shuffle] hashCondition=((web_sales.ws_bill_customer_sk = customer.c_customer_sk)) otherCondition=()
----------------hashAgg[GLOBAL]
Expand All @@ -43,6 +43,6 @@ PhysicalResultSink
----------------------------PhysicalOlapScan[web_sales] apply RFs: RF4
--------------------------PhysicalProject
----------------------------filter((date_dim.d_month_seq <= 1195) and (date_dim.d_month_seq >= 1184))
------------------------------PhysicalOlapScan[date_dim] RFV2: RF7
----------------PhysicalOlapScan[customer]
------------------------------PhysicalOlapScan[date_dim]
----------------PhysicalOlapScan[customer] RFV2: RF7

10 changes: 5 additions & 5 deletions regression-test/data/shape_check/tpcds_sf100/shape/query38.out
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ PhysicalResultSink
--------PhysicalDistribute[DistributionSpecGather]
----------hashAgg[LOCAL]
------------PhysicalProject
--------------PhysicalIntersect RFV2: RF6[d_date->d_date] RF7[d_date->ss_customer_sk] RF8[d_date->c_customer_sk]
--------------PhysicalIntersect RFV2: RF6[c_last_name->c_last_name] RF7[c_last_name->c_last_name]
----------------PhysicalDistribute[DistributionSpecHash]
------------------hashJoin[INNER_JOIN shuffle] hashCondition=((web_sales.ws_bill_customer_sk = customer.c_customer_sk)) otherCondition=() build RFs:RF1 c_customer_sk->[ws_bill_customer_sk]
--------------------hashAgg[GLOBAL]
Expand All @@ -32,8 +32,8 @@ PhysicalResultSink
--------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF2 RF3
------------------------------PhysicalProject
--------------------------------filter((date_dim.d_month_seq <= 1194) and (date_dim.d_month_seq >= 1183))
----------------------------------PhysicalOlapScan[date_dim] RFV2: RF6
--------------------PhysicalOlapScan[customer]
----------------------------------PhysicalOlapScan[date_dim]
--------------------PhysicalOlapScan[customer] RFV2: RF6
----------------PhysicalDistribute[DistributionSpecHash]
------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_customer_sk = customer.c_customer_sk)) otherCondition=() build RFs:RF5 c_customer_sk->[ss_customer_sk]
--------------------hashAgg[GLOBAL]
Expand All @@ -42,9 +42,9 @@ PhysicalResultSink
--------------------------PhysicalProject
----------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF4 d_date_sk->[ss_sold_date_sk]
------------------------------PhysicalProject
--------------------------------PhysicalOlapScan[store_sales] apply RFs: RF4 RF5 RFV2: RF7
--------------------------------PhysicalOlapScan[store_sales] apply RFs: RF4 RF5
------------------------------PhysicalProject
--------------------------------filter((date_dim.d_month_seq <= 1194) and (date_dim.d_month_seq >= 1183))
----------------------------------PhysicalOlapScan[date_dim]
--------------------PhysicalOlapScan[customer] RFV2: RF8
--------------------PhysicalOlapScan[customer] RFV2: RF7

10 changes: 5 additions & 5 deletions regression-test/data/shape_check/tpcds_sf100/shape/query87.out
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ PhysicalResultSink
----PhysicalDistribute[DistributionSpecGather]
------hashAgg[LOCAL]
--------PhysicalProject
----------PhysicalExcept RFV2: RF6[ss_customer_sk->d_date] RF7[ss_customer_sk->d_date]
----------PhysicalExcept RFV2: RF6[c_last_name->c_last_name] RF7[c_last_name->c_last_name]
------------PhysicalDistribute[DistributionSpecHash]
--------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_customer_sk = customer.c_customer_sk)) otherCondition=() build RFs:RF1 c_customer_sk->[ss_customer_sk]
----------------hashAgg[GLOBAL]
Expand All @@ -30,8 +30,8 @@ PhysicalResultSink
----------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF2 RF3
--------------------------PhysicalProject
----------------------------filter((date_dim.d_month_seq <= 1195) and (date_dim.d_month_seq >= 1184))
------------------------------PhysicalOlapScan[date_dim] RFV2: RF6
----------------PhysicalOlapScan[customer]
------------------------------PhysicalOlapScan[date_dim]
----------------PhysicalOlapScan[customer] RFV2: RF6
------------PhysicalDistribute[DistributionSpecHash]
--------------hashJoin[INNER_JOIN shuffle] hashCondition=((web_sales.ws_bill_customer_sk = customer.c_customer_sk)) otherCondition=() build RFs:RF5 c_customer_sk->[ws_bill_customer_sk]
----------------hashAgg[GLOBAL]
Expand All @@ -43,6 +43,6 @@ PhysicalResultSink
----------------------------PhysicalOlapScan[web_sales] apply RFs: RF4 RF5
--------------------------PhysicalProject
----------------------------filter((date_dim.d_month_seq <= 1195) and (date_dim.d_month_seq >= 1184))
------------------------------PhysicalOlapScan[date_dim] RFV2: RF7
----------------PhysicalOlapScan[customer]
------------------------------PhysicalOlapScan[date_dim]
----------------PhysicalOlapScan[customer] RFV2: RF7

Loading