From 576a2b33cb38372a96277db49247c9f0969e5bf3 Mon Sep 17 00:00:00 2001 From: minghong Date: Wed, 27 Dec 2023 11:36:12 +0800 Subject: [PATCH] [fix](nereids) "not is null" stats estimation fix (#28860) * fix not is null stats --- .../doris/nereids/stats/FilterEstimation.java | 3 +- .../nereids/stats/FilterEstimationTest.java | 38 ++++++++++ .../shape/query76.out | 40 ++++++----- .../shape/query95.out | 59 ++++++++-------- .../shape/query97.out | 20 +++--- .../noStatsRfPrune/query95.out | 59 ++++++++-------- .../no_stats_shape/query95.out | 59 ++++++++-------- .../rf_prune/query44.out | 69 +++++++++---------- .../rf_prune/query76.out | 45 ++++++------ .../rf_prune/query95.out | 59 ++++++++-------- .../shape/query44.out | 69 +++++++++---------- .../shape/query76.out | 45 ++++++------ .../shape/query95.out | 59 ++++++++-------- .../test_partial_update_seq_col.groovy | 10 +-- 14 files changed, 331 insertions(+), 303 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/stats/FilterEstimation.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/stats/FilterEstimation.java index d5c9ded22e360d..b716b350f24b84 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/stats/FilterEstimation.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/stats/FilterEstimation.java @@ -414,7 +414,8 @@ public Statistics visitIsNull(IsNull isNull, EstimationContext context) { .setMinValue(Double.NEGATIVE_INFINITY) .setNdv(0); StatisticsBuilder builder = new StatisticsBuilder(context.statistics); - builder.putColumnStatistics(isNull.child(), colBuilder.build()); + builder.setRowCount(outputRowCount); + builder.putColumnStatistics(isNull, colBuilder.build()); context.addKeyIfSlot(isNull.child()); return builder.build(); } diff --git a/fe/fe-core/src/test/java/org/apache/doris/nereids/stats/FilterEstimationTest.java b/fe/fe-core/src/test/java/org/apache/doris/nereids/stats/FilterEstimationTest.java index 246e556824ef17..f5491c633313e0 100644 --- a/fe/fe-core/src/test/java/org/apache/doris/nereids/stats/FilterEstimationTest.java +++ b/fe/fe-core/src/test/java/org/apache/doris/nereids/stats/FilterEstimationTest.java @@ -25,6 +25,7 @@ import org.apache.doris.nereids.trees.expressions.GreaterThan; import org.apache.doris.nereids.trees.expressions.GreaterThanEqual; import org.apache.doris.nereids.trees.expressions.InPredicate; +import org.apache.doris.nereids.trees.expressions.IsNull; import org.apache.doris.nereids.trees.expressions.LessThan; import org.apache.doris.nereids.trees.expressions.LessThanEqual; import org.apache.doris.nereids.trees.expressions.Not; @@ -872,4 +873,41 @@ public void testDateRangeSelectivity() { Statistics result = filterEstimation.estimate(greaterThan, stats); Assertions.assertEquals(result.getRowCount(), 10, 0.1); } + + @Test + public void testIsNull() { + SlotReference a = new SlotReference("a", IntegerType.INSTANCE); + ColumnStatisticBuilder builder = new ColumnStatisticBuilder() + .setNdv(100) + .setAvgSizeByte(4) + .setNumNulls(10) + .setMaxValue(100) + .setMinValue(0) + .setCount(100); + IsNull isNull = new IsNull(a); + Statistics stats = new Statistics(100, new HashMap<>()); + stats.addColumnStats(a, builder.build()); + FilterEstimation filterEstimation = new FilterEstimation(); + Statistics result = filterEstimation.estimate(isNull, stats); + Assertions.assertEquals(result.getRowCount(), 10); + } + + @Test + public void testIsNotNull() { + SlotReference a = new SlotReference("a", IntegerType.INSTANCE); + ColumnStatisticBuilder builder = new ColumnStatisticBuilder() + .setNdv(100) + .setAvgSizeByte(4) + .setNumNulls(10) + .setMaxValue(100) + .setMinValue(0) + .setCount(100); + IsNull isNull = new IsNull(a); + Not not = new Not(isNull); + Statistics stats = new Statistics(100, new HashMap<>()); + stats.addColumnStats(a, builder.build()); + FilterEstimation filterEstimation = new FilterEstimation(); + Statistics result = filterEstimation.estimate(not, stats); + Assertions.assertEquals(result.getRowCount(), 90); + } } diff --git a/regression-test/data/nereids_tpcds_shape_sf1000_p0/shape/query76.out b/regression-test/data/nereids_tpcds_shape_sf1000_p0/shape/query76.out index 5aa9559b23c27c..3f46749fc61f17 100644 --- a/regression-test/data/nereids_tpcds_shape_sf1000_p0/shape/query76.out +++ b/regression-test/data/nereids_tpcds_shape_sf1000_p0/shape/query76.out @@ -23,28 +23,30 @@ PhysicalResultSink --------------------------PhysicalOlapScan[item] ----------------PhysicalDistribute ------------------PhysicalProject ---------------------hashJoin[INNER_JOIN] hashCondition=((web_sales.ws_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF3 i_item_sk->[ws_item_sk] -----------------------hashJoin[INNER_JOIN] hashCondition=((web_sales.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF2 d_date_sk->[ws_sold_date_sk] -------------------------PhysicalProject ---------------------------filter(ws_promo_sk IS NULL) -----------------------------PhysicalOlapScan[web_sales] apply RFs: RF2 RF3 -------------------------PhysicalDistribute ---------------------------PhysicalProject -----------------------------PhysicalOlapScan[date_dim] +--------------------hashJoin[INNER_JOIN] hashCondition=((web_sales.ws_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF3 ws_item_sk->[i_item_sk] +----------------------PhysicalProject +------------------------PhysicalOlapScan[item] apply RFs: RF3 ----------------------PhysicalDistribute -------------------------PhysicalProject ---------------------------PhysicalOlapScan[item] -----------------PhysicalDistribute -------------------PhysicalProject ---------------------hashJoin[INNER_JOIN] hashCondition=((catalog_sales.cs_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF5 i_item_sk->[cs_item_sk] +------------------------hashJoin[INNER_JOIN] hashCondition=((web_sales.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF2 d_date_sk->[ws_sold_date_sk] +--------------------------PhysicalDistribute +----------------------------PhysicalProject +------------------------------filter(ws_promo_sk IS NULL) +--------------------------------PhysicalOlapScan[web_sales] apply RFs: RF2 +--------------------------PhysicalDistribute +----------------------------PhysicalProject +------------------------------PhysicalOlapScan[date_dim] +----------------PhysicalProject +------------------hashJoin[INNER_JOIN] hashCondition=((catalog_sales.cs_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF5 i_item_sk->[cs_item_sk] +--------------------PhysicalDistribute ----------------------hashJoin[INNER_JOIN] hashCondition=((catalog_sales.cs_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF4 d_date_sk->[cs_sold_date_sk] -------------------------PhysicalProject ---------------------------filter(cs_bill_customer_sk IS NULL) -----------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF4 RF5 +------------------------PhysicalDistribute +--------------------------PhysicalProject +----------------------------filter(cs_bill_customer_sk IS NULL) +------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF4 RF5 ------------------------PhysicalDistribute --------------------------PhysicalProject ----------------------------PhysicalOlapScan[date_dim] -----------------------PhysicalDistribute -------------------------PhysicalProject ---------------------------PhysicalOlapScan[item] +--------------------PhysicalDistribute +----------------------PhysicalProject +------------------------PhysicalOlapScan[item] diff --git a/regression-test/data/nereids_tpcds_shape_sf1000_p0/shape/query95.out b/regression-test/data/nereids_tpcds_shape_sf1000_p0/shape/query95.out index c82d2ae58d3489..6720aab10b8d4e 100644 --- a/regression-test/data/nereids_tpcds_shape_sf1000_p0/shape/query95.out +++ b/regression-test/data/nereids_tpcds_shape_sf1000_p0/shape/query95.out @@ -13,42 +13,41 @@ PhysicalCteAnchor ( cteId=CTEId#0 ) --PhysicalResultSink ----PhysicalTopN[MERGE_SORT] ------PhysicalTopN[LOCAL_SORT] ---------PhysicalProject -----------hashAgg[DISTINCT_GLOBAL] -------------PhysicalDistribute ---------------hashAgg[DISTINCT_LOCAL] -----------------hashAgg[GLOBAL] -------------------hashAgg[LOCAL] ---------------------PhysicalProject -----------------------hashJoin[RIGHT_SEMI_JOIN] hashCondition=((ws1.ws_order_number = web_returns.wr_order_number)) otherCondition=() -------------------------PhysicalProject ---------------------------hashJoin[INNER_JOIN] hashCondition=((web_returns.wr_order_number = ws_wh.ws_order_number)) otherCondition=() build RFs:RF5 wr_order_number->[ws_order_number];RF6 wr_order_number->[ws_order_number,ws_order_number] -----------------------------PhysicalDistribute -------------------------------PhysicalProject ---------------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) -----------------------------PhysicalDistribute -------------------------------PhysicalProject ---------------------------------PhysicalOlapScan[web_returns] -------------------------hashJoin[RIGHT_SEMI_JOIN] hashCondition=((ws1.ws_order_number = ws_wh.ws_order_number)) otherCondition=() build RFs:RF4 ws_order_number->[ws_order_number];RF7 ws_order_number->[ws_order_number,ws_order_number] +--------hashAgg[DISTINCT_GLOBAL] +----------PhysicalDistribute +------------hashAgg[DISTINCT_LOCAL] +--------------hashAgg[GLOBAL] +----------------hashAgg[LOCAL] +------------------PhysicalProject +--------------------hashJoin[RIGHT_SEMI_JOIN] hashCondition=((ws1.ws_order_number = web_returns.wr_order_number)) otherCondition=() +----------------------PhysicalProject +------------------------hashJoin[INNER_JOIN] hashCondition=((web_returns.wr_order_number = ws_wh.ws_order_number)) otherCondition=() build RFs:RF5 wr_order_number->[ws_order_number];RF6 wr_order_number->[ws_order_number,ws_order_number] --------------------------PhysicalDistribute ----------------------------PhysicalProject ------------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) --------------------------PhysicalDistribute -----------------------------hashJoin[INNER_JOIN] hashCondition=((ws1.ws_web_site_sk = web_site.web_site_sk)) otherCondition=() build RFs:RF3 web_site_sk->[ws_web_site_sk] -------------------------------hashJoin[INNER_JOIN] hashCondition=((ws1.ws_ship_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF2 d_date_sk->[ws_ship_date_sk] ---------------------------------hashJoin[INNER_JOIN] hashCondition=((ws1.ws_ship_addr_sk = customer_address.ca_address_sk)) otherCondition=() build RFs:RF1 ca_address_sk->[ws_ship_addr_sk] -----------------------------------PhysicalProject -------------------------------------PhysicalOlapScan[web_sales] apply RFs: RF1 RF2 RF3 -----------------------------------PhysicalDistribute -------------------------------------PhysicalProject ---------------------------------------filter((customer_address.ca_state = 'VA')) -----------------------------------------PhysicalOlapScan[customer_address] +----------------------------PhysicalProject +------------------------------PhysicalOlapScan[web_returns] +----------------------hashJoin[RIGHT_SEMI_JOIN] hashCondition=((ws1.ws_order_number = ws_wh.ws_order_number)) otherCondition=() build RFs:RF4 ws_order_number->[ws_order_number];RF7 ws_order_number->[ws_order_number,ws_order_number] +------------------------PhysicalDistribute +--------------------------PhysicalProject +----------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) +------------------------PhysicalDistribute +--------------------------hashJoin[INNER_JOIN] hashCondition=((ws1.ws_web_site_sk = web_site.web_site_sk)) otherCondition=() build RFs:RF3 web_site_sk->[ws_web_site_sk] +----------------------------hashJoin[INNER_JOIN] hashCondition=((ws1.ws_ship_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF2 d_date_sk->[ws_ship_date_sk] +------------------------------hashJoin[INNER_JOIN] hashCondition=((ws1.ws_ship_addr_sk = customer_address.ca_address_sk)) otherCondition=() build RFs:RF1 ca_address_sk->[ws_ship_addr_sk] +--------------------------------PhysicalProject +----------------------------------PhysicalOlapScan[web_sales] apply RFs: RF1 RF2 RF3 --------------------------------PhysicalDistribute ----------------------------------PhysicalProject -------------------------------------filter((date_dim.d_date <= '2001-05-31') and (date_dim.d_date >= '2001-04-01')) ---------------------------------------PhysicalOlapScan[date_dim] +------------------------------------filter((customer_address.ca_state = 'VA')) +--------------------------------------PhysicalOlapScan[customer_address] ------------------------------PhysicalDistribute --------------------------------PhysicalProject -----------------------------------filter((web_site.web_company_name = 'pri')) -------------------------------------PhysicalOlapScan[web_site] +----------------------------------filter((date_dim.d_date <= '2001-05-31') and (date_dim.d_date >= '2001-04-01')) +------------------------------------PhysicalOlapScan[date_dim] +----------------------------PhysicalDistribute +------------------------------PhysicalProject +--------------------------------filter((web_site.web_company_name = 'pri')) +----------------------------------PhysicalOlapScan[web_site] diff --git a/regression-test/data/nereids_tpcds_shape_sf1000_p0/shape/query97.out b/regression-test/data/nereids_tpcds_shape_sf1000_p0/shape/query97.out index bbc900d82cbeac..bb1f3c8efc6cc0 100644 --- a/regression-test/data/nereids_tpcds_shape_sf1000_p0/shape/query97.out +++ b/regression-test/data/nereids_tpcds_shape_sf1000_p0/shape/query97.out @@ -13,25 +13,25 @@ PhysicalResultSink --------------------PhysicalDistribute ----------------------hashAgg[LOCAL] ------------------------PhysicalProject ---------------------------hashJoin[INNER_JOIN] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF1 ss_sold_date_sk->[d_date_sk] +--------------------------hashJoin[INNER_JOIN] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF1 d_date_sk->[ss_sold_date_sk] ----------------------------PhysicalProject -------------------------------filter((date_dim.d_month_seq <= 1210) and (date_dim.d_month_seq >= 1199)) ---------------------------------PhysicalOlapScan[date_dim] apply RFs: RF1 +------------------------------filter(( not ss_sold_date_sk IS NULL)) +--------------------------------PhysicalOlapScan[store_sales] apply RFs: RF1 ----------------------------PhysicalDistribute ------------------------------PhysicalProject ---------------------------------filter(( not ss_sold_date_sk IS NULL)) -----------------------------------PhysicalOlapScan[store_sales] +--------------------------------filter((date_dim.d_month_seq <= 1210) and (date_dim.d_month_seq >= 1199)) +----------------------------------PhysicalOlapScan[date_dim] ----------------PhysicalProject ------------------hashAgg[GLOBAL] --------------------PhysicalDistribute ----------------------hashAgg[LOCAL] ------------------------PhysicalProject ---------------------------hashJoin[INNER_JOIN] hashCondition=((catalog_sales.cs_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF0 cs_sold_date_sk->[d_date_sk] +--------------------------hashJoin[INNER_JOIN] hashCondition=((catalog_sales.cs_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF0 d_date_sk->[cs_sold_date_sk] ----------------------------PhysicalProject -------------------------------filter((date_dim.d_month_seq <= 1210) and (date_dim.d_month_seq >= 1199)) ---------------------------------PhysicalOlapScan[date_dim] apply RFs: RF0 +------------------------------filter(( not cs_sold_date_sk IS NULL)) +--------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF0 ----------------------------PhysicalDistribute ------------------------------PhysicalProject ---------------------------------filter(( not cs_sold_date_sk IS NULL)) -----------------------------------PhysicalOlapScan[catalog_sales] +--------------------------------filter((date_dim.d_month_seq <= 1210) and (date_dim.d_month_seq >= 1199)) +----------------------------------PhysicalOlapScan[date_dim] diff --git a/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query95.out b/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query95.out index 226b8c9767817e..d2ecc4813b5cdc 100644 --- a/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query95.out +++ b/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query95.out @@ -13,42 +13,41 @@ PhysicalCteAnchor ( cteId=CTEId#0 ) --PhysicalResultSink ----PhysicalTopN[MERGE_SORT] ------PhysicalTopN[LOCAL_SORT] ---------PhysicalProject -----------hashAgg[DISTINCT_GLOBAL] -------------PhysicalDistribute ---------------hashAgg[DISTINCT_LOCAL] -----------------hashAgg[GLOBAL] -------------------hashAgg[LOCAL] ---------------------PhysicalProject -----------------------hashJoin[RIGHT_SEMI_JOIN] hashCondition=((ws1.ws_order_number = web_returns.wr_order_number)) otherCondition=() -------------------------PhysicalProject ---------------------------hashJoin[INNER_JOIN] hashCondition=((web_returns.wr_order_number = ws_wh.ws_order_number)) otherCondition=() build RFs:RF5 wr_order_number->[ws_order_number];RF6 wr_order_number->[ws_order_number,ws_order_number] -----------------------------PhysicalDistribute -------------------------------PhysicalProject ---------------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) -----------------------------PhysicalDistribute -------------------------------PhysicalProject ---------------------------------PhysicalOlapScan[web_returns] -------------------------hashJoin[RIGHT_SEMI_JOIN] hashCondition=((ws1.ws_order_number = ws_wh.ws_order_number)) otherCondition=() build RFs:RF4 ws_order_number->[ws_order_number];RF7 ws_order_number->[ws_order_number,ws_order_number] +--------hashAgg[DISTINCT_GLOBAL] +----------PhysicalDistribute +------------hashAgg[DISTINCT_LOCAL] +--------------hashAgg[GLOBAL] +----------------hashAgg[LOCAL] +------------------PhysicalProject +--------------------hashJoin[RIGHT_SEMI_JOIN] hashCondition=((ws1.ws_order_number = web_returns.wr_order_number)) otherCondition=() +----------------------PhysicalProject +------------------------hashJoin[INNER_JOIN] hashCondition=((web_returns.wr_order_number = ws_wh.ws_order_number)) otherCondition=() build RFs:RF5 wr_order_number->[ws_order_number];RF6 wr_order_number->[ws_order_number,ws_order_number] --------------------------PhysicalDistribute ----------------------------PhysicalProject ------------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) --------------------------PhysicalDistribute -----------------------------hashJoin[INNER_JOIN] hashCondition=((ws1.ws_web_site_sk = web_site.web_site_sk)) otherCondition=() build RFs:RF3 web_site_sk->[ws_web_site_sk] -------------------------------hashJoin[INNER_JOIN] hashCondition=((ws1.ws_ship_addr_sk = customer_address.ca_address_sk)) otherCondition=() build RFs:RF2 ca_address_sk->[ws_ship_addr_sk] ---------------------------------hashJoin[INNER_JOIN] hashCondition=((ws1.ws_ship_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF1 d_date_sk->[ws_ship_date_sk] -----------------------------------PhysicalProject -------------------------------------PhysicalOlapScan[web_sales] apply RFs: RF1 RF2 RF3 -----------------------------------PhysicalDistribute -------------------------------------PhysicalProject ---------------------------------------filter((date_dim.d_date <= '1999-04-02') and (date_dim.d_date >= '1999-02-01')) -----------------------------------------PhysicalOlapScan[date_dim] +----------------------------PhysicalProject +------------------------------PhysicalOlapScan[web_returns] +----------------------hashJoin[RIGHT_SEMI_JOIN] hashCondition=((ws1.ws_order_number = ws_wh.ws_order_number)) otherCondition=() build RFs:RF4 ws_order_number->[ws_order_number];RF7 ws_order_number->[ws_order_number,ws_order_number] +------------------------PhysicalDistribute +--------------------------PhysicalProject +----------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) +------------------------PhysicalDistribute +--------------------------hashJoin[INNER_JOIN] hashCondition=((ws1.ws_web_site_sk = web_site.web_site_sk)) otherCondition=() build RFs:RF3 web_site_sk->[ws_web_site_sk] +----------------------------hashJoin[INNER_JOIN] hashCondition=((ws1.ws_ship_addr_sk = customer_address.ca_address_sk)) otherCondition=() build RFs:RF2 ca_address_sk->[ws_ship_addr_sk] +------------------------------hashJoin[INNER_JOIN] hashCondition=((ws1.ws_ship_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF1 d_date_sk->[ws_ship_date_sk] +--------------------------------PhysicalProject +----------------------------------PhysicalOlapScan[web_sales] apply RFs: RF1 RF2 RF3 --------------------------------PhysicalDistribute ----------------------------------PhysicalProject -------------------------------------filter((customer_address.ca_state = 'NC')) ---------------------------------------PhysicalOlapScan[customer_address] +------------------------------------filter((date_dim.d_date <= '1999-04-02') and (date_dim.d_date >= '1999-02-01')) +--------------------------------------PhysicalOlapScan[date_dim] ------------------------------PhysicalDistribute --------------------------------PhysicalProject -----------------------------------filter((web_site.web_company_name = 'pri')) -------------------------------------PhysicalOlapScan[web_site] +----------------------------------filter((customer_address.ca_state = 'NC')) +------------------------------------PhysicalOlapScan[customer_address] +----------------------------PhysicalDistribute +------------------------------PhysicalProject +--------------------------------filter((web_site.web_company_name = 'pri')) +----------------------------------PhysicalOlapScan[web_site] diff --git a/regression-test/data/nereids_tpcds_shape_sf100_p0/no_stats_shape/query95.out b/regression-test/data/nereids_tpcds_shape_sf100_p0/no_stats_shape/query95.out index 226b8c9767817e..d2ecc4813b5cdc 100644 --- a/regression-test/data/nereids_tpcds_shape_sf100_p0/no_stats_shape/query95.out +++ b/regression-test/data/nereids_tpcds_shape_sf100_p0/no_stats_shape/query95.out @@ -13,42 +13,41 @@ PhysicalCteAnchor ( cteId=CTEId#0 ) --PhysicalResultSink ----PhysicalTopN[MERGE_SORT] ------PhysicalTopN[LOCAL_SORT] ---------PhysicalProject -----------hashAgg[DISTINCT_GLOBAL] -------------PhysicalDistribute ---------------hashAgg[DISTINCT_LOCAL] -----------------hashAgg[GLOBAL] -------------------hashAgg[LOCAL] ---------------------PhysicalProject -----------------------hashJoin[RIGHT_SEMI_JOIN] hashCondition=((ws1.ws_order_number = web_returns.wr_order_number)) otherCondition=() -------------------------PhysicalProject ---------------------------hashJoin[INNER_JOIN] hashCondition=((web_returns.wr_order_number = ws_wh.ws_order_number)) otherCondition=() build RFs:RF5 wr_order_number->[ws_order_number];RF6 wr_order_number->[ws_order_number,ws_order_number] -----------------------------PhysicalDistribute -------------------------------PhysicalProject ---------------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) -----------------------------PhysicalDistribute -------------------------------PhysicalProject ---------------------------------PhysicalOlapScan[web_returns] -------------------------hashJoin[RIGHT_SEMI_JOIN] hashCondition=((ws1.ws_order_number = ws_wh.ws_order_number)) otherCondition=() build RFs:RF4 ws_order_number->[ws_order_number];RF7 ws_order_number->[ws_order_number,ws_order_number] +--------hashAgg[DISTINCT_GLOBAL] +----------PhysicalDistribute +------------hashAgg[DISTINCT_LOCAL] +--------------hashAgg[GLOBAL] +----------------hashAgg[LOCAL] +------------------PhysicalProject +--------------------hashJoin[RIGHT_SEMI_JOIN] hashCondition=((ws1.ws_order_number = web_returns.wr_order_number)) otherCondition=() +----------------------PhysicalProject +------------------------hashJoin[INNER_JOIN] hashCondition=((web_returns.wr_order_number = ws_wh.ws_order_number)) otherCondition=() build RFs:RF5 wr_order_number->[ws_order_number];RF6 wr_order_number->[ws_order_number,ws_order_number] --------------------------PhysicalDistribute ----------------------------PhysicalProject ------------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) --------------------------PhysicalDistribute -----------------------------hashJoin[INNER_JOIN] hashCondition=((ws1.ws_web_site_sk = web_site.web_site_sk)) otherCondition=() build RFs:RF3 web_site_sk->[ws_web_site_sk] -------------------------------hashJoin[INNER_JOIN] hashCondition=((ws1.ws_ship_addr_sk = customer_address.ca_address_sk)) otherCondition=() build RFs:RF2 ca_address_sk->[ws_ship_addr_sk] ---------------------------------hashJoin[INNER_JOIN] hashCondition=((ws1.ws_ship_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF1 d_date_sk->[ws_ship_date_sk] -----------------------------------PhysicalProject -------------------------------------PhysicalOlapScan[web_sales] apply RFs: RF1 RF2 RF3 -----------------------------------PhysicalDistribute -------------------------------------PhysicalProject ---------------------------------------filter((date_dim.d_date <= '1999-04-02') and (date_dim.d_date >= '1999-02-01')) -----------------------------------------PhysicalOlapScan[date_dim] +----------------------------PhysicalProject +------------------------------PhysicalOlapScan[web_returns] +----------------------hashJoin[RIGHT_SEMI_JOIN] hashCondition=((ws1.ws_order_number = ws_wh.ws_order_number)) otherCondition=() build RFs:RF4 ws_order_number->[ws_order_number];RF7 ws_order_number->[ws_order_number,ws_order_number] +------------------------PhysicalDistribute +--------------------------PhysicalProject +----------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) +------------------------PhysicalDistribute +--------------------------hashJoin[INNER_JOIN] hashCondition=((ws1.ws_web_site_sk = web_site.web_site_sk)) otherCondition=() build RFs:RF3 web_site_sk->[ws_web_site_sk] +----------------------------hashJoin[INNER_JOIN] hashCondition=((ws1.ws_ship_addr_sk = customer_address.ca_address_sk)) otherCondition=() build RFs:RF2 ca_address_sk->[ws_ship_addr_sk] +------------------------------hashJoin[INNER_JOIN] hashCondition=((ws1.ws_ship_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF1 d_date_sk->[ws_ship_date_sk] +--------------------------------PhysicalProject +----------------------------------PhysicalOlapScan[web_sales] apply RFs: RF1 RF2 RF3 --------------------------------PhysicalDistribute ----------------------------------PhysicalProject -------------------------------------filter((customer_address.ca_state = 'NC')) ---------------------------------------PhysicalOlapScan[customer_address] +------------------------------------filter((date_dim.d_date <= '1999-04-02') and (date_dim.d_date >= '1999-02-01')) +--------------------------------------PhysicalOlapScan[date_dim] ------------------------------PhysicalDistribute --------------------------------PhysicalProject -----------------------------------filter((web_site.web_company_name = 'pri')) -------------------------------------PhysicalOlapScan[web_site] +----------------------------------filter((customer_address.ca_state = 'NC')) +------------------------------------PhysicalOlapScan[customer_address] +----------------------------PhysicalDistribute +------------------------------PhysicalProject +--------------------------------filter((web_site.web_company_name = 'pri')) +----------------------------------PhysicalOlapScan[web_site] diff --git a/regression-test/data/nereids_tpcds_shape_sf100_p0/rf_prune/query44.out b/regression-test/data/nereids_tpcds_shape_sf100_p0/rf_prune/query44.out index 2c3fc9a8c25db2..35ca3b8e453b6e 100644 --- a/regression-test/data/nereids_tpcds_shape_sf100_p0/rf_prune/query44.out +++ b/regression-test/data/nereids_tpcds_shape_sf100_p0/rf_prune/query44.out @@ -5,12 +5,42 @@ PhysicalResultSink ----PhysicalDistribute ------PhysicalTopN[LOCAL_SORT] --------PhysicalProject -----------hashJoin[INNER_JOIN] hashCondition=((asceding.rnk = descending.rnk)) otherCondition=() +----------hashJoin[INNER_JOIN] hashCondition=((i2.i_item_sk = descending.item_sk)) otherCondition=() build RFs:RF1 item_sk->[i_item_sk] +------------PhysicalProject +--------------PhysicalOlapScan[item] apply RFs: RF1 ------------PhysicalDistribute --------------PhysicalProject -----------------hashJoin[INNER_JOIN] hashCondition=((i1.i_item_sk = asceding.item_sk)) otherCondition=() build RFs:RF1 item_sk->[i_item_sk] -------------------PhysicalProject ---------------------PhysicalOlapScan[item] apply RFs: RF1 +----------------hashJoin[INNER_JOIN] hashCondition=((asceding.rnk = descending.rnk)) otherCondition=() +------------------hashJoin[INNER_JOIN] hashCondition=((i1.i_item_sk = asceding.item_sk)) otherCondition=() build RFs:RF0 item_sk->[i_item_sk] +--------------------PhysicalProject +----------------------PhysicalOlapScan[item] apply RFs: RF0 +--------------------PhysicalDistribute +----------------------PhysicalProject +------------------------filter((rnk < 11)) +--------------------------PhysicalWindow +----------------------------PhysicalQuickSort[MERGE_SORT] +------------------------------PhysicalDistribute +--------------------------------PhysicalQuickSort[LOCAL_SORT] +----------------------------------PhysicalPartitionTopN +------------------------------------PhysicalProject +--------------------------------------NestedLoopJoin[INNER_JOIN](cast(rank_col as DOUBLE) > cast((0.9 * rank_col) as DOUBLE)) +----------------------------------------PhysicalProject +------------------------------------------hashAgg[GLOBAL] +--------------------------------------------PhysicalDistribute +----------------------------------------------hashAgg[LOCAL] +------------------------------------------------PhysicalProject +--------------------------------------------------filter((ss1.ss_store_sk = 146)) +----------------------------------------------------PhysicalOlapScan[store_sales] +----------------------------------------PhysicalDistribute +------------------------------------------PhysicalAssertNumRows +--------------------------------------------PhysicalDistribute +----------------------------------------------PhysicalProject +------------------------------------------------hashAgg[GLOBAL] +--------------------------------------------------PhysicalDistribute +----------------------------------------------------hashAgg[LOCAL] +------------------------------------------------------PhysicalProject +--------------------------------------------------------filter((store_sales.ss_store_sk = 146) and ss_addr_sk IS NULL) +----------------------------------------------------------PhysicalOlapScan[store_sales] ------------------PhysicalDistribute --------------------PhysicalProject ----------------------filter((rnk < 11)) @@ -38,35 +68,4 @@ PhysicalResultSink ----------------------------------------------------PhysicalProject ------------------------------------------------------filter((store_sales.ss_store_sk = 146) and ss_addr_sk IS NULL) --------------------------------------------------------PhysicalOlapScan[store_sales] -------------PhysicalDistribute ---------------hashJoin[INNER_JOIN] hashCondition=((i2.i_item_sk = descending.item_sk)) otherCondition=() build RFs:RF0 item_sk->[i_item_sk] -----------------PhysicalProject -------------------PhysicalOlapScan[item] apply RFs: RF0 -----------------PhysicalDistribute -------------------PhysicalProject ---------------------filter((rnk < 11)) -----------------------PhysicalWindow -------------------------PhysicalQuickSort[MERGE_SORT] ---------------------------PhysicalDistribute -----------------------------PhysicalQuickSort[LOCAL_SORT] -------------------------------PhysicalPartitionTopN ---------------------------------PhysicalProject -----------------------------------NestedLoopJoin[INNER_JOIN](cast(rank_col as DOUBLE) > cast((0.9 * rank_col) as DOUBLE)) -------------------------------------PhysicalProject ---------------------------------------hashAgg[GLOBAL] -----------------------------------------PhysicalDistribute -------------------------------------------hashAgg[LOCAL] ---------------------------------------------PhysicalProject -----------------------------------------------filter((ss1.ss_store_sk = 146)) -------------------------------------------------PhysicalOlapScan[store_sales] -------------------------------------PhysicalDistribute ---------------------------------------PhysicalAssertNumRows -----------------------------------------PhysicalDistribute -------------------------------------------PhysicalProject ---------------------------------------------hashAgg[GLOBAL] -----------------------------------------------PhysicalDistribute -------------------------------------------------hashAgg[LOCAL] ---------------------------------------------------PhysicalProject -----------------------------------------------------filter((store_sales.ss_store_sk = 146) and ss_addr_sk IS NULL) -------------------------------------------------------PhysicalOlapScan[store_sales] diff --git a/regression-test/data/nereids_tpcds_shape_sf100_p0/rf_prune/query76.out b/regression-test/data/nereids_tpcds_shape_sf100_p0/rf_prune/query76.out index 4e8160680f38b5..00c4bba1df69bb 100644 --- a/regression-test/data/nereids_tpcds_shape_sf100_p0/rf_prune/query76.out +++ b/regression-test/data/nereids_tpcds_shape_sf100_p0/rf_prune/query76.out @@ -10,44 +10,41 @@ PhysicalResultSink --------------PhysicalUnion ----------------PhysicalDistribute ------------------PhysicalProject ---------------------hashJoin[INNER_JOIN] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() +--------------------hashJoin[INNER_JOIN] hashCondition=((store_sales.ss_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF1 ss_item_sk->[i_item_sk] ----------------------PhysicalProject -------------------------hashJoin[INNER_JOIN] hashCondition=((store_sales.ss_item_sk = item.i_item_sk)) otherCondition=() +------------------------PhysicalOlapScan[item] apply RFs: RF1 +----------------------PhysicalDistribute +------------------------hashJoin[INNER_JOIN] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF0 ss_sold_date_sk->[d_date_sk] --------------------------PhysicalProject -----------------------------filter(ss_hdemo_sk IS NULL) -------------------------------PhysicalOlapScan[store_sales] +----------------------------PhysicalOlapScan[date_dim] apply RFs: RF0 --------------------------PhysicalDistribute ----------------------------PhysicalProject -------------------------------PhysicalOlapScan[item] -----------------------PhysicalDistribute -------------------------PhysicalProject ---------------------------PhysicalOlapScan[date_dim] +------------------------------filter(ss_hdemo_sk IS NULL) +--------------------------------PhysicalOlapScan[store_sales] ----------------PhysicalDistribute ------------------PhysicalProject ---------------------hashJoin[INNER_JOIN] hashCondition=((web_sales.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF3 d_date_sk->[ws_sold_date_sk] +--------------------hashJoin[INNER_JOIN] hashCondition=((web_sales.ws_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF3 ws_item_sk->[i_item_sk] ----------------------PhysicalProject -------------------------hashJoin[INNER_JOIN] hashCondition=((web_sales.ws_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF2 i_item_sk->[ws_item_sk] +------------------------PhysicalOlapScan[item] apply RFs: RF3 +----------------------PhysicalDistribute +------------------------hashJoin[INNER_JOIN] hashCondition=((web_sales.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF2 ws_sold_date_sk->[d_date_sk] --------------------------PhysicalProject -----------------------------filter(ws_bill_addr_sk IS NULL) -------------------------------PhysicalOlapScan[web_sales] apply RFs: RF2 RF3 +----------------------------PhysicalOlapScan[date_dim] apply RFs: RF2 --------------------------PhysicalDistribute ----------------------------PhysicalProject -------------------------------PhysicalOlapScan[item] -----------------------PhysicalDistribute -------------------------PhysicalProject ---------------------------PhysicalOlapScan[date_dim] +------------------------------filter(ws_bill_addr_sk IS NULL) +--------------------------------PhysicalOlapScan[web_sales] ----------------PhysicalDistribute ------------------PhysicalProject ---------------------hashJoin[INNER_JOIN] hashCondition=((catalog_sales.cs_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF5 d_date_sk->[cs_sold_date_sk] +--------------------hashJoin[INNER_JOIN] hashCondition=((catalog_sales.cs_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF5 cs_item_sk->[i_item_sk] ----------------------PhysicalProject -------------------------hashJoin[INNER_JOIN] hashCondition=((catalog_sales.cs_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF4 i_item_sk->[cs_item_sk] +------------------------PhysicalOlapScan[item] apply RFs: RF5 +----------------------PhysicalDistribute +------------------------hashJoin[INNER_JOIN] hashCondition=((catalog_sales.cs_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF4 cs_sold_date_sk->[d_date_sk] --------------------------PhysicalProject -----------------------------filter(cs_warehouse_sk IS NULL) -------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF4 RF5 +----------------------------PhysicalOlapScan[date_dim] apply RFs: RF4 --------------------------PhysicalDistribute ----------------------------PhysicalProject -------------------------------PhysicalOlapScan[item] -----------------------PhysicalDistribute -------------------------PhysicalProject ---------------------------PhysicalOlapScan[date_dim] +------------------------------filter(cs_warehouse_sk IS NULL) +--------------------------------PhysicalOlapScan[catalog_sales] diff --git a/regression-test/data/nereids_tpcds_shape_sf100_p0/rf_prune/query95.out b/regression-test/data/nereids_tpcds_shape_sf100_p0/rf_prune/query95.out index 4fcf27b7e65999..bde9dbef392330 100644 --- a/regression-test/data/nereids_tpcds_shape_sf100_p0/rf_prune/query95.out +++ b/regression-test/data/nereids_tpcds_shape_sf100_p0/rf_prune/query95.out @@ -13,42 +13,41 @@ PhysicalCteAnchor ( cteId=CTEId#0 ) --PhysicalResultSink ----PhysicalTopN[MERGE_SORT] ------PhysicalTopN[LOCAL_SORT] ---------PhysicalProject -----------hashAgg[DISTINCT_GLOBAL] -------------PhysicalDistribute ---------------hashAgg[DISTINCT_LOCAL] -----------------hashAgg[GLOBAL] -------------------hashAgg[LOCAL] ---------------------PhysicalProject -----------------------hashJoin[RIGHT_SEMI_JOIN] hashCondition=((ws1.ws_order_number = web_returns.wr_order_number)) otherCondition=() -------------------------PhysicalProject ---------------------------hashJoin[INNER_JOIN] hashCondition=((web_returns.wr_order_number = ws_wh.ws_order_number)) otherCondition=() build RFs:RF5 wr_order_number->[ws_order_number];RF6 wr_order_number->[ws_order_number,ws_order_number] -----------------------------PhysicalDistribute -------------------------------PhysicalProject ---------------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) -----------------------------PhysicalDistribute -------------------------------PhysicalProject ---------------------------------PhysicalOlapScan[web_returns] -------------------------hashJoin[RIGHT_SEMI_JOIN] hashCondition=((ws1.ws_order_number = ws_wh.ws_order_number)) otherCondition=() build RFs:RF4 ws_order_number->[ws_order_number];RF7 ws_order_number->[ws_order_number,ws_order_number] +--------hashAgg[DISTINCT_GLOBAL] +----------PhysicalDistribute +------------hashAgg[DISTINCT_LOCAL] +--------------hashAgg[GLOBAL] +----------------hashAgg[LOCAL] +------------------PhysicalProject +--------------------hashJoin[RIGHT_SEMI_JOIN] hashCondition=((ws1.ws_order_number = web_returns.wr_order_number)) otherCondition=() +----------------------PhysicalProject +------------------------hashJoin[INNER_JOIN] hashCondition=((web_returns.wr_order_number = ws_wh.ws_order_number)) otherCondition=() build RFs:RF5 wr_order_number->[ws_order_number];RF6 wr_order_number->[ws_order_number,ws_order_number] --------------------------PhysicalDistribute ----------------------------PhysicalProject ------------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) --------------------------PhysicalDistribute -----------------------------hashJoin[INNER_JOIN] hashCondition=((ws1.ws_web_site_sk = web_site.web_site_sk)) otherCondition=() build RFs:RF3 web_site_sk->[ws_web_site_sk] -------------------------------hashJoin[INNER_JOIN] hashCondition=((ws1.ws_ship_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF2 d_date_sk->[ws_ship_date_sk] ---------------------------------hashJoin[INNER_JOIN] hashCondition=((ws1.ws_ship_addr_sk = customer_address.ca_address_sk)) otherCondition=() build RFs:RF1 ca_address_sk->[ws_ship_addr_sk] -----------------------------------PhysicalProject -------------------------------------PhysicalOlapScan[web_sales] apply RFs: RF1 RF2 RF3 -----------------------------------PhysicalDistribute -------------------------------------PhysicalProject ---------------------------------------filter((customer_address.ca_state = 'NC')) -----------------------------------------PhysicalOlapScan[customer_address] +----------------------------PhysicalProject +------------------------------PhysicalOlapScan[web_returns] +----------------------hashJoin[RIGHT_SEMI_JOIN] hashCondition=((ws1.ws_order_number = ws_wh.ws_order_number)) otherCondition=() build RFs:RF4 ws_order_number->[ws_order_number];RF7 ws_order_number->[ws_order_number,ws_order_number] +------------------------PhysicalDistribute +--------------------------PhysicalProject +----------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) +------------------------PhysicalDistribute +--------------------------hashJoin[INNER_JOIN] hashCondition=((ws1.ws_web_site_sk = web_site.web_site_sk)) otherCondition=() build RFs:RF3 web_site_sk->[ws_web_site_sk] +----------------------------hashJoin[INNER_JOIN] hashCondition=((ws1.ws_ship_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF2 d_date_sk->[ws_ship_date_sk] +------------------------------hashJoin[INNER_JOIN] hashCondition=((ws1.ws_ship_addr_sk = customer_address.ca_address_sk)) otherCondition=() build RFs:RF1 ca_address_sk->[ws_ship_addr_sk] +--------------------------------PhysicalProject +----------------------------------PhysicalOlapScan[web_sales] apply RFs: RF1 RF2 RF3 --------------------------------PhysicalDistribute ----------------------------------PhysicalProject -------------------------------------filter((date_dim.d_date <= '1999-04-02') and (date_dim.d_date >= '1999-02-01')) ---------------------------------------PhysicalOlapScan[date_dim] +------------------------------------filter((customer_address.ca_state = 'NC')) +--------------------------------------PhysicalOlapScan[customer_address] ------------------------------PhysicalDistribute --------------------------------PhysicalProject -----------------------------------filter((web_site.web_company_name = 'pri')) -------------------------------------PhysicalOlapScan[web_site] +----------------------------------filter((date_dim.d_date <= '1999-04-02') and (date_dim.d_date >= '1999-02-01')) +------------------------------------PhysicalOlapScan[date_dim] +----------------------------PhysicalDistribute +------------------------------PhysicalProject +--------------------------------filter((web_site.web_company_name = 'pri')) +----------------------------------PhysicalOlapScan[web_site] diff --git a/regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query44.out b/regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query44.out index 2c3fc9a8c25db2..35ca3b8e453b6e 100644 --- a/regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query44.out +++ b/regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query44.out @@ -5,12 +5,42 @@ PhysicalResultSink ----PhysicalDistribute ------PhysicalTopN[LOCAL_SORT] --------PhysicalProject -----------hashJoin[INNER_JOIN] hashCondition=((asceding.rnk = descending.rnk)) otherCondition=() +----------hashJoin[INNER_JOIN] hashCondition=((i2.i_item_sk = descending.item_sk)) otherCondition=() build RFs:RF1 item_sk->[i_item_sk] +------------PhysicalProject +--------------PhysicalOlapScan[item] apply RFs: RF1 ------------PhysicalDistribute --------------PhysicalProject -----------------hashJoin[INNER_JOIN] hashCondition=((i1.i_item_sk = asceding.item_sk)) otherCondition=() build RFs:RF1 item_sk->[i_item_sk] -------------------PhysicalProject ---------------------PhysicalOlapScan[item] apply RFs: RF1 +----------------hashJoin[INNER_JOIN] hashCondition=((asceding.rnk = descending.rnk)) otherCondition=() +------------------hashJoin[INNER_JOIN] hashCondition=((i1.i_item_sk = asceding.item_sk)) otherCondition=() build RFs:RF0 item_sk->[i_item_sk] +--------------------PhysicalProject +----------------------PhysicalOlapScan[item] apply RFs: RF0 +--------------------PhysicalDistribute +----------------------PhysicalProject +------------------------filter((rnk < 11)) +--------------------------PhysicalWindow +----------------------------PhysicalQuickSort[MERGE_SORT] +------------------------------PhysicalDistribute +--------------------------------PhysicalQuickSort[LOCAL_SORT] +----------------------------------PhysicalPartitionTopN +------------------------------------PhysicalProject +--------------------------------------NestedLoopJoin[INNER_JOIN](cast(rank_col as DOUBLE) > cast((0.9 * rank_col) as DOUBLE)) +----------------------------------------PhysicalProject +------------------------------------------hashAgg[GLOBAL] +--------------------------------------------PhysicalDistribute +----------------------------------------------hashAgg[LOCAL] +------------------------------------------------PhysicalProject +--------------------------------------------------filter((ss1.ss_store_sk = 146)) +----------------------------------------------------PhysicalOlapScan[store_sales] +----------------------------------------PhysicalDistribute +------------------------------------------PhysicalAssertNumRows +--------------------------------------------PhysicalDistribute +----------------------------------------------PhysicalProject +------------------------------------------------hashAgg[GLOBAL] +--------------------------------------------------PhysicalDistribute +----------------------------------------------------hashAgg[LOCAL] +------------------------------------------------------PhysicalProject +--------------------------------------------------------filter((store_sales.ss_store_sk = 146) and ss_addr_sk IS NULL) +----------------------------------------------------------PhysicalOlapScan[store_sales] ------------------PhysicalDistribute --------------------PhysicalProject ----------------------filter((rnk < 11)) @@ -38,35 +68,4 @@ PhysicalResultSink ----------------------------------------------------PhysicalProject ------------------------------------------------------filter((store_sales.ss_store_sk = 146) and ss_addr_sk IS NULL) --------------------------------------------------------PhysicalOlapScan[store_sales] -------------PhysicalDistribute ---------------hashJoin[INNER_JOIN] hashCondition=((i2.i_item_sk = descending.item_sk)) otherCondition=() build RFs:RF0 item_sk->[i_item_sk] -----------------PhysicalProject -------------------PhysicalOlapScan[item] apply RFs: RF0 -----------------PhysicalDistribute -------------------PhysicalProject ---------------------filter((rnk < 11)) -----------------------PhysicalWindow -------------------------PhysicalQuickSort[MERGE_SORT] ---------------------------PhysicalDistribute -----------------------------PhysicalQuickSort[LOCAL_SORT] -------------------------------PhysicalPartitionTopN ---------------------------------PhysicalProject -----------------------------------NestedLoopJoin[INNER_JOIN](cast(rank_col as DOUBLE) > cast((0.9 * rank_col) as DOUBLE)) -------------------------------------PhysicalProject ---------------------------------------hashAgg[GLOBAL] -----------------------------------------PhysicalDistribute -------------------------------------------hashAgg[LOCAL] ---------------------------------------------PhysicalProject -----------------------------------------------filter((ss1.ss_store_sk = 146)) -------------------------------------------------PhysicalOlapScan[store_sales] -------------------------------------PhysicalDistribute ---------------------------------------PhysicalAssertNumRows -----------------------------------------PhysicalDistribute -------------------------------------------PhysicalProject ---------------------------------------------hashAgg[GLOBAL] -----------------------------------------------PhysicalDistribute -------------------------------------------------hashAgg[LOCAL] ---------------------------------------------------PhysicalProject -----------------------------------------------------filter((store_sales.ss_store_sk = 146) and ss_addr_sk IS NULL) -------------------------------------------------------PhysicalOlapScan[store_sales] diff --git a/regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query76.out b/regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query76.out index 7d8bcd65ad412d..00c4bba1df69bb 100644 --- a/regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query76.out +++ b/regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query76.out @@ -10,44 +10,41 @@ PhysicalResultSink --------------PhysicalUnion ----------------PhysicalDistribute ------------------PhysicalProject ---------------------hashJoin[INNER_JOIN] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF1 d_date_sk->[ss_sold_date_sk] +--------------------hashJoin[INNER_JOIN] hashCondition=((store_sales.ss_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF1 ss_item_sk->[i_item_sk] ----------------------PhysicalProject -------------------------hashJoin[INNER_JOIN] hashCondition=((store_sales.ss_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF0 i_item_sk->[ss_item_sk] +------------------------PhysicalOlapScan[item] apply RFs: RF1 +----------------------PhysicalDistribute +------------------------hashJoin[INNER_JOIN] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF0 ss_sold_date_sk->[d_date_sk] --------------------------PhysicalProject -----------------------------filter(ss_hdemo_sk IS NULL) -------------------------------PhysicalOlapScan[store_sales] apply RFs: RF0 RF1 +----------------------------PhysicalOlapScan[date_dim] apply RFs: RF0 --------------------------PhysicalDistribute ----------------------------PhysicalProject -------------------------------PhysicalOlapScan[item] -----------------------PhysicalDistribute -------------------------PhysicalProject ---------------------------PhysicalOlapScan[date_dim] +------------------------------filter(ss_hdemo_sk IS NULL) +--------------------------------PhysicalOlapScan[store_sales] ----------------PhysicalDistribute ------------------PhysicalProject ---------------------hashJoin[INNER_JOIN] hashCondition=((web_sales.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF3 d_date_sk->[ws_sold_date_sk] +--------------------hashJoin[INNER_JOIN] hashCondition=((web_sales.ws_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF3 ws_item_sk->[i_item_sk] ----------------------PhysicalProject -------------------------hashJoin[INNER_JOIN] hashCondition=((web_sales.ws_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF2 i_item_sk->[ws_item_sk] +------------------------PhysicalOlapScan[item] apply RFs: RF3 +----------------------PhysicalDistribute +------------------------hashJoin[INNER_JOIN] hashCondition=((web_sales.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF2 ws_sold_date_sk->[d_date_sk] --------------------------PhysicalProject -----------------------------filter(ws_bill_addr_sk IS NULL) -------------------------------PhysicalOlapScan[web_sales] apply RFs: RF2 RF3 +----------------------------PhysicalOlapScan[date_dim] apply RFs: RF2 --------------------------PhysicalDistribute ----------------------------PhysicalProject -------------------------------PhysicalOlapScan[item] -----------------------PhysicalDistribute -------------------------PhysicalProject ---------------------------PhysicalOlapScan[date_dim] +------------------------------filter(ws_bill_addr_sk IS NULL) +--------------------------------PhysicalOlapScan[web_sales] ----------------PhysicalDistribute ------------------PhysicalProject ---------------------hashJoin[INNER_JOIN] hashCondition=((catalog_sales.cs_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF5 d_date_sk->[cs_sold_date_sk] +--------------------hashJoin[INNER_JOIN] hashCondition=((catalog_sales.cs_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF5 cs_item_sk->[i_item_sk] ----------------------PhysicalProject -------------------------hashJoin[INNER_JOIN] hashCondition=((catalog_sales.cs_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF4 i_item_sk->[cs_item_sk] +------------------------PhysicalOlapScan[item] apply RFs: RF5 +----------------------PhysicalDistribute +------------------------hashJoin[INNER_JOIN] hashCondition=((catalog_sales.cs_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF4 cs_sold_date_sk->[d_date_sk] --------------------------PhysicalProject -----------------------------filter(cs_warehouse_sk IS NULL) -------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF4 RF5 +----------------------------PhysicalOlapScan[date_dim] apply RFs: RF4 --------------------------PhysicalDistribute ----------------------------PhysicalProject -------------------------------PhysicalOlapScan[item] -----------------------PhysicalDistribute -------------------------PhysicalProject ---------------------------PhysicalOlapScan[date_dim] +------------------------------filter(cs_warehouse_sk IS NULL) +--------------------------------PhysicalOlapScan[catalog_sales] diff --git a/regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query95.out b/regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query95.out index 4fcf27b7e65999..bde9dbef392330 100644 --- a/regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query95.out +++ b/regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query95.out @@ -13,42 +13,41 @@ PhysicalCteAnchor ( cteId=CTEId#0 ) --PhysicalResultSink ----PhysicalTopN[MERGE_SORT] ------PhysicalTopN[LOCAL_SORT] ---------PhysicalProject -----------hashAgg[DISTINCT_GLOBAL] -------------PhysicalDistribute ---------------hashAgg[DISTINCT_LOCAL] -----------------hashAgg[GLOBAL] -------------------hashAgg[LOCAL] ---------------------PhysicalProject -----------------------hashJoin[RIGHT_SEMI_JOIN] hashCondition=((ws1.ws_order_number = web_returns.wr_order_number)) otherCondition=() -------------------------PhysicalProject ---------------------------hashJoin[INNER_JOIN] hashCondition=((web_returns.wr_order_number = ws_wh.ws_order_number)) otherCondition=() build RFs:RF5 wr_order_number->[ws_order_number];RF6 wr_order_number->[ws_order_number,ws_order_number] -----------------------------PhysicalDistribute -------------------------------PhysicalProject ---------------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) -----------------------------PhysicalDistribute -------------------------------PhysicalProject ---------------------------------PhysicalOlapScan[web_returns] -------------------------hashJoin[RIGHT_SEMI_JOIN] hashCondition=((ws1.ws_order_number = ws_wh.ws_order_number)) otherCondition=() build RFs:RF4 ws_order_number->[ws_order_number];RF7 ws_order_number->[ws_order_number,ws_order_number] +--------hashAgg[DISTINCT_GLOBAL] +----------PhysicalDistribute +------------hashAgg[DISTINCT_LOCAL] +--------------hashAgg[GLOBAL] +----------------hashAgg[LOCAL] +------------------PhysicalProject +--------------------hashJoin[RIGHT_SEMI_JOIN] hashCondition=((ws1.ws_order_number = web_returns.wr_order_number)) otherCondition=() +----------------------PhysicalProject +------------------------hashJoin[INNER_JOIN] hashCondition=((web_returns.wr_order_number = ws_wh.ws_order_number)) otherCondition=() build RFs:RF5 wr_order_number->[ws_order_number];RF6 wr_order_number->[ws_order_number,ws_order_number] --------------------------PhysicalDistribute ----------------------------PhysicalProject ------------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) --------------------------PhysicalDistribute -----------------------------hashJoin[INNER_JOIN] hashCondition=((ws1.ws_web_site_sk = web_site.web_site_sk)) otherCondition=() build RFs:RF3 web_site_sk->[ws_web_site_sk] -------------------------------hashJoin[INNER_JOIN] hashCondition=((ws1.ws_ship_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF2 d_date_sk->[ws_ship_date_sk] ---------------------------------hashJoin[INNER_JOIN] hashCondition=((ws1.ws_ship_addr_sk = customer_address.ca_address_sk)) otherCondition=() build RFs:RF1 ca_address_sk->[ws_ship_addr_sk] -----------------------------------PhysicalProject -------------------------------------PhysicalOlapScan[web_sales] apply RFs: RF1 RF2 RF3 -----------------------------------PhysicalDistribute -------------------------------------PhysicalProject ---------------------------------------filter((customer_address.ca_state = 'NC')) -----------------------------------------PhysicalOlapScan[customer_address] +----------------------------PhysicalProject +------------------------------PhysicalOlapScan[web_returns] +----------------------hashJoin[RIGHT_SEMI_JOIN] hashCondition=((ws1.ws_order_number = ws_wh.ws_order_number)) otherCondition=() build RFs:RF4 ws_order_number->[ws_order_number];RF7 ws_order_number->[ws_order_number,ws_order_number] +------------------------PhysicalDistribute +--------------------------PhysicalProject +----------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) +------------------------PhysicalDistribute +--------------------------hashJoin[INNER_JOIN] hashCondition=((ws1.ws_web_site_sk = web_site.web_site_sk)) otherCondition=() build RFs:RF3 web_site_sk->[ws_web_site_sk] +----------------------------hashJoin[INNER_JOIN] hashCondition=((ws1.ws_ship_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF2 d_date_sk->[ws_ship_date_sk] +------------------------------hashJoin[INNER_JOIN] hashCondition=((ws1.ws_ship_addr_sk = customer_address.ca_address_sk)) otherCondition=() build RFs:RF1 ca_address_sk->[ws_ship_addr_sk] +--------------------------------PhysicalProject +----------------------------------PhysicalOlapScan[web_sales] apply RFs: RF1 RF2 RF3 --------------------------------PhysicalDistribute ----------------------------------PhysicalProject -------------------------------------filter((date_dim.d_date <= '1999-04-02') and (date_dim.d_date >= '1999-02-01')) ---------------------------------------PhysicalOlapScan[date_dim] +------------------------------------filter((customer_address.ca_state = 'NC')) +--------------------------------------PhysicalOlapScan[customer_address] ------------------------------PhysicalDistribute --------------------------------PhysicalProject -----------------------------------filter((web_site.web_company_name = 'pri')) -------------------------------------PhysicalOlapScan[web_site] +----------------------------------filter((date_dim.d_date <= '1999-04-02') and (date_dim.d_date >= '1999-02-01')) +------------------------------------PhysicalOlapScan[date_dim] +----------------------------PhysicalDistribute +------------------------------PhysicalProject +--------------------------------filter((web_site.web_company_name = 'pri')) +----------------------------------PhysicalOlapScan[web_site] diff --git a/regression-test/suites/unique_with_mow_p0/partial_update/test_partial_update_seq_col.groovy b/regression-test/suites/unique_with_mow_p0/partial_update/test_partial_update_seq_col.groovy index 67f78e64207efb..111037ae18f6b8 100644 --- a/regression-test/suites/unique_with_mow_p0/partial_update/test_partial_update_seq_col.groovy +++ b/regression-test/suites/unique_with_mow_p0/partial_update/test_partial_update_seq_col.groovy @@ -136,9 +136,9 @@ suite("test_primary_key_partial_update_seq_col", "p0") { def tableName2 = "nereids_partial_update_native_insert_seq_col2" - sql """ DROP TABLE IF EXISTS ${tableName2} """ + sql """ DROP TABLE IF EXISTS nereids_partial_update_20231227 """ sql """ - CREATE TABLE ${tableName2} ( + CREATE TABLE nereids_partial_update_20231227 ( `id` int(11) NOT NULL COMMENT "用户 ID", `score` int(11) NOT NULL COMMENT "用户得分", `update_time` DATETIMEV2 NULL DEFAULT CURRENT_TIMESTAMP) @@ -152,7 +152,7 @@ suite("test_primary_key_partial_update_seq_col", "p0") { // the input data don't contains sequence mapping column but the sequence mapping // column's default value is CURRENT_TIMESTAMP, will load successfully streamLoad { - table "${tableName2}" + table "nereids_partial_update_20231227" set 'column_separator', ',' set 'format', 'csv' @@ -164,8 +164,8 @@ suite("test_primary_key_partial_update_seq_col", "p0") { sql "sync" - qt_sql """ select id,score from ${tableName2} order by id;""" - sql """ DROP TABLE IF EXISTS ${tableName2}; """ + qt_sql """ select id,score from nereids_partial_update_20231227 order by id;""" + sql """ DROP TABLE IF EXISTS nereids_partial_update_20231227; """ } } }