diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/cost/CostModelV1.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/cost/CostModelV1.java index aa8f4d6cc7cfda..fb8d2b9f921a11 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/cost/CostModelV1.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/cost/CostModelV1.java @@ -67,7 +67,8 @@ class CostModelV1 extends PlanVisitor { // the penalty factor is no more than BROADCAST_JOIN_SKEW_PENALTY_LIMIT static final double BROADCAST_JOIN_SKEW_RATIO = 30.0; static final double BROADCAST_JOIN_SKEW_PENALTY_LIMIT = 2.0; - private int beNumber = 1; + static final double RANDOM_SHUFFLE_TO_HASH_SHUFFLE_FACTOR = 0.1; + private final int beNumber; public CostModelV1() { if (ConnectContext.get().getSessionVariable().isPlayNereidsDump()) { @@ -236,9 +237,9 @@ public Cost visitPhysicalDistribute( // any return CostV1.of( - intputRowCount, 0, - 0); + 0, + intputRowCount * childStatistics.dataSizeFactor() * RANDOM_SHUFFLE_TO_HASH_SHUFFLE_FACTOR / beNumber); } @Override diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/properties/ChildrenPropertiesRegulator.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/properties/ChildrenPropertiesRegulator.java index a3a91880c5179a..e969e7e878b0cf 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/properties/ChildrenPropertiesRegulator.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/properties/ChildrenPropertiesRegulator.java @@ -40,6 +40,7 @@ import org.apache.doris.nereids.trees.plans.physical.PhysicalNestedLoopJoin; import org.apache.doris.nereids.trees.plans.physical.PhysicalProject; import org.apache.doris.nereids.trees.plans.physical.PhysicalSetOperation; +import org.apache.doris.nereids.trees.plans.physical.PhysicalUnion; import org.apache.doris.nereids.trees.plans.visitor.PlanVisitor; import org.apache.doris.nereids.util.JoinUtils; @@ -114,6 +115,15 @@ public Boolean visitPhysicalHashAggregate(PhysicalHashAggregate && children.get(0).getPlan() instanceof PhysicalDistribute) { return false; } + + // agg(group by x)-union all(A, B) + // no matter x.ndv is high or not, it is not worthwhile to shuffle A and B by x + // and hence we forbid one phase agg + if (agg.getAggMode() == AggMode.INPUT_TO_RESULT + && children.get(0).getPlan() instanceof PhysicalUnion + && !((PhysicalUnion) children.get(0).getPlan()).isDistinct()) { + return false; + } // forbid multi distinct opt that bad than multi-stage version when multi-stage can be executed in one fragment if (agg.getAggMode() == AggMode.INPUT_TO_BUFFER || agg.getAggMode() == AggMode.INPUT_TO_RESULT) { List multiDistinctions = agg.getOutputExpressions().stream() diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/physical/PhysicalSetOperation.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/physical/PhysicalSetOperation.java index b9358c5e205c73..07326a8afb4d1c 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/physical/PhysicalSetOperation.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/physical/PhysicalSetOperation.java @@ -143,4 +143,8 @@ public List computeOutput() { .map(NamedExpression::toSlot) .collect(ImmutableList.toImmutableList()); } + + public boolean isDistinct() { + return qualifier == Qualifier.DISTINCT; + } } diff --git a/fe/fe-core/src/main/java/org/apache/doris/statistics/ColumnStatistic.java b/fe/fe-core/src/main/java/org/apache/doris/statistics/ColumnStatistic.java index 82e0efdac1784d..1ec22cbc47b013 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/statistics/ColumnStatistic.java +++ b/fe/fe-core/src/main/java/org/apache/doris/statistics/ColumnStatistic.java @@ -40,7 +40,7 @@ public class ColumnStatistic { public static final double STATS_ERROR = 0.1D; - + public static final double ALMOST_UNIQUE_FACTOR = 0.9; public static final StatsType NDV = StatsType.NDV; public static final StatsType AVG_SIZE = StatsType.AVG_SIZE; public static final StatsType MAX_SIZE = StatsType.MAX_SIZE; @@ -211,7 +211,7 @@ public static ColumnStatistic fromResultRow(ResultRow row) { } public static boolean isAlmostUnique(double ndv, double rowCount) { - return rowCount * 0.9 < ndv && ndv < rowCount * 1.1; + return rowCount * ALMOST_UNIQUE_FACTOR < ndv; } public ColumnStatistic updateByLimit(long limit, double rowCount) { diff --git a/regression-test/data/nereids_tpcds_shape_sf1000_p0/shape/query1.out b/regression-test/data/nereids_tpcds_shape_sf1000_p0/shape/query1.out new file mode 100644 index 00000000000000..50d0c4bce6773a --- /dev/null +++ b/regression-test/data/nereids_tpcds_shape_sf1000_p0/shape/query1.out @@ -0,0 +1,43 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_1 -- +PhysicalCteAnchor ( cteId=CTEId#0 ) +--PhysicalCteProducer ( cteId=CTEId#0 ) +----PhysicalProject +------hashAgg[GLOBAL] +--------PhysicalDistribute +----------hashAgg[LOCAL] +------------PhysicalProject +--------------hashJoin[INNER_JOIN] hashCondition=((store_returns.sr_returned_date_sk = date_dim.d_date_sk))otherCondition=() +----------------PhysicalProject +------------------PhysicalOlapScan[store_returns] +----------------PhysicalDistribute +------------------PhysicalProject +--------------------filter((date_dim.d_year = 2000)) +----------------------PhysicalOlapScan[date_dim] +--PhysicalResultSink +----PhysicalTopN +------PhysicalDistribute +--------PhysicalTopN +----------PhysicalProject +------------hashJoin[INNER_JOIN] hashCondition=((ctr1.ctr_customer_sk = customer.c_customer_sk))otherCondition=() +--------------PhysicalDistribute +----------------PhysicalProject +------------------PhysicalOlapScan[customer] +--------------PhysicalDistribute +----------------hashJoin[INNER_JOIN] hashCondition=((ctr1.ctr_store_sk = ctr2.ctr_store_sk))otherCondition=((cast(ctr_total_return as DOUBLE) > cast((avg(cast(ctr_total_return as DECIMALV3(38, 4))) * 1.2) as DOUBLE))) +------------------PhysicalProject +--------------------hashJoin[INNER_JOIN] hashCondition=((store.s_store_sk = ctr1.ctr_store_sk))otherCondition=() +----------------------PhysicalDistribute +------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) +----------------------PhysicalDistribute +------------------------PhysicalProject +--------------------------filter((store.s_state = 'TN')) +----------------------------PhysicalOlapScan[store] +------------------PhysicalDistribute +--------------------hashAgg[GLOBAL] +----------------------PhysicalDistribute +------------------------hashAgg[LOCAL] +--------------------------PhysicalDistribute +----------------------------PhysicalProject +------------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) + 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 new file mode 100644 index 00000000000000..a8ab13bb0f8d30 --- /dev/null +++ b/regression-test/data/nereids_tpcds_shape_sf1000_p0/shape/query49.out @@ -0,0 +1,89 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_49 -- +PhysicalResultSink +--PhysicalTopN +----PhysicalDistribute +------PhysicalTopN +--------hashAgg[GLOBAL] +----------PhysicalDistribute +------------hashAgg[LOCAL] +--------------PhysicalUnion +----------------PhysicalDistribute +------------------PhysicalProject +--------------------filter(((return_rank <= 10) OR (currency_rank <= 10))) +----------------------PhysicalWindow +------------------------PhysicalQuickSort +--------------------------PhysicalWindow +----------------------------PhysicalQuickSort +------------------------------PhysicalDistribute +--------------------------------PhysicalQuickSort +----------------------------------PhysicalProject +------------------------------------hashAgg[GLOBAL] +--------------------------------------PhysicalDistribute +----------------------------------------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=() +----------------------------------------------PhysicalProject +------------------------------------------------filter((wr.wr_return_amt > 10000.00)) +--------------------------------------------------PhysicalOlapScan[web_returns] +----------------------------------------------hashJoin[INNER_JOIN] hashCondition=((ws.ws_sold_date_sk = date_dim.d_date_sk))otherCondition=() +------------------------------------------------PhysicalProject +--------------------------------------------------filter((ws.ws_net_paid > 0.00) and (ws.ws_net_profit > 1.00) and (ws.ws_quantity > 0)) +----------------------------------------------------PhysicalOlapScan[web_sales] +------------------------------------------------PhysicalDistribute +--------------------------------------------------PhysicalProject +----------------------------------------------------filter((date_dim.d_moy = 11) and (date_dim.d_year = 1998)) +------------------------------------------------------PhysicalOlapScan[date_dim] +----------------PhysicalDistribute +------------------PhysicalProject +--------------------filter(((return_rank <= 10) OR (currency_rank <= 10))) +----------------------PhysicalWindow +------------------------PhysicalQuickSort +--------------------------PhysicalWindow +----------------------------PhysicalQuickSort +------------------------------PhysicalDistribute +--------------------------------PhysicalQuickSort +----------------------------------PhysicalProject +------------------------------------hashAgg[GLOBAL] +--------------------------------------PhysicalDistribute +----------------------------------------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=() +----------------------------------------------PhysicalProject +------------------------------------------------filter((cr.cr_return_amount > 10000.00)) +--------------------------------------------------PhysicalOlapScan[catalog_returns] +----------------------------------------------hashJoin[INNER_JOIN] hashCondition=((cs.cs_sold_date_sk = date_dim.d_date_sk))otherCondition=() +------------------------------------------------PhysicalProject +--------------------------------------------------filter((cs.cs_net_paid > 0.00) and (cs.cs_net_profit > 1.00) and (cs.cs_quantity > 0)) +----------------------------------------------------PhysicalOlapScan[catalog_sales] +------------------------------------------------PhysicalDistribute +--------------------------------------------------PhysicalProject +----------------------------------------------------filter((date_dim.d_moy = 11) and (date_dim.d_year = 1998)) +------------------------------------------------------PhysicalOlapScan[date_dim] +----------------PhysicalDistribute +------------------PhysicalProject +--------------------filter(((return_rank <= 10) OR (currency_rank <= 10))) +----------------------PhysicalWindow +------------------------PhysicalQuickSort +--------------------------PhysicalWindow +----------------------------PhysicalQuickSort +------------------------------PhysicalDistribute +--------------------------------PhysicalQuickSort +----------------------------------PhysicalProject +------------------------------------hashAgg[GLOBAL] +--------------------------------------PhysicalDistribute +----------------------------------------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=() +----------------------------------------------PhysicalProject +------------------------------------------------filter((sr.sr_return_amt > 10000.00)) +--------------------------------------------------PhysicalOlapScan[store_returns] +----------------------------------------------hashJoin[INNER_JOIN] hashCondition=((sts.ss_sold_date_sk = date_dim.d_date_sk))otherCondition=() +------------------------------------------------PhysicalProject +--------------------------------------------------filter((sts.ss_net_paid > 0.00) and (sts.ss_net_profit > 1.00) and (sts.ss_quantity > 0)) +----------------------------------------------------PhysicalOlapScan[store_sales] +------------------------------------------------PhysicalDistribute +--------------------------------------------------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_sf1000_p0/shape/query75.out b/regression-test/data/nereids_tpcds_shape_sf1000_p0/shape/query75.out new file mode 100644 index 00000000000000..fb9d10e30ff233 --- /dev/null +++ b/regression-test/data/nereids_tpcds_shape_sf1000_p0/shape/query75.out @@ -0,0 +1,81 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_75 -- +PhysicalCteAnchor ( cteId=CTEId#0 ) +--PhysicalCteProducer ( cteId=CTEId#0 ) +----hashAgg[GLOBAL] +------PhysicalDistribute +--------hashAgg[LOCAL] +----------hashAgg[GLOBAL] +------------PhysicalDistribute +--------------hashAgg[LOCAL] +----------------PhysicalUnion +------------------PhysicalDistribute +--------------------PhysicalProject +----------------------hashJoin[RIGHT_OUTER_JOIN] hashCondition=((catalog_sales.cs_item_sk = catalog_returns.cr_item_sk) and (catalog_sales.cs_order_number = catalog_returns.cr_order_number))otherCondition=() +------------------------PhysicalProject +--------------------------PhysicalOlapScan[catalog_returns] +------------------------PhysicalProject +--------------------------hashJoin[INNER_JOIN] hashCondition=((date_dim.d_date_sk = catalog_sales.cs_sold_date_sk))otherCondition=() +----------------------------PhysicalProject +------------------------------hashJoin[INNER_JOIN] hashCondition=((item.i_item_sk = catalog_sales.cs_item_sk))otherCondition=() +--------------------------------PhysicalProject +----------------------------------PhysicalOlapScan[catalog_sales] +--------------------------------PhysicalDistribute +----------------------------------PhysicalProject +------------------------------------filter((item.i_category = 'Sports')) +--------------------------------------PhysicalOlapScan[item] +----------------------------PhysicalDistribute +------------------------------PhysicalProject +--------------------------------filter(d_year IN (2001, 2002)) +----------------------------------PhysicalOlapScan[date_dim] +------------------PhysicalDistribute +--------------------PhysicalProject +----------------------hashJoin[RIGHT_OUTER_JOIN] hashCondition=((store_sales.ss_item_sk = store_returns.sr_item_sk) and (store_sales.ss_ticket_number = store_returns.sr_ticket_number))otherCondition=() +------------------------PhysicalProject +--------------------------PhysicalOlapScan[store_returns] +------------------------PhysicalProject +--------------------------hashJoin[INNER_JOIN] hashCondition=((date_dim.d_date_sk = store_sales.ss_sold_date_sk))otherCondition=() +----------------------------PhysicalProject +------------------------------hashJoin[INNER_JOIN] hashCondition=((item.i_item_sk = store_sales.ss_item_sk))otherCondition=() +--------------------------------PhysicalProject +----------------------------------PhysicalOlapScan[store_sales] +--------------------------------PhysicalDistribute +----------------------------------PhysicalProject +------------------------------------filter((item.i_category = 'Sports')) +--------------------------------------PhysicalOlapScan[item] +----------------------------PhysicalDistribute +------------------------------PhysicalProject +--------------------------------filter(d_year IN (2001, 2002)) +----------------------------------PhysicalOlapScan[date_dim] +------------------PhysicalDistribute +--------------------PhysicalProject +----------------------hashJoin[RIGHT_OUTER_JOIN] hashCondition=((web_sales.ws_item_sk = web_returns.wr_item_sk) and (web_sales.ws_order_number = web_returns.wr_order_number))otherCondition=() +------------------------PhysicalProject +--------------------------PhysicalOlapScan[web_returns] +------------------------PhysicalProject +--------------------------hashJoin[INNER_JOIN] hashCondition=((date_dim.d_date_sk = web_sales.ws_sold_date_sk))otherCondition=() +----------------------------PhysicalProject +------------------------------hashJoin[INNER_JOIN] hashCondition=((item.i_item_sk = web_sales.ws_item_sk))otherCondition=() +--------------------------------PhysicalProject +----------------------------------PhysicalOlapScan[web_sales] +--------------------------------PhysicalDistribute +----------------------------------PhysicalProject +------------------------------------filter((item.i_category = 'Sports')) +--------------------------------------PhysicalOlapScan[item] +----------------------------PhysicalDistribute +------------------------------PhysicalProject +--------------------------------filter(d_year IN (2001, 2002)) +----------------------------------PhysicalOlapScan[date_dim] +--PhysicalResultSink +----PhysicalTopN +------PhysicalDistribute +--------PhysicalTopN +----------PhysicalProject +------------hashJoin[INNER_JOIN] hashCondition=((curr_yr.i_brand_id = prev_yr.i_brand_id) and (curr_yr.i_category_id = prev_yr.i_category_id) and (curr_yr.i_class_id = prev_yr.i_class_id) and (curr_yr.i_manufact_id = prev_yr.i_manufact_id))otherCondition=(((cast(cast(sales_cnt as DECIMALV3(17, 2)) as DECIMALV3(23, 8)) / cast(sales_cnt as DECIMALV3(17, 2))) < 0.900000)) +--------------PhysicalDistribute +----------------filter((curr_yr.d_year = 2002)) +------------------PhysicalCteConsumer ( cteId=CTEId#0 ) +--------------PhysicalDistribute +----------------filter((prev_yr.d_year = 2001)) +------------------PhysicalCteConsumer ( cteId=CTEId#0 ) + diff --git a/regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query1.out b/regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query1.out index d872d6969a8f36..700186ae78d70a 100644 --- a/regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query1.out +++ b/regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query1.out @@ -33,10 +33,11 @@ PhysicalCteAnchor ( cteId=CTEId#0 ) ------------------------PhysicalProject --------------------------filter((store.s_state = 'SD')) ----------------------------PhysicalOlapScan[store] -------------------hashAgg[GLOBAL] ---------------------PhysicalDistribute -----------------------hashAgg[LOCAL] -------------------------PhysicalDistribute ---------------------------PhysicalProject -----------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) +------------------PhysicalDistribute +--------------------hashAgg[GLOBAL] +----------------------PhysicalDistribute +------------------------hashAgg[LOCAL] +--------------------------PhysicalDistribute +----------------------------PhysicalProject +------------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) 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 e1b6cfabc3a104..28874b40f535d2 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 @@ -4,84 +4,86 @@ PhysicalResultSink --PhysicalTopN ----PhysicalDistribute ------PhysicalTopN ---------hashAgg[LOCAL] -----------PhysicalUnion -------------PhysicalDistribute ---------------PhysicalProject -----------------filter(((return_rank <= 10) OR (currency_rank <= 10))) -------------------PhysicalWindow ---------------------PhysicalQuickSort +--------hashAgg[GLOBAL] +----------PhysicalDistribute +------------hashAgg[LOCAL] +--------------PhysicalUnion +----------------PhysicalDistribute +------------------PhysicalProject +--------------------filter(((return_rank <= 10) OR (currency_rank <= 10))) ----------------------PhysicalWindow ------------------------PhysicalQuickSort ---------------------------PhysicalDistribute +--------------------------PhysicalWindow ----------------------------PhysicalQuickSort -------------------------------PhysicalProject ---------------------------------hashAgg[GLOBAL] -----------------------------------PhysicalDistribute -------------------------------------hashAgg[LOCAL] ---------------------------------------PhysicalProject -----------------------------------------hashJoin[INNER_JOIN](ws.ws_item_sk = wr.wr_item_sk)(ws.ws_order_number = wr.wr_order_number) +------------------------------PhysicalDistribute +--------------------------------PhysicalQuickSort +----------------------------------PhysicalProject +------------------------------------hashAgg[GLOBAL] +--------------------------------------PhysicalDistribute +----------------------------------------hashAgg[LOCAL] ------------------------------------------PhysicalProject ---------------------------------------------filter((wr.wr_return_amt > 10000.00)) -----------------------------------------------PhysicalOlapScan[web_returns] -------------------------------------------hashJoin[INNER_JOIN](ws.ws_sold_date_sk = date_dim.d_date_sk) ---------------------------------------------PhysicalProject -----------------------------------------------filter((ws.ws_net_paid > 0.00)(ws.ws_quantity > 0)(ws.ws_net_profit > 1.00)) -------------------------------------------------PhysicalOlapScan[web_sales] ---------------------------------------------PhysicalDistribute +--------------------------------------------hashJoin[INNER_JOIN](ws.ws_item_sk = wr.wr_item_sk)(ws.ws_order_number = wr.wr_order_number) ----------------------------------------------PhysicalProject -------------------------------------------------filter((date_dim.d_moy = 12)(date_dim.d_year = 1999)) ---------------------------------------------------PhysicalOlapScan[date_dim] -------------PhysicalDistribute ---------------PhysicalProject -----------------filter(((return_rank <= 10) OR (currency_rank <= 10))) -------------------PhysicalWindow ---------------------PhysicalQuickSort +------------------------------------------------filter((wr.wr_return_amt > 10000.00)) +--------------------------------------------------PhysicalOlapScan[web_returns] +----------------------------------------------hashJoin[INNER_JOIN](ws.ws_sold_date_sk = date_dim.d_date_sk) +------------------------------------------------PhysicalProject +--------------------------------------------------filter((ws.ws_net_paid > 0.00)(ws.ws_quantity > 0)(ws.ws_net_profit > 1.00)) +----------------------------------------------------PhysicalOlapScan[web_sales] +------------------------------------------------PhysicalDistribute +--------------------------------------------------PhysicalProject +----------------------------------------------------filter((date_dim.d_moy = 12)(date_dim.d_year = 1999)) +------------------------------------------------------PhysicalOlapScan[date_dim] +----------------PhysicalDistribute +------------------PhysicalProject +--------------------filter(((return_rank <= 10) OR (currency_rank <= 10))) ----------------------PhysicalWindow ------------------------PhysicalQuickSort ---------------------------PhysicalDistribute +--------------------------PhysicalWindow ----------------------------PhysicalQuickSort -------------------------------PhysicalProject ---------------------------------hashAgg[GLOBAL] -----------------------------------PhysicalDistribute -------------------------------------hashAgg[LOCAL] ---------------------------------------PhysicalProject -----------------------------------------hashJoin[INNER_JOIN](cs.cs_item_sk = cr.cr_item_sk)(cs.cs_order_number = cr.cr_order_number) +------------------------------PhysicalDistribute +--------------------------------PhysicalQuickSort +----------------------------------PhysicalProject +------------------------------------hashAgg[GLOBAL] +--------------------------------------PhysicalDistribute +----------------------------------------hashAgg[LOCAL] ------------------------------------------PhysicalProject ---------------------------------------------filter((cr.cr_return_amount > 10000.00)) -----------------------------------------------PhysicalOlapScan[catalog_returns] -------------------------------------------hashJoin[INNER_JOIN](cs.cs_sold_date_sk = date_dim.d_date_sk) ---------------------------------------------PhysicalProject -----------------------------------------------filter((cs.cs_net_paid > 0.00)(cs.cs_quantity > 0)(cs.cs_net_profit > 1.00)) -------------------------------------------------PhysicalOlapScan[catalog_sales] ---------------------------------------------PhysicalDistribute +--------------------------------------------hashJoin[INNER_JOIN](cs.cs_item_sk = cr.cr_item_sk)(cs.cs_order_number = cr.cr_order_number) ----------------------------------------------PhysicalProject -------------------------------------------------filter((date_dim.d_moy = 12)(date_dim.d_year = 1999)) ---------------------------------------------------PhysicalOlapScan[date_dim] -------------PhysicalDistribute ---------------PhysicalProject -----------------filter(((return_rank <= 10) OR (currency_rank <= 10))) -------------------PhysicalWindow ---------------------PhysicalQuickSort +------------------------------------------------filter((cr.cr_return_amount > 10000.00)) +--------------------------------------------------PhysicalOlapScan[catalog_returns] +----------------------------------------------hashJoin[INNER_JOIN](cs.cs_sold_date_sk = date_dim.d_date_sk) +------------------------------------------------PhysicalProject +--------------------------------------------------filter((cs.cs_net_paid > 0.00)(cs.cs_quantity > 0)(cs.cs_net_profit > 1.00)) +----------------------------------------------------PhysicalOlapScan[catalog_sales] +------------------------------------------------PhysicalDistribute +--------------------------------------------------PhysicalProject +----------------------------------------------------filter((date_dim.d_moy = 12)(date_dim.d_year = 1999)) +------------------------------------------------------PhysicalOlapScan[date_dim] +----------------PhysicalDistribute +------------------PhysicalProject +--------------------filter(((return_rank <= 10) OR (currency_rank <= 10))) ----------------------PhysicalWindow ------------------------PhysicalQuickSort ---------------------------PhysicalDistribute +--------------------------PhysicalWindow ----------------------------PhysicalQuickSort -------------------------------PhysicalProject ---------------------------------hashAgg[GLOBAL] -----------------------------------PhysicalDistribute -------------------------------------hashAgg[LOCAL] ---------------------------------------PhysicalProject -----------------------------------------hashJoin[INNER_JOIN](sts.ss_item_sk = sr.sr_item_sk)(sts.ss_ticket_number = sr.sr_ticket_number) +------------------------------PhysicalDistribute +--------------------------------PhysicalQuickSort +----------------------------------PhysicalProject +------------------------------------hashAgg[GLOBAL] +--------------------------------------PhysicalDistribute +----------------------------------------hashAgg[LOCAL] ------------------------------------------PhysicalProject ---------------------------------------------filter((sr.sr_return_amt > 10000.00)) -----------------------------------------------PhysicalOlapScan[store_returns] -------------------------------------------hashJoin[INNER_JOIN](sts.ss_sold_date_sk = date_dim.d_date_sk) ---------------------------------------------PhysicalProject -----------------------------------------------filter((sts.ss_quantity > 0)(sts.ss_net_profit > 1.00)(sts.ss_net_paid > 0.00)) -------------------------------------------------PhysicalOlapScan[store_sales] ---------------------------------------------PhysicalDistribute +--------------------------------------------hashJoin[INNER_JOIN](sts.ss_item_sk = sr.sr_item_sk)(sts.ss_ticket_number = sr.sr_ticket_number) ----------------------------------------------PhysicalProject -------------------------------------------------filter((date_dim.d_moy = 12)(date_dim.d_year = 1999)) ---------------------------------------------------PhysicalOlapScan[date_dim] +------------------------------------------------filter((sr.sr_return_amt > 10000.00)) +--------------------------------------------------PhysicalOlapScan[store_returns] +----------------------------------------------hashJoin[INNER_JOIN](sts.ss_sold_date_sk = date_dim.d_date_sk) +------------------------------------------------PhysicalProject +--------------------------------------------------filter((sts.ss_quantity > 0)(sts.ss_net_profit > 1.00)(sts.ss_net_paid > 0.00)) +----------------------------------------------------PhysicalOlapScan[store_sales] +------------------------------------------------PhysicalDistribute +--------------------------------------------------PhysicalProject +----------------------------------------------------filter((date_dim.d_moy = 12)(date_dim.d_year = 1999)) +------------------------------------------------------PhysicalOlapScan[date_dim] diff --git a/regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query75.out b/regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query75.out index 59b860b0f73b3c..309cabc955373c 100644 --- a/regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query75.out +++ b/regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query75.out @@ -5,65 +5,67 @@ PhysicalCteAnchor ( cteId=CTEId#0 ) ----hashAgg[GLOBAL] ------PhysicalDistribute --------hashAgg[LOCAL] -----------hashAgg[LOCAL] -------------PhysicalUnion ---------------PhysicalDistribute -----------------PhysicalProject -------------------hashJoin[RIGHT_OUTER_JOIN](catalog_sales.cs_item_sk = catalog_returns.cr_item_sk)(catalog_sales.cs_order_number = catalog_returns.cr_order_number) ---------------------PhysicalProject -----------------------PhysicalOlapScan[catalog_returns] +----------hashAgg[GLOBAL] +------------PhysicalDistribute +--------------hashAgg[LOCAL] +----------------PhysicalUnion +------------------PhysicalDistribute --------------------PhysicalProject -----------------------hashJoin[INNER_JOIN](date_dim.d_date_sk = catalog_sales.cs_sold_date_sk) +----------------------hashJoin[RIGHT_OUTER_JOIN](catalog_sales.cs_item_sk = catalog_returns.cr_item_sk)(catalog_sales.cs_order_number = catalog_returns.cr_order_number) +------------------------PhysicalProject +--------------------------PhysicalOlapScan[catalog_returns] ------------------------PhysicalProject ---------------------------hashJoin[INNER_JOIN](item.i_item_sk = catalog_sales.cs_item_sk) +--------------------------hashJoin[INNER_JOIN](date_dim.d_date_sk = catalog_sales.cs_sold_date_sk) ----------------------------PhysicalProject -------------------------------PhysicalOlapScan[catalog_sales] +------------------------------hashJoin[INNER_JOIN](item.i_item_sk = catalog_sales.cs_item_sk) +--------------------------------PhysicalProject +----------------------------------PhysicalOlapScan[catalog_sales] +--------------------------------PhysicalDistribute +----------------------------------PhysicalProject +------------------------------------filter((item.i_category = 'Home')) +--------------------------------------PhysicalOlapScan[item] ----------------------------PhysicalDistribute ------------------------------PhysicalProject ---------------------------------filter((item.i_category = 'Home')) -----------------------------------PhysicalOlapScan[item] -------------------------PhysicalDistribute ---------------------------PhysicalProject -----------------------------filter(d_year IN (1998, 1999)) -------------------------------PhysicalOlapScan[date_dim] ---------------PhysicalDistribute -----------------PhysicalProject -------------------hashJoin[RIGHT_OUTER_JOIN](store_sales.ss_item_sk = store_returns.sr_item_sk)(store_sales.ss_ticket_number = store_returns.sr_ticket_number) ---------------------PhysicalProject -----------------------PhysicalOlapScan[store_returns] +--------------------------------filter(d_year IN (1998, 1999)) +----------------------------------PhysicalOlapScan[date_dim] +------------------PhysicalDistribute --------------------PhysicalProject -----------------------hashJoin[INNER_JOIN](date_dim.d_date_sk = store_sales.ss_sold_date_sk) +----------------------hashJoin[RIGHT_OUTER_JOIN](store_sales.ss_item_sk = store_returns.sr_item_sk)(store_sales.ss_ticket_number = store_returns.sr_ticket_number) ------------------------PhysicalProject ---------------------------hashJoin[INNER_JOIN](item.i_item_sk = store_sales.ss_item_sk) +--------------------------PhysicalOlapScan[store_returns] +------------------------PhysicalProject +--------------------------hashJoin[INNER_JOIN](date_dim.d_date_sk = store_sales.ss_sold_date_sk) ----------------------------PhysicalProject -------------------------------PhysicalOlapScan[store_sales] +------------------------------hashJoin[INNER_JOIN](item.i_item_sk = store_sales.ss_item_sk) +--------------------------------PhysicalProject +----------------------------------PhysicalOlapScan[store_sales] +--------------------------------PhysicalDistribute +----------------------------------PhysicalProject +------------------------------------filter((item.i_category = 'Home')) +--------------------------------------PhysicalOlapScan[item] ----------------------------PhysicalDistribute ------------------------------PhysicalProject ---------------------------------filter((item.i_category = 'Home')) -----------------------------------PhysicalOlapScan[item] -------------------------PhysicalDistribute ---------------------------PhysicalProject -----------------------------filter(d_year IN (1998, 1999)) -------------------------------PhysicalOlapScan[date_dim] ---------------PhysicalDistribute -----------------PhysicalProject -------------------hashJoin[RIGHT_OUTER_JOIN](web_sales.ws_item_sk = web_returns.wr_item_sk)(web_sales.ws_order_number = web_returns.wr_order_number) +--------------------------------filter(d_year IN (1998, 1999)) +----------------------------------PhysicalOlapScan[date_dim] +------------------PhysicalDistribute --------------------PhysicalProject -----------------------PhysicalOlapScan[web_returns] ---------------------PhysicalProject -----------------------hashJoin[INNER_JOIN](date_dim.d_date_sk = web_sales.ws_sold_date_sk) +----------------------hashJoin[RIGHT_OUTER_JOIN](web_sales.ws_item_sk = web_returns.wr_item_sk)(web_sales.ws_order_number = web_returns.wr_order_number) +------------------------PhysicalProject +--------------------------PhysicalOlapScan[web_returns] ------------------------PhysicalProject ---------------------------hashJoin[INNER_JOIN](item.i_item_sk = web_sales.ws_item_sk) +--------------------------hashJoin[INNER_JOIN](date_dim.d_date_sk = web_sales.ws_sold_date_sk) ----------------------------PhysicalProject -------------------------------PhysicalOlapScan[web_sales] +------------------------------hashJoin[INNER_JOIN](item.i_item_sk = web_sales.ws_item_sk) +--------------------------------PhysicalProject +----------------------------------PhysicalOlapScan[web_sales] +--------------------------------PhysicalDistribute +----------------------------------PhysicalProject +------------------------------------filter((item.i_category = 'Home')) +--------------------------------------PhysicalOlapScan[item] ----------------------------PhysicalDistribute ------------------------------PhysicalProject ---------------------------------filter((item.i_category = 'Home')) -----------------------------------PhysicalOlapScan[item] -------------------------PhysicalDistribute ---------------------------PhysicalProject -----------------------------filter(d_year IN (1998, 1999)) -------------------------------PhysicalOlapScan[date_dim] +--------------------------------filter(d_year IN (1998, 1999)) +----------------------------------PhysicalOlapScan[date_dim] --PhysicalResultSink ----PhysicalTopN ------PhysicalDistribute diff --git a/regression-test/suites/nereids_p0/aggregate/agg_union_random.groovy b/regression-test/suites/nereids_p0/aggregate/agg_union_random.groovy new file mode 100644 index 00000000000000..f233c80dac62ac --- /dev/null +++ b/regression-test/suites/nereids_p0/aggregate/agg_union_random.groovy @@ -0,0 +1,54 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +suite("agg_union_random") { + sql "SET enable_nereids_planner=true" + sql "SET enable_fallback_to_original_planner=false" + sql "DROP TABLE IF EXISTS test_random;" + sql """ + create table test_random + ( + a varchar(100) null, + b decimalv3(18,10) null + ) ENGINE=OLAP + DUPLICATE KEY(`a`) + DISTRIBUTED BY HASH(`a`) BUCKETS 1 + PROPERTIES ( + "replication_allocation" = "tag.location.default: 1" + ); + """ + + explain{ + sql "select a from (select * from test_random union all (select * from test_random))t group by a" + /** + STREAM DATA SINK + EXCHANGE ID: 258 + RANDOM + + 252:VOlapScanNode + TABLE: default_cluster:regression_test_nereids_p0_aggregate.test_random(test_random), PREAGGREGATION: ON + partitions=0/1, tablets=0/0, tabletList= + cardinality=1, avgRowSize=0.0, numNodes=1 + pushAggOp=NONE + **/ + contains "RANDOM" + } + + sql "DROP TABLE IF EXISTS test_random;" +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf.tmpl b/regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf.tmpl index 068d9acb39298c..6bc8dfcc60f0f8 100644 --- a/regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf.tmpl +++ b/regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf.tmpl @@ -49,9 +49,9 @@ suite("ds_rf{--}") { } } - // def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.{--}" - // File file = new File(outFile) - // file.write(getRuntimeFilters(plan)) + //def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.{--}" + //File file = new File(outFile) + //file.write(getRuntimeFilters(plan)) - assertEquals("{rfs}", getRuntimeFilters(plan)) + assertEquals("{rfs}", getRuntimeFilters(plan)) } diff --git a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf1.groovy b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf1.groovy index fc2efbaf96028e..dc35149c156a24 100644 --- a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf1.groovy +++ b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf1.groovy @@ -1,78 +1,79 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -suite("ds_rf1") { - String db = context.config.getDbNameByFile(new File(context.file.parent)) - sql "use ${db}" - sql 'set enable_nereids_planner=true' - sql 'set enable_fallback_to_original_planner=false' - sql 'set exec_mem_limit=21G' - sql 'set be_number_for_test=3' - sql 'set parallel_fragment_exec_instance_num=8; ' - sql 'set parallel_pipeline_task_num=8; ' - sql 'set forbid_unknown_col_stats=true' - sql 'set broadcast_row_count_limit = 30000000' - sql 'set enable_nereids_timeout = false' - sql 'set enable_pipeline_engine=true' - String stmt = ''' - explain physical plan - with customer_total_return as -(select sr_customer_sk as ctr_customer_sk -,sr_store_sk as ctr_store_sk -,sum(SR_FEE) as ctr_total_return -from store_returns -,date_dim -where sr_returned_date_sk = d_date_sk -and d_year =2000 -group by sr_customer_sk -,sr_store_sk) - select c_customer_id -from customer_total_return ctr1 -,store -,customer -where ctr1.ctr_total_return > (select avg(ctr_total_return)*1.2 -from customer_total_return ctr2 -where ctr1.ctr_store_sk = ctr2.ctr_store_sk) -and s_store_sk = ctr1.ctr_store_sk -and s_state = 'SD' -and ctr1.ctr_customer_sk = c_customer_sk -order by c_customer_id -limit 100; - - ''' - String plan = sql "${stmt}" - println plan - def getRuntimeFilters = { plantree -> - { - def lst = [] - plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { - ch -> - { - lst.add(ch.replaceAll("#\\d+", '')) - } - } - return lst.join(',') - } - } - - // def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.1" - // File file = new File(outFile) - // file.write(getRuntimeFilters(plan)) - assertEquals("RF0[d_date_sk->[sr_returned_date_sk],RF1[ctr_customer_sk->[c_customer_sk]", getRuntimeFilters(plan)) -} +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +suite("ds_rf1") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_fragment_exec_instance_num=8; ' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set broadcast_row_count_limit = 30000000' + sql 'set enable_nereids_timeout = false' + sql 'set enable_pipeline_engine=true' + String stmt = ''' + explain physical plan + with customer_total_return as +(select sr_customer_sk as ctr_customer_sk +,sr_store_sk as ctr_store_sk +,sum(SR_FEE) as ctr_total_return +from store_returns +,date_dim +where sr_returned_date_sk = d_date_sk +and d_year =2000 +group by sr_customer_sk +,sr_store_sk) + select c_customer_id +from customer_total_return ctr1 +,store +,customer +where ctr1.ctr_total_return > (select avg(ctr_total_return)*1.2 +from customer_total_return ctr2 +where ctr1.ctr_store_sk = ctr2.ctr_store_sk) +and s_store_sk = ctr1.ctr_store_sk +and s_state = 'SD' +and ctr1.ctr_customer_sk = c_customer_sk +order by c_customer_id +limit 100; + + ''' + String plan = sql "${stmt}" + println plan + def getRuntimeFilters = { plantree -> + { + def lst = [] + plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { + ch -> + { + lst.add(ch.replaceAll("#\\d+", '')) + } + } + return lst.join(',') + } + } + + //def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.1" + //File file = new File(outFile) + //file.write(getRuntimeFilters(plan)) + + assertEquals("RF0[d_date_sk->[sr_returned_date_sk],RF1[ctr_customer_sk->[c_customer_sk]", getRuntimeFilters(plan)) +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf10.groovy b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf10.groovy index 9bc4fd4c70cd66..fa147d01803b96 100644 --- a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf10.groovy +++ b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf10.groovy @@ -1,37 +1,37 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -suite("ds_rf10") { - String db = context.config.getDbNameByFile(new File(context.file.parent)) - sql "use ${db}" - sql 'set enable_nereids_planner=true' - sql 'set enable_fallback_to_original_planner=false' - sql 'set exec_mem_limit=21G' - sql 'set be_number_for_test=3' - sql 'set parallel_fragment_exec_instance_num=8; ' - sql 'set parallel_pipeline_task_num=8; ' - sql 'set forbid_unknown_col_stats=true' - sql 'set broadcast_row_count_limit = 30000000' - sql 'set enable_nereids_timeout = false' - sql 'set enable_pipeline_engine=true' - String stmt = ''' - explain physical plan +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +suite("ds_rf10") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_fragment_exec_instance_num=8; ' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set broadcast_row_count_limit = 30000000' + sql 'set enable_nereids_timeout = false' + sql 'set enable_pipeline_engine=true' + String stmt = ''' + explain physical plan select cd_gender, cd_marital_status, @@ -88,26 +88,26 @@ suite("ds_rf10") { cd_dep_employed_count, cd_dep_college_count limit 100; - - ''' - String plan = sql "${stmt}" - println plan - def getRuntimeFilters = { plantree -> - { - def lst = [] - plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { - ch -> - { - lst.add(ch.replaceAll("#\\d+", '')) - } - } - return lst.join(',') - } - } - - // def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.10" - // File file = new File(outFile) - // file.write(getRuntimeFilters(plan)) - - assertEquals("RF5[c_current_cdemo_sk->[cd_demo_sk],RF4[c_customer_sk->[ss_customer_sk],RF3[d_date_sk->[ss_sold_date_sk],RF2[ca_address_sk->[c_current_addr_sk],RF1[d_date_sk->[ws_sold_date_sk],RF0[d_date_sk->[cs_sold_date_sk]", getRuntimeFilters(plan)) -} + + ''' + String plan = sql "${stmt}" + println plan + def getRuntimeFilters = { plantree -> + { + def lst = [] + plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { + ch -> + { + lst.add(ch.replaceAll("#\\d+", '')) + } + } + return lst.join(',') + } + } + + //def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.10" + //File file = new File(outFile) + //file.write(getRuntimeFilters(plan)) + + assertEquals("RF5[c_current_cdemo_sk->[cd_demo_sk],RF4[c_customer_sk->[ss_customer_sk],RF3[d_date_sk->[ss_sold_date_sk],RF2[ca_address_sk->[c_current_addr_sk],RF1[d_date_sk->[ws_sold_date_sk],RF0[d_date_sk->[cs_sold_date_sk]", getRuntimeFilters(plan)) +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf11.groovy b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf11.groovy index c36b43a5ac413d..85f3b22efb7eca 100644 --- a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf11.groovy +++ b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf11.groovy @@ -1,37 +1,37 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -suite("ds_rf11") { - String db = context.config.getDbNameByFile(new File(context.file.parent)) - sql "use ${db}" - sql 'set enable_nereids_planner=true' - sql 'set enable_fallback_to_original_planner=false' - sql 'set exec_mem_limit=21G' - sql 'set be_number_for_test=3' - sql 'set parallel_fragment_exec_instance_num=8; ' - sql 'set parallel_pipeline_task_num=8; ' - sql 'set forbid_unknown_col_stats=true' - sql 'set broadcast_row_count_limit = 30000000' - sql 'set enable_nereids_timeout = false' - sql 'set enable_pipeline_engine=true' - String stmt = ''' - explain physical plan +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +suite("ds_rf11") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_fragment_exec_instance_num=8; ' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set broadcast_row_count_limit = 30000000' + sql 'set enable_nereids_timeout = false' + sql 'set enable_pipeline_engine=true' + String stmt = ''' + explain physical plan with year_total as ( select c_customer_id customer_id ,c_first_name customer_first_name @@ -110,26 +110,26 @@ suite("ds_rf11") { ,t_s_secyear.customer_last_name ,t_s_secyear.customer_birth_country limit 100; - - ''' - String plan = sql "${stmt}" - println plan - def getRuntimeFilters = { plantree -> - { - def lst = [] - plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { - ch -> - { - lst.add(ch.replaceAll("#\\d+", '')) - } - } - return lst.join(',') - } - } - - // def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.11" - // File file = new File(outFile) - // file.write(getRuntimeFilters(plan)) - - assertEquals("RF1[c_customer_sk->[ss_customer_sk],RF0[d_date_sk->[ss_sold_date_sk],RF3[c_customer_sk->[ws_bill_customer_sk],RF2[d_date_sk->[ws_sold_date_sk]", getRuntimeFilters(plan)) -} + + ''' + String plan = sql "${stmt}" + println plan + def getRuntimeFilters = { plantree -> + { + def lst = [] + plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { + ch -> + { + lst.add(ch.replaceAll("#\\d+", '')) + } + } + return lst.join(',') + } + } + + //def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.11" + //File file = new File(outFile) + //file.write(getRuntimeFilters(plan)) + + assertEquals("RF1[c_customer_sk->[ss_customer_sk],RF0[d_date_sk->[ss_sold_date_sk],RF3[c_customer_sk->[ws_bill_customer_sk],RF2[d_date_sk->[ws_sold_date_sk]", getRuntimeFilters(plan)) +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf12.groovy b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf12.groovy index 35d5701519dc0c..520e0789bc0e9b 100644 --- a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf12.groovy +++ b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf12.groovy @@ -1,37 +1,37 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -suite("ds_rf12") { - String db = context.config.getDbNameByFile(new File(context.file.parent)) - sql "use ${db}" - sql 'set enable_nereids_planner=true' - sql 'set enable_fallback_to_original_planner=false' - sql 'set exec_mem_limit=21G' - sql 'set be_number_for_test=3' - sql 'set parallel_fragment_exec_instance_num=8; ' - sql 'set parallel_pipeline_task_num=8; ' - sql 'set forbid_unknown_col_stats=true' - sql 'set broadcast_row_count_limit = 30000000' - sql 'set enable_nereids_timeout = false' - sql 'set enable_pipeline_engine=true' - String stmt = ''' - explain physical plan +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +suite("ds_rf12") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_fragment_exec_instance_num=8; ' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set broadcast_row_count_limit = 30000000' + sql 'set enable_nereids_timeout = false' + sql 'set enable_pipeline_engine=true' + String stmt = ''' + explain physical plan select i_item_id ,i_item_desc ,i_category @@ -63,26 +63,26 @@ order by ,i_item_desc ,revenueratio limit 100; - - ''' - String plan = sql "${stmt}" - println plan - def getRuntimeFilters = { plantree -> - { - def lst = [] - plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { - ch -> - { - lst.add(ch.replaceAll("#\\d+", '')) - } - } - return lst.join(',') - } - } - - // def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.12" - // File file = new File(outFile) - // file.write(getRuntimeFilters(plan)) - - assertEquals("RF1[i_item_sk->[ws_item_sk],RF0[d_date_sk->[ws_sold_date_sk]", getRuntimeFilters(plan)) -} + + ''' + String plan = sql "${stmt}" + println plan + def getRuntimeFilters = { plantree -> + { + def lst = [] + plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { + ch -> + { + lst.add(ch.replaceAll("#\\d+", '')) + } + } + return lst.join(',') + } + } + + //def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.12" + //File file = new File(outFile) + //file.write(getRuntimeFilters(plan)) + + assertEquals("RF1[i_item_sk->[ws_item_sk],RF0[d_date_sk->[ws_sold_date_sk]", getRuntimeFilters(plan)) +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf13.groovy b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf13.groovy index 2961139fa0d494..a15edab93c265b 100644 --- a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf13.groovy +++ b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf13.groovy @@ -1,37 +1,37 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -suite("ds_rf13") { - String db = context.config.getDbNameByFile(new File(context.file.parent)) - sql "use ${db}" - sql 'set enable_nereids_planner=true' - sql 'set enable_fallback_to_original_planner=false' - sql 'set exec_mem_limit=21G' - sql 'set be_number_for_test=3' - sql 'set parallel_fragment_exec_instance_num=8; ' - sql 'set parallel_pipeline_task_num=8; ' - sql 'set forbid_unknown_col_stats=true' - sql 'set broadcast_row_count_limit = 30000000' - sql 'set enable_nereids_timeout = false' - sql 'set enable_pipeline_engine=true' - String stmt = ''' - explain physical plan +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +suite("ds_rf13") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_fragment_exec_instance_num=8; ' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set broadcast_row_count_limit = 30000000' + sql 'set enable_nereids_timeout = false' + sql 'set enable_pipeline_engine=true' + String stmt = ''' + explain physical plan select avg(ss_quantity) ,avg(ss_ext_sales_price) ,avg(ss_ext_wholesale_cost) @@ -81,26 +81,26 @@ suite("ds_rf13") { and ss_net_profit between 50 and 250 )) ; - - ''' - String plan = sql "${stmt}" - println plan - def getRuntimeFilters = { plantree -> - { - def lst = [] - plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { - ch -> - { - lst.add(ch.replaceAll("#\\d+", '')) - } - } - return lst.join(',') - } - } - - // def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.13" - // File file = new File(outFile) - // file.write(getRuntimeFilters(plan)) - - assertEquals("RF4[ss_store_sk->[s_store_sk],RF3[ss_sold_date_sk->[d_date_sk],RF2[ss_cdemo_sk->[cd_demo_sk],RF1[ss_hdemo_sk->[hd_demo_sk],RF0[ca_address_sk->[ss_addr_sk]", getRuntimeFilters(plan)) -} + + ''' + String plan = sql "${stmt}" + println plan + def getRuntimeFilters = { plantree -> + { + def lst = [] + plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { + ch -> + { + lst.add(ch.replaceAll("#\\d+", '')) + } + } + return lst.join(',') + } + } + + //def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.13" + //File file = new File(outFile) + //file.write(getRuntimeFilters(plan)) + + assertEquals("RF4[ss_store_sk->[s_store_sk],RF3[ss_cdemo_sk->[cd_demo_sk],RF2[hd_demo_sk->[ss_hdemo_sk],RF1[d_date_sk->[ss_sold_date_sk],RF0[ca_address_sk->[ss_addr_sk]", getRuntimeFilters(plan)) +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf14.groovy b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf14.groovy index 503bbed89531d6..b226c03362d30c 100644 --- a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf14.groovy +++ b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf14.groovy @@ -150,7 +150,9 @@ suite("ds_rf14") { } } - // def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.14" - // File file = new File(outFile) - assertEquals("RF3[i_item_sk->[ss_item_sk],RF2[d_date_sk->[ss_sold_date_sk],RF5[i_item_sk->[cs_item_sk],RF4[d_date_sk->[cs_sold_date_sk],RF7[i_item_sk->[ws_item_sk],RF6[d_date_sk->[ws_sold_date_sk],RF1[i_item_sk->[ss_item_sk],RF0[d_date_sk->[ss_sold_date_sk],RF9[i_item_sk->[cs_item_sk],RF8[d_date_sk->[cs_sold_date_sk],RF11[i_item_sk->[ws_item_sk],RF10[d_date_sk->[ws_sold_date_sk]", getRuntimeFilters(plan)) + //def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.14" + //File file = new File(outFile) + //file.write(getRuntimeFilters(plan)) + + assertEquals("RF3[i_item_sk->[ss_item_sk],RF2[d_date_sk->[ss_sold_date_sk],RF5[i_item_sk->[cs_item_sk],RF4[d_date_sk->[cs_sold_date_sk],RF7[i_item_sk->[ws_item_sk],RF6[d_date_sk->[ws_sold_date_sk],RF1[i_item_sk->[ss_item_sk],RF0[d_date_sk->[ss_sold_date_sk],RF9[i_item_sk->[cs_item_sk],RF8[d_date_sk->[cs_sold_date_sk],RF11[i_item_sk->[ws_item_sk],RF10[d_date_sk->[ws_sold_date_sk]", getRuntimeFilters(plan)) } diff --git a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf15.groovy b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf15.groovy index 94d432cef20f08..0699dd9b1f2a42 100644 --- a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf15.groovy +++ b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf15.groovy @@ -1,37 +1,37 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -suite("ds_rf15") { - String db = context.config.getDbNameByFile(new File(context.file.parent)) - sql "use ${db}" - sql 'set enable_nereids_planner=true' - sql 'set enable_fallback_to_original_planner=false' - sql 'set exec_mem_limit=21G' - sql 'set be_number_for_test=3' - sql 'set parallel_fragment_exec_instance_num=8; ' - sql 'set parallel_pipeline_task_num=8; ' - sql 'set forbid_unknown_col_stats=true' - sql 'set broadcast_row_count_limit = 30000000' - sql 'set enable_nereids_timeout = false' - sql 'set enable_pipeline_engine=true' - String stmt = ''' - explain physical plan +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +suite("ds_rf15") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_fragment_exec_instance_num=8; ' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set broadcast_row_count_limit = 30000000' + sql 'set enable_nereids_timeout = false' + sql 'set enable_pipeline_engine=true' + String stmt = ''' + explain physical plan select ca_zip ,sum(cs_sales_price) from catalog_sales @@ -49,26 +49,26 @@ suite("ds_rf15") { group by ca_zip order by ca_zip limit 100; - - ''' - String plan = sql "${stmt}" - println plan - def getRuntimeFilters = { plantree -> - { - def lst = [] - plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { - ch -> - { - lst.add(ch.replaceAll("#\\d+", '')) - } - } - return lst.join(',') - } - } - - // def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.15" - // File file = new File(outFile) - // file.write(getRuntimeFilters(plan)) - - assertEquals("RF2[c_customer_sk->[cs_bill_customer_sk],RF1[d_date_sk->[cs_sold_date_sk],RF0[ca_address_sk->[c_current_addr_sk]", getRuntimeFilters(plan)) -} + + ''' + String plan = sql "${stmt}" + println plan + def getRuntimeFilters = { plantree -> + { + def lst = [] + plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { + ch -> + { + lst.add(ch.replaceAll("#\\d+", '')) + } + } + return lst.join(',') + } + } + + //def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.15" + //File file = new File(outFile) + //file.write(getRuntimeFilters(plan)) + + assertEquals("RF2[c_customer_sk->[cs_bill_customer_sk],RF1[d_date_sk->[cs_sold_date_sk],RF0[ca_address_sk->[c_current_addr_sk]", getRuntimeFilters(plan)) +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf16.groovy b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf16.groovy index c0ac901f3d2ad6..544d697eddf4ad 100644 --- a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf16.groovy +++ b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf16.groovy @@ -1,37 +1,37 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -suite("ds_rf16") { - String db = context.config.getDbNameByFile(new File(context.file.parent)) - sql "use ${db}" - sql 'set enable_nereids_planner=true' - sql 'set enable_fallback_to_original_planner=false' - sql 'set exec_mem_limit=21G' - sql 'set be_number_for_test=3' - sql 'set parallel_fragment_exec_instance_num=8; ' - sql 'set parallel_pipeline_task_num=8; ' - sql 'set forbid_unknown_col_stats=true' - sql 'set broadcast_row_count_limit = 30000000' - sql 'set enable_nereids_timeout = false' - sql 'set enable_pipeline_engine=true' - String stmt = ''' - explain physical plan +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +suite("ds_rf16") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_fragment_exec_instance_num=8; ' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set broadcast_row_count_limit = 30000000' + sql 'set enable_nereids_timeout = false' + sql 'set enable_pipeline_engine=true' + String stmt = ''' + explain physical plan select count(distinct cs_order_number) as "order count" ,sum(cs_ext_ship_cost) as "total shipping cost" @@ -60,26 +60,26 @@ and not exists(select * where cs1.cs_order_number = cr1.cr_order_number) order by count(distinct cs_order_number) limit 100; - - ''' - String plan = sql "${stmt}" - println plan - def getRuntimeFilters = { plantree -> - { - def lst = [] - plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { - ch -> - { - lst.add(ch.replaceAll("#\\d+", '')) - } - } - return lst.join(',') - } - } - - // def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.16" - // File file = new File(outFile) - // file.write(getRuntimeFilters(plan)) - - assertEquals("RF4[d_date_sk->[cs_ship_date_sk],RF3[cs_order_number->[cs_order_number],RF2[cc_call_center_sk->[cs_call_center_sk],RF1[cs_order_number->[cr_order_number],RF0[ca_address_sk->[cs_ship_addr_sk]", getRuntimeFilters(plan)) -} + + ''' + String plan = sql "${stmt}" + println plan + def getRuntimeFilters = { plantree -> + { + def lst = [] + plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { + ch -> + { + lst.add(ch.replaceAll("#\\d+", '')) + } + } + return lst.join(',') + } + } + + //def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.16" + //File file = new File(outFile) + //file.write(getRuntimeFilters(plan)) + + assertEquals("RF4[cs_order_number->[cs_order_number],RF3[cc_call_center_sk->[cs_call_center_sk],RF2[cs_order_number->[cr_order_number],RF1[d_date_sk->[cs_ship_date_sk],RF0[ca_address_sk->[cs_ship_addr_sk]", getRuntimeFilters(plan)) +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf17.groovy b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf17.groovy index 970ba759adce3c..9c44c9ae63743e 100644 --- a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf17.groovy +++ b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf17.groovy @@ -1,98 +1,99 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -suite("ds_rf17") { - String db = context.config.getDbNameByFile(new File(context.file.parent)) - sql "use ${db}" - sql 'set enable_nereids_planner=true' - sql 'set enable_fallback_to_original_planner=false' - sql 'set exec_mem_limit=21G' - sql 'set be_number_for_test=3' - sql 'set parallel_fragment_exec_instance_num=8; ' - sql 'set parallel_pipeline_task_num=8; ' - sql 'set forbid_unknown_col_stats=true' - sql 'set broadcast_row_count_limit = 30000000' - sql 'set enable_nereids_timeout = false' - sql 'set enable_pipeline_engine=true' - String stmt = ''' - explain physical plan - select i_item_id - ,i_item_desc - ,s_state - ,count(ss_quantity) as store_sales_quantitycount - ,avg(ss_quantity) as store_sales_quantityave - ,stddev_samp(ss_quantity) as store_sales_quantitystdev - ,stddev_samp(ss_quantity)/avg(ss_quantity) as store_sales_quantitycov - ,count(sr_return_quantity) as store_returns_quantitycount - ,avg(sr_return_quantity) as store_returns_quantityave - ,stddev_samp(sr_return_quantity) as store_returns_quantitystdev - ,stddev_samp(sr_return_quantity)/avg(sr_return_quantity) as store_returns_quantitycov - ,count(cs_quantity) as catalog_sales_quantitycount ,avg(cs_quantity) as catalog_sales_quantityave - ,stddev_samp(cs_quantity) as catalog_sales_quantitystdev - ,stddev_samp(cs_quantity)/avg(cs_quantity) as catalog_sales_quantitycov - from store_sales - ,store_returns - ,catalog_sales - ,date_dim d1 - ,date_dim d2 - ,date_dim d3 - ,store - ,item - where d1.d_quarter_name = '2001Q1' - and d1.d_date_sk = ss_sold_date_sk - and i_item_sk = ss_item_sk - and s_store_sk = ss_store_sk - and ss_customer_sk = sr_customer_sk - and ss_item_sk = sr_item_sk - and ss_ticket_number = sr_ticket_number - and sr_returned_date_sk = d2.d_date_sk - and d2.d_quarter_name in ('2001Q1','2001Q2','2001Q3') - and sr_customer_sk = cs_bill_customer_sk - and sr_item_sk = cs_item_sk - and cs_sold_date_sk = d3.d_date_sk - and d3.d_quarter_name in ('2001Q1','2001Q2','2001Q3') - group by i_item_id - ,i_item_desc - ,s_state - order by i_item_id - ,i_item_desc - ,s_state -limit 100; - - ''' - String plan = sql "${stmt}" - println plan - def getRuntimeFilters = { plantree -> - { - def lst = [] - plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { - ch -> - { - lst.add(ch.replaceAll("#\\d+", '')) - } - } - return lst.join(',') - } - } - - // def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.17" - // File file = new File(outFile) - // file.write(getRuntimeFilters(plan)) - assertEquals("RF9[d_date_sk->[cs_sold_date_sk],RF7[sr_customer_sk->[cs_bill_customer_sk],RF8[sr_item_sk->[cs_item_sk],RF6[s_store_sk->[ss_store_sk],RF5[i_item_sk->[ss_item_sk],RF4[d_date_sk->[sr_returned_date_sk],RF1[ss_customer_sk->[sr_customer_sk],RF2[ss_item_sk->[sr_item_sk],RF3[ss_ticket_number->[sr_ticket_number],RF0[d_date_sk->[ss_sold_date_sk]", getRuntimeFilters(plan)) -} +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +suite("ds_rf17") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_fragment_exec_instance_num=8; ' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set broadcast_row_count_limit = 30000000' + sql 'set enable_nereids_timeout = false' + sql 'set enable_pipeline_engine=true' + String stmt = ''' + explain physical plan + select i_item_id + ,i_item_desc + ,s_state + ,count(ss_quantity) as store_sales_quantitycount + ,avg(ss_quantity) as store_sales_quantityave + ,stddev_samp(ss_quantity) as store_sales_quantitystdev + ,stddev_samp(ss_quantity)/avg(ss_quantity) as store_sales_quantitycov + ,count(sr_return_quantity) as store_returns_quantitycount + ,avg(sr_return_quantity) as store_returns_quantityave + ,stddev_samp(sr_return_quantity) as store_returns_quantitystdev + ,stddev_samp(sr_return_quantity)/avg(sr_return_quantity) as store_returns_quantitycov + ,count(cs_quantity) as catalog_sales_quantitycount ,avg(cs_quantity) as catalog_sales_quantityave + ,stddev_samp(cs_quantity) as catalog_sales_quantitystdev + ,stddev_samp(cs_quantity)/avg(cs_quantity) as catalog_sales_quantitycov + from store_sales + ,store_returns + ,catalog_sales + ,date_dim d1 + ,date_dim d2 + ,date_dim d3 + ,store + ,item + where d1.d_quarter_name = '2001Q1' + and d1.d_date_sk = ss_sold_date_sk + and i_item_sk = ss_item_sk + and s_store_sk = ss_store_sk + and ss_customer_sk = sr_customer_sk + and ss_item_sk = sr_item_sk + and ss_ticket_number = sr_ticket_number + and sr_returned_date_sk = d2.d_date_sk + and d2.d_quarter_name in ('2001Q1','2001Q2','2001Q3') + and sr_customer_sk = cs_bill_customer_sk + and sr_item_sk = cs_item_sk + and cs_sold_date_sk = d3.d_date_sk + and d3.d_quarter_name in ('2001Q1','2001Q2','2001Q3') + group by i_item_id + ,i_item_desc + ,s_state + order by i_item_id + ,i_item_desc + ,s_state +limit 100; + + ''' + String plan = sql "${stmt}" + println plan + def getRuntimeFilters = { plantree -> + { + def lst = [] + plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { + ch -> + { + lst.add(ch.replaceAll("#\\d+", '')) + } + } + return lst.join(',') + } + } + + //def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.17" + //File file = new File(outFile) + //file.write(getRuntimeFilters(plan)) + + assertEquals("RF9[d_date_sk->[cs_sold_date_sk],RF7[sr_customer_sk->[cs_bill_customer_sk],RF8[sr_item_sk->[cs_item_sk],RF6[s_store_sk->[ss_store_sk],RF5[i_item_sk->[ss_item_sk],RF4[d_date_sk->[sr_returned_date_sk],RF1[ss_customer_sk->[sr_customer_sk],RF2[ss_item_sk->[sr_item_sk],RF3[ss_ticket_number->[sr_ticket_number],RF0[d_date_sk->[ss_sold_date_sk]", getRuntimeFilters(plan)) +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf18.groovy b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf18.groovy index 7b6576ec21fdc7..c2ff75dee063c5 100644 --- a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf18.groovy +++ b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf18.groovy @@ -1,37 +1,37 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -suite("ds_rf18") { - String db = context.config.getDbNameByFile(new File(context.file.parent)) - sql "use ${db}" - sql 'set enable_nereids_planner=true' - sql 'set enable_fallback_to_original_planner=false' - sql 'set exec_mem_limit=21G' - sql 'set be_number_for_test=3' - sql 'set parallel_fragment_exec_instance_num=8; ' - sql 'set parallel_pipeline_task_num=8; ' - sql 'set forbid_unknown_col_stats=true' - sql 'set broadcast_row_count_limit = 30000000' - sql 'set enable_nereids_timeout = false' - sql 'set enable_pipeline_engine=true' - String stmt = ''' - explain physical plan +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +suite("ds_rf18") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_fragment_exec_instance_num=8; ' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set broadcast_row_count_limit = 30000000' + sql 'set enable_nereids_timeout = false' + sql 'set enable_pipeline_engine=true' + String stmt = ''' + explain physical plan select i_item_id, ca_country, ca_state, @@ -63,26 +63,26 @@ suite("ds_rf18") { ca_county, i_item_id limit 100; - - ''' - String plan = sql "${stmt}" - println plan - def getRuntimeFilters = { plantree -> - { - def lst = [] - plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { - ch -> - { - lst.add(ch.replaceAll("#\\d+", '')) - } - } - return lst.join(',') - } - } - - // def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.18" - // File file = new File(outFile) - // file.write(getRuntimeFilters(plan)) - - assertEquals("RF5[cs_item_sk->[i_item_sk],RF4[c_current_cdemo_sk->[cd_demo_sk],RF3[ca_address_sk->[c_current_addr_sk],RF2[c_customer_sk->[cs_bill_customer_sk],RF1[d_date_sk->[cs_sold_date_sk],RF0[cd_demo_sk->[cs_bill_cdemo_sk]", getRuntimeFilters(plan)) -} + + ''' + String plan = sql "${stmt}" + println plan + def getRuntimeFilters = { plantree -> + { + def lst = [] + plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { + ch -> + { + lst.add(ch.replaceAll("#\\d+", '')) + } + } + return lst.join(',') + } + } + + //def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.18" + //File file = new File(outFile) + //file.write(getRuntimeFilters(plan)) + + assertEquals("RF5[c_current_cdemo_sk->[cd_demo_sk],RF4[cs_item_sk->[i_item_sk],RF3[d_date_sk->[cs_sold_date_sk],RF2[cd_demo_sk->[cs_bill_cdemo_sk],RF1[c_customer_sk->[cs_bill_customer_sk],RF0[ca_address_sk->[c_current_addr_sk]", getRuntimeFilters(plan)) +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf19.groovy b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf19.groovy index e521f4cfb9895d..e82e879b7d06d5 100644 --- a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf19.groovy +++ b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf19.groovy @@ -1,37 +1,37 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -suite("ds_rf19") { - String db = context.config.getDbNameByFile(new File(context.file.parent)) - sql "use ${db}" - sql 'set enable_nereids_planner=true' - sql 'set enable_fallback_to_original_planner=false' - sql 'set exec_mem_limit=21G' - sql 'set be_number_for_test=3' - sql 'set parallel_fragment_exec_instance_num=8; ' - sql 'set parallel_pipeline_task_num=8; ' - sql 'set forbid_unknown_col_stats=true' - sql 'set broadcast_row_count_limit = 30000000' - sql 'set enable_nereids_timeout = false' - sql 'set enable_pipeline_engine=true' - String stmt = ''' - explain physical plan +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +suite("ds_rf19") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_fragment_exec_instance_num=8; ' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set broadcast_row_count_limit = 30000000' + sql 'set enable_nereids_timeout = false' + sql 'set enable_pipeline_engine=true' + String stmt = ''' + explain physical plan select i_brand_id brand_id, i_brand brand, i_manufact_id, i_manufact, sum(ss_ext_sales_price) ext_price from date_dim, store_sales, item,customer,customer_address,store @@ -54,26 +54,26 @@ suite("ds_rf19") { ,i_manufact_id ,i_manufact limit 100 ; - - ''' - String plan = sql "${stmt}" - println plan - def getRuntimeFilters = { plantree -> - { - def lst = [] - plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { - ch -> - { - lst.add(ch.replaceAll("#\\d+", '')) - } - } - return lst.join(',') - } - } - - // def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.19" - // File file = new File(outFile) - // file.write(getRuntimeFilters(plan)) - - assertEquals("RF4[s_store_sk->[ss_store_sk],RF3[c_current_addr_sk->[ca_address_sk],RF2[ss_customer_sk->[c_customer_sk],RF1[d_date_sk->[ss_sold_date_sk],RF0[i_item_sk->[ss_item_sk]", getRuntimeFilters(plan)) -} + + ''' + String plan = sql "${stmt}" + println plan + def getRuntimeFilters = { plantree -> + { + def lst = [] + plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { + ch -> + { + lst.add(ch.replaceAll("#\\d+", '')) + } + } + return lst.join(',') + } + } + + //def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.19" + //File file = new File(outFile) + //file.write(getRuntimeFilters(plan)) + + assertEquals("RF4[s_store_sk->[ss_store_sk],RF3[c_current_addr_sk->[ca_address_sk],RF2[ss_customer_sk->[c_customer_sk],RF1[d_date_sk->[ss_sold_date_sk],RF0[i_item_sk->[ss_item_sk]", getRuntimeFilters(plan)) +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf2.groovy b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf2.groovy index fa8058af17654a..00d7bca8636e38 100644 --- a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf2.groovy +++ b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf2.groovy @@ -106,9 +106,9 @@ suite("ds_rf2") { } } - // def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.2" - // File file = new File(outFile) - // file.write(getRuntimeFilters(plan)) + //def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.2" + //File file = new File(outFile) + //file.write(getRuntimeFilters(plan)) - assertEquals("RF0[d_date_sk->[ws_sold_date_sk],RF1[d_date_sk->[cs_sold_date_sk],RF3[d_week_seq->[d_week_seq],RF2[d_week_seq->[d_week_seq]", getRuntimeFilters(plan)) + assertEquals("", getRuntimeFilters(plan)) } diff --git a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf20.groovy b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf20.groovy index 79439a8b737f07..0e60008f501c76 100644 --- a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf20.groovy +++ b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf20.groovy @@ -1,37 +1,37 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -suite("ds_rf20") { - String db = context.config.getDbNameByFile(new File(context.file.parent)) - sql "use ${db}" - sql 'set enable_nereids_planner=true' - sql 'set enable_fallback_to_original_planner=false' - sql 'set exec_mem_limit=21G' - sql 'set be_number_for_test=3' - sql 'set parallel_fragment_exec_instance_num=8; ' - sql 'set parallel_pipeline_task_num=8; ' - sql 'set forbid_unknown_col_stats=true' - sql 'set broadcast_row_count_limit = 30000000' - sql 'set enable_nereids_timeout = false' - sql 'set enable_pipeline_engine=true' - String stmt = ''' - explain physical plan +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +suite("ds_rf20") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_fragment_exec_instance_num=8; ' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set broadcast_row_count_limit = 30000000' + sql 'set enable_nereids_timeout = false' + sql 'set enable_pipeline_engine=true' + String stmt = ''' + explain physical plan select i_item_id ,i_item_desc ,i_category @@ -59,26 +59,26 @@ suite("ds_rf20") { ,i_item_desc ,revenueratio limit 100; - - ''' - String plan = sql "${stmt}" - println plan - def getRuntimeFilters = { plantree -> - { - def lst = [] - plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { - ch -> - { - lst.add(ch.replaceAll("#\\d+", '')) - } - } - return lst.join(',') - } - } - - // def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.20" - // File file = new File(outFile) - // file.write(getRuntimeFilters(plan)) - - assertEquals("RF1[i_item_sk->[cs_item_sk],RF0[d_date_sk->[cs_sold_date_sk]", getRuntimeFilters(plan)) -} + + ''' + String plan = sql "${stmt}" + println plan + def getRuntimeFilters = { plantree -> + { + def lst = [] + plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { + ch -> + { + lst.add(ch.replaceAll("#\\d+", '')) + } + } + return lst.join(',') + } + } + + //def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.20" + //File file = new File(outFile) + //file.write(getRuntimeFilters(plan)) + + assertEquals("RF1[i_item_sk->[cs_item_sk],RF0[d_date_sk->[cs_sold_date_sk]", getRuntimeFilters(plan)) +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf21.groovy b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf21.groovy index f11745592c0a1e..26e0c4b2af8712 100644 --- a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf21.groovy +++ b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf21.groovy @@ -1,37 +1,37 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -suite("ds_rf21") { - String db = context.config.getDbNameByFile(new File(context.file.parent)) - sql "use ${db}" - sql 'set enable_nereids_planner=true' - sql 'set enable_fallback_to_original_planner=false' - sql 'set exec_mem_limit=21G' - sql 'set be_number_for_test=3' - sql 'set parallel_fragment_exec_instance_num=8; ' - sql 'set parallel_pipeline_task_num=8; ' - sql 'set forbid_unknown_col_stats=true' - sql 'set broadcast_row_count_limit = 30000000' - sql 'set enable_nereids_timeout = false' - sql 'set enable_pipeline_engine=true' - String stmt = ''' - explain physical plan +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +suite("ds_rf21") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_fragment_exec_instance_num=8; ' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set broadcast_row_count_limit = 30000000' + sql 'set enable_nereids_timeout = false' + sql 'set enable_pipeline_engine=true' + String stmt = ''' + explain physical plan select * from(select w_warehouse_name ,i_item_id @@ -59,26 +59,26 @@ suite("ds_rf21") { order by w_warehouse_name ,i_item_id limit 100; - - ''' - String plan = sql "${stmt}" - println plan - def getRuntimeFilters = { plantree -> - { - def lst = [] - plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { - ch -> - { - lst.add(ch.replaceAll("#\\d+", '')) - } - } - return lst.join(',') - } - } - - // def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.21" - // File file = new File(outFile) - // file.write(getRuntimeFilters(plan)) - - assertEquals("RF2[w_warehouse_sk->[inv_warehouse_sk],RF1[d_date_sk->[inv_date_sk],RF0[i_item_sk->[inv_item_sk]", getRuntimeFilters(plan)) -} + + ''' + String plan = sql "${stmt}" + println plan + def getRuntimeFilters = { plantree -> + { + def lst = [] + plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { + ch -> + { + lst.add(ch.replaceAll("#\\d+", '')) + } + } + return lst.join(',') + } + } + + //def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.21" + //File file = new File(outFile) + //file.write(getRuntimeFilters(plan)) + + assertEquals("RF2[w_warehouse_sk->[inv_warehouse_sk],RF1[d_date_sk->[inv_date_sk],RF0[i_item_sk->[inv_item_sk]", getRuntimeFilters(plan)) +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf22.groovy b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf22.groovy index 2a31463b5c06e6..be395c283bbf4d 100644 --- a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf22.groovy +++ b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf22.groovy @@ -1,37 +1,37 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -suite("ds_rf22") { - String db = context.config.getDbNameByFile(new File(context.file.parent)) - sql "use ${db}" - sql 'set enable_nereids_planner=true' - sql 'set enable_fallback_to_original_planner=false' - sql 'set exec_mem_limit=21G' - sql 'set be_number_for_test=3' - sql 'set parallel_fragment_exec_instance_num=8; ' - sql 'set parallel_pipeline_task_num=8; ' - sql 'set forbid_unknown_col_stats=true' - sql 'set broadcast_row_count_limit = 30000000' - sql 'set enable_nereids_timeout = false' - sql 'set enable_pipeline_engine=true' - String stmt = ''' - explain physical plan +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +suite("ds_rf22") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_fragment_exec_instance_num=8; ' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set broadcast_row_count_limit = 30000000' + sql 'set enable_nereids_timeout = false' + sql 'set enable_pipeline_engine=true' + String stmt = ''' + explain physical plan select i_product_name ,i_brand ,i_class @@ -49,26 +49,26 @@ suite("ds_rf22") { ,i_category) order by qoh, i_product_name, i_brand, i_class, i_category limit 100; - - ''' - String plan = sql "${stmt}" - println plan - def getRuntimeFilters = { plantree -> - { - def lst = [] - plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { - ch -> - { - lst.add(ch.replaceAll("#\\d+", '')) - } - } - return lst.join(',') - } - } - - // def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.22" - // File file = new File(outFile) - // file.write(getRuntimeFilters(plan)) - - assertEquals("RF1[d_date_sk->[inv_date_sk],RF0[i_item_sk->[inv_item_sk]", getRuntimeFilters(plan)) -} + + ''' + String plan = sql "${stmt}" + println plan + def getRuntimeFilters = { plantree -> + { + def lst = [] + plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { + ch -> + { + lst.add(ch.replaceAll("#\\d+", '')) + } + } + return lst.join(',') + } + } + + //def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.22" + //File file = new File(outFile) + //file.write(getRuntimeFilters(plan)) + + assertEquals("RF1[d_date_sk->[inv_date_sk],RF0[i_item_sk->[inv_item_sk]", getRuntimeFilters(plan)) +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf23.groovy b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf23.groovy index 2aea6a3f1fdb10..f8ba0d07292ce9 100644 --- a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf23.groovy +++ b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf23.groovy @@ -1,37 +1,37 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -suite("ds_rf23") { - String db = context.config.getDbNameByFile(new File(context.file.parent)) - sql "use ${db}" - sql 'set enable_nereids_planner=true' - sql 'set enable_fallback_to_original_planner=false' - sql 'set exec_mem_limit=21G' - sql 'set be_number_for_test=3' - sql 'set parallel_fragment_exec_instance_num=8; ' - sql 'set parallel_pipeline_task_num=8; ' - sql 'set forbid_unknown_col_stats=true' - sql 'set broadcast_row_count_limit = 30000000' - sql 'set enable_nereids_timeout = false' - sql 'set enable_pipeline_engine=true' - String stmt = ''' - explain physical plan +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +suite("ds_rf23") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_fragment_exec_instance_num=8; ' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set broadcast_row_count_limit = 30000000' + sql 'set enable_nereids_timeout = false' + sql 'set enable_pipeline_engine=true' + String stmt = ''' + explain physical plan with frequent_ss_items as (select substr(i_item_desc,1,30) itemdesc,i_item_sk item_sk,d_date solddate,count(*) cnt from store_sales @@ -81,26 +81,26 @@ from and ws_item_sk in (select item_sk from frequent_ss_items) and ws_bill_customer_sk in (select c_customer_sk from best_ss_customer)) t2 limit 100; - - ''' - String plan = sql "${stmt}" - println plan - def getRuntimeFilters = { plantree -> - { - def lst = [] - plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { - ch -> - { - lst.add(ch.replaceAll("#\\d+", '')) - } - } - return lst.join(',') - } - } - - // def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.23" - // File file = new File(outFile) - // file.write(getRuntimeFilters(plan)) - - assertEquals("RF1[i_item_sk->[ss_item_sk],RF0[d_date_sk->[ss_sold_date_sk],RF4[c_customer_sk->[ss_customer_sk],RF3[c_customer_sk->[ss_customer_sk],RF2[d_date_sk->[ss_sold_date_sk],RF6[c_customer_sk->[cs_bill_customer_sk],RF5[d_date_sk->[cs_sold_date_sk],RF8[c_customer_sk->[ws_bill_customer_sk],RF7[d_date_sk->[ws_sold_date_sk]", getRuntimeFilters(plan)) -} + + ''' + String plan = sql "${stmt}" + println plan + def getRuntimeFilters = { plantree -> + { + def lst = [] + plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { + ch -> + { + lst.add(ch.replaceAll("#\\d+", '')) + } + } + return lst.join(',') + } + } + + //def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.23" + //File file = new File(outFile) + //file.write(getRuntimeFilters(plan)) + + assertEquals("RF3[i_item_sk->[ss_item_sk],RF2[d_date_sk->[ss_sold_date_sk],RF1[c_customer_sk->[cs_bill_customer_sk],RF0[d_date_sk->[cs_sold_date_sk],RF5[c_customer_sk->[ws_bill_customer_sk],RF4[d_date_sk->[ws_sold_date_sk]", getRuntimeFilters(plan)) +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf24.groovy b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf24.groovy index 1a47f501fa6c83..218cbebe695ad2 100644 --- a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf24.groovy +++ b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf24.groovy @@ -1,37 +1,37 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -suite("ds_rf24") { - String db = context.config.getDbNameByFile(new File(context.file.parent)) - sql "use ${db}" - sql 'set enable_nereids_planner=true' - sql 'set enable_fallback_to_original_planner=false' - sql 'set exec_mem_limit=21G' - sql 'set be_number_for_test=3' - sql 'set parallel_fragment_exec_instance_num=8; ' - sql 'set parallel_pipeline_task_num=8; ' - sql 'set forbid_unknown_col_stats=true' - sql 'set broadcast_row_count_limit = 30000000' - sql 'set enable_nereids_timeout = false' - sql 'set enable_pipeline_engine=true' - String stmt = ''' - explain physical plan +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +suite("ds_rf24") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_fragment_exec_instance_num=8; ' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set broadcast_row_count_limit = 30000000' + sql 'set enable_nereids_timeout = false' + sql 'set enable_pipeline_engine=true' + String stmt = ''' + explain physical plan with ssales as (select c_last_name ,c_first_name @@ -84,26 +84,26 @@ order by c_last_name ,c_first_name ,s_store_name ; - - ''' - String plan = sql "${stmt}" - println plan - def getRuntimeFilters = { plantree -> - { - def lst = [] - plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { - ch -> - { - lst.add(ch.replaceAll("#\\d+", '')) - } - } - return lst.join(',') - } - } - - // def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.24" - // File file = new File(outFile) - // file.write(getRuntimeFilters(plan)) - - assertEquals("RF5[sr_item_sk->[ss_item_sk],RF6[sr_ticket_number->[ss_ticket_number],RF4[i_item_sk->[ss_item_sk],RF2[ca_zip->[s_zip],RF3[ca_address_sk->[c_current_addr_sk],RF1[c_customer_sk->[ss_customer_sk],RF0[s_store_sk->[ss_store_sk]", getRuntimeFilters(plan)) -} + + ''' + String plan = sql "${stmt}" + println plan + def getRuntimeFilters = { plantree -> + { + def lst = [] + plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { + ch -> + { + lst.add(ch.replaceAll("#\\d+", '')) + } + } + return lst.join(',') + } + } + + //def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.24" + //File file = new File(outFile) + //file.write(getRuntimeFilters(plan)) + + assertEquals("", getRuntimeFilters(plan)) +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf25.groovy b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf25.groovy index 4e03464a6a8067..4d63768001f249 100644 --- a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf25.groovy +++ b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf25.groovy @@ -1,101 +1,102 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -suite("ds_rf25") { - String db = context.config.getDbNameByFile(new File(context.file.parent)) - sql "use ${db}" - sql 'set enable_nereids_planner=true' - sql 'set enable_fallback_to_original_planner=false' - sql 'set exec_mem_limit=21G' - sql 'set be_number_for_test=3' - sql 'set parallel_fragment_exec_instance_num=8; ' - sql 'set parallel_pipeline_task_num=8; ' - sql 'set forbid_unknown_col_stats=true' - sql 'set broadcast_row_count_limit = 30000000' - sql 'set enable_nereids_timeout = false' - sql 'set enable_pipeline_engine=true' - String stmt = ''' - explain physical plan - select - i_item_id - ,i_item_desc - ,s_store_id - ,s_store_name - ,sum(ss_net_profit) as store_sales_profit - ,sum(sr_net_loss) as store_returns_loss - ,sum(cs_net_profit) as catalog_sales_profit - from - store_sales - ,store_returns - ,catalog_sales - ,date_dim d1 - ,date_dim d2 - ,date_dim d3 - ,store - ,item - where - d1.d_moy = 4 - and d1.d_year = 2000 - and d1.d_date_sk = ss_sold_date_sk - and i_item_sk = ss_item_sk - and s_store_sk = ss_store_sk - and ss_customer_sk = sr_customer_sk - and ss_item_sk = sr_item_sk - and ss_ticket_number = sr_ticket_number - and sr_returned_date_sk = d2.d_date_sk - and d2.d_moy between 4 and 10 - and d2.d_year = 2000 - and sr_customer_sk = cs_bill_customer_sk - and sr_item_sk = cs_item_sk - and cs_sold_date_sk = d3.d_date_sk - and d3.d_moy between 4 and 10 - and d3.d_year = 2000 - group by - i_item_id - ,i_item_desc - ,s_store_id - ,s_store_name - order by - i_item_id - ,i_item_desc - ,s_store_id - ,s_store_name - limit 100; - - ''' - String plan = sql "${stmt}" - println plan - def getRuntimeFilters = { plantree -> - { - def lst = [] - plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { - ch -> - { - lst.add(ch.replaceAll("#\\d+", '')) - } - } - return lst.join(',') - } - } - - // def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.25" - // File file = new File(outFile) - // file.write(getRuntimeFilters(plan)) - assertEquals("RF9[d_date_sk->[cs_sold_date_sk],RF7[sr_customer_sk->[cs_bill_customer_sk],RF8[sr_item_sk->[cs_item_sk],RF6[s_store_sk->[ss_store_sk],RF5[i_item_sk->[ss_item_sk],RF4[d_date_sk->[sr_returned_date_sk],RF1[ss_customer_sk->[sr_customer_sk],RF2[ss_item_sk->[sr_item_sk],RF3[ss_ticket_number->[sr_ticket_number],RF0[d_date_sk->[ss_sold_date_sk]", getRuntimeFilters(plan)) -} +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +suite("ds_rf25") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_fragment_exec_instance_num=8; ' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set broadcast_row_count_limit = 30000000' + sql 'set enable_nereids_timeout = false' + sql 'set enable_pipeline_engine=true' + String stmt = ''' + explain physical plan + select + i_item_id + ,i_item_desc + ,s_store_id + ,s_store_name + ,sum(ss_net_profit) as store_sales_profit + ,sum(sr_net_loss) as store_returns_loss + ,sum(cs_net_profit) as catalog_sales_profit + from + store_sales + ,store_returns + ,catalog_sales + ,date_dim d1 + ,date_dim d2 + ,date_dim d3 + ,store + ,item + where + d1.d_moy = 4 + and d1.d_year = 2000 + and d1.d_date_sk = ss_sold_date_sk + and i_item_sk = ss_item_sk + and s_store_sk = ss_store_sk + and ss_customer_sk = sr_customer_sk + and ss_item_sk = sr_item_sk + and ss_ticket_number = sr_ticket_number + and sr_returned_date_sk = d2.d_date_sk + and d2.d_moy between 4 and 10 + and d2.d_year = 2000 + and sr_customer_sk = cs_bill_customer_sk + and sr_item_sk = cs_item_sk + and cs_sold_date_sk = d3.d_date_sk + and d3.d_moy between 4 and 10 + and d3.d_year = 2000 + group by + i_item_id + ,i_item_desc + ,s_store_id + ,s_store_name + order by + i_item_id + ,i_item_desc + ,s_store_id + ,s_store_name + limit 100; + + ''' + String plan = sql "${stmt}" + println plan + def getRuntimeFilters = { plantree -> + { + def lst = [] + plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { + ch -> + { + lst.add(ch.replaceAll("#\\d+", '')) + } + } + return lst.join(',') + } + } + + //def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.25" + //File file = new File(outFile) + //file.write(getRuntimeFilters(plan)) + + assertEquals("RF9[d_date_sk->[cs_sold_date_sk],RF7[sr_customer_sk->[cs_bill_customer_sk],RF8[sr_item_sk->[cs_item_sk],RF6[s_store_sk->[ss_store_sk],RF5[i_item_sk->[ss_item_sk],RF4[d_date_sk->[sr_returned_date_sk],RF1[ss_customer_sk->[sr_customer_sk],RF2[ss_item_sk->[sr_item_sk],RF3[ss_ticket_number->[sr_ticket_number],RF0[d_date_sk->[ss_sold_date_sk]", getRuntimeFilters(plan)) +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf26.groovy b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf26.groovy index 449a2f1f813651..3a4b1a2582971e 100644 --- a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf26.groovy +++ b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf26.groovy @@ -1,37 +1,37 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -suite("ds_rf26") { - String db = context.config.getDbNameByFile(new File(context.file.parent)) - sql "use ${db}" - sql 'set enable_nereids_planner=true' - sql 'set enable_fallback_to_original_planner=false' - sql 'set exec_mem_limit=21G' - sql 'set be_number_for_test=3' - sql 'set parallel_fragment_exec_instance_num=8; ' - sql 'set parallel_pipeline_task_num=8; ' - sql 'set forbid_unknown_col_stats=true' - sql 'set broadcast_row_count_limit = 30000000' - sql 'set enable_nereids_timeout = false' - sql 'set enable_pipeline_engine=true' - String stmt = ''' - explain physical plan +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +suite("ds_rf26") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_fragment_exec_instance_num=8; ' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set broadcast_row_count_limit = 30000000' + sql 'set enable_nereids_timeout = false' + sql 'set enable_pipeline_engine=true' + String stmt = ''' + explain physical plan select i_item_id, avg(cs_quantity) agg1, avg(cs_list_price) agg2, @@ -50,26 +50,26 @@ suite("ds_rf26") { group by i_item_id order by i_item_id limit 100; - - ''' - String plan = sql "${stmt}" - println plan - def getRuntimeFilters = { plantree -> - { - def lst = [] - plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { - ch -> - { - lst.add(ch.replaceAll("#\\d+", '')) - } - } - return lst.join(',') - } - } - - // def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.26" - // File file = new File(outFile) - // file.write(getRuntimeFilters(plan)) - - assertEquals("RF3[i_item_sk->[cs_item_sk],RF2[p_promo_sk->[cs_promo_sk],RF1[d_date_sk->[cs_sold_date_sk],RF0[cd_demo_sk->[cs_bill_cdemo_sk]", getRuntimeFilters(plan)) -} + + ''' + String plan = sql "${stmt}" + println plan + def getRuntimeFilters = { plantree -> + { + def lst = [] + plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { + ch -> + { + lst.add(ch.replaceAll("#\\d+", '')) + } + } + return lst.join(',') + } + } + + //def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.26" + //File file = new File(outFile) + //file.write(getRuntimeFilters(plan)) + + assertEquals("RF3[i_item_sk->[cs_item_sk],RF2[p_promo_sk->[cs_promo_sk],RF1[d_date_sk->[cs_sold_date_sk],RF0[cd_demo_sk->[cs_bill_cdemo_sk]", getRuntimeFilters(plan)) +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf27.groovy b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf27.groovy index 82d8e6901a2173..7fb655e8cb61ff 100644 --- a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf27.groovy +++ b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf27.groovy @@ -1,37 +1,37 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -suite("ds_rf27") { - String db = context.config.getDbNameByFile(new File(context.file.parent)) - sql "use ${db}" - sql 'set enable_nereids_planner=true' - sql 'set enable_fallback_to_original_planner=false' - sql 'set exec_mem_limit=21G' - sql 'set be_number_for_test=3' - sql 'set parallel_fragment_exec_instance_num=8; ' - sql 'set parallel_pipeline_task_num=8; ' - sql 'set forbid_unknown_col_stats=true' - sql 'set broadcast_row_count_limit = 30000000' - sql 'set enable_nereids_timeout = false' - sql 'set enable_pipeline_engine=true' - String stmt = ''' - explain physical plan +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +suite("ds_rf27") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_fragment_exec_instance_num=8; ' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set broadcast_row_count_limit = 30000000' + sql 'set enable_nereids_timeout = false' + sql 'set enable_pipeline_engine=true' + String stmt = ''' + explain physical plan select i_item_id, s_state, grouping(s_state) g_state, avg(ss_quantity) agg1, @@ -52,26 +52,26 @@ suite("ds_rf27") { order by i_item_id ,s_state limit 100; - - ''' - String plan = sql "${stmt}" - println plan - def getRuntimeFilters = { plantree -> - { - def lst = [] - plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { - ch -> - { - lst.add(ch.replaceAll("#\\d+", '')) - } - } - return lst.join(',') - } - } - - // def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.27" - // File file = new File(outFile) - // file.write(getRuntimeFilters(plan)) - - assertEquals("RF3[s_store_sk->[ss_store_sk],RF2[i_item_sk->[ss_item_sk],RF1[d_date_sk->[ss_sold_date_sk],RF0[cd_demo_sk->[ss_cdemo_sk]", getRuntimeFilters(plan)) -} + + ''' + String plan = sql "${stmt}" + println plan + def getRuntimeFilters = { plantree -> + { + def lst = [] + plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { + ch -> + { + lst.add(ch.replaceAll("#\\d+", '')) + } + } + return lst.join(',') + } + } + + //def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.27" + //File file = new File(outFile) + //file.write(getRuntimeFilters(plan)) + + assertEquals("RF3[s_store_sk->[ss_store_sk],RF2[i_item_sk->[ss_item_sk],RF1[d_date_sk->[ss_sold_date_sk],RF0[cd_demo_sk->[ss_cdemo_sk]", getRuntimeFilters(plan)) +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf28.groovy b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf28.groovy index b3054df262ab9b..2a87bae8fe9fe2 100644 --- a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf28.groovy +++ b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf28.groovy @@ -1,37 +1,37 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -suite("ds_rf28") { - String db = context.config.getDbNameByFile(new File(context.file.parent)) - sql "use ${db}" - sql 'set enable_nereids_planner=true' - sql 'set enable_fallback_to_original_planner=false' - sql 'set exec_mem_limit=21G' - sql 'set be_number_for_test=3' - sql 'set parallel_fragment_exec_instance_num=8; ' - sql 'set parallel_pipeline_task_num=8; ' - sql 'set forbid_unknown_col_stats=true' - sql 'set broadcast_row_count_limit = 30000000' - sql 'set enable_nereids_timeout = false' - sql 'set enable_pipeline_engine=true' - String stmt = ''' - explain physical plan +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +suite("ds_rf28") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_fragment_exec_instance_num=8; ' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set broadcast_row_count_limit = 30000000' + sql 'set enable_nereids_timeout = false' + sql 'set enable_pipeline_engine=true' + String stmt = ''' + explain physical plan select * from (select avg(ss_list_price) B1_LP ,count(ss_list_price) B1_CNT @@ -82,26 +82,26 @@ from (select avg(ss_list_price) B1_LP or ss_coupon_amt between 15257 and 15257+1000 or ss_wholesale_cost between 31 and 31+20)) B6 limit 100; - - ''' - String plan = sql "${stmt}" - println plan - def getRuntimeFilters = { plantree -> - { - def lst = [] - plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { - ch -> - { - lst.add(ch.replaceAll("#\\d+", '')) - } - } - return lst.join(',') - } - } - - // def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.28" - // File file = new File(outFile) - // file.write(getRuntimeFilters(plan)) - - assertEquals("", getRuntimeFilters(plan)) -} + + ''' + String plan = sql "${stmt}" + println plan + def getRuntimeFilters = { plantree -> + { + def lst = [] + plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { + ch -> + { + lst.add(ch.replaceAll("#\\d+", '')) + } + } + return lst.join(',') + } + } + + //def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.28" + //File file = new File(outFile) + //file.write(getRuntimeFilters(plan)) + + assertEquals("", getRuntimeFilters(plan)) +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf29.groovy b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf29.groovy index f8953c09d5d6f1..9a17736ea1b34c 100644 --- a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf29.groovy +++ b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf29.groovy @@ -1,100 +1,101 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -suite("ds_rf29") { - String db = context.config.getDbNameByFile(new File(context.file.parent)) - sql "use ${db}" - sql 'set enable_nereids_planner=true' - sql 'set enable_fallback_to_original_planner=false' - sql 'set exec_mem_limit=21G' - sql 'set be_number_for_test=3' - sql 'set parallel_fragment_exec_instance_num=8; ' - sql 'set parallel_pipeline_task_num=8; ' - sql 'set forbid_unknown_col_stats=true' - sql 'set broadcast_row_count_limit = 30000000' - sql 'set enable_nereids_timeout = false' - sql 'set enable_pipeline_engine=true' - String stmt = ''' - explain physical plan - select - i_item_id - ,i_item_desc - ,s_store_id - ,s_store_name - ,avg(ss_quantity) as store_sales_quantity - ,avg(sr_return_quantity) as store_returns_quantity - ,avg(cs_quantity) as catalog_sales_quantity - from - store_sales - ,store_returns - ,catalog_sales - ,date_dim d1 - ,date_dim d2 - ,date_dim d3 - ,store - ,item - where - d1.d_moy = 4 - and d1.d_year = 1999 - and d1.d_date_sk = ss_sold_date_sk - and i_item_sk = ss_item_sk - and s_store_sk = ss_store_sk - and ss_customer_sk = sr_customer_sk - and ss_item_sk = sr_item_sk - and ss_ticket_number = sr_ticket_number - and sr_returned_date_sk = d2.d_date_sk - and d2.d_moy between 4 and 4 + 3 - and d2.d_year = 1999 - and sr_customer_sk = cs_bill_customer_sk - and sr_item_sk = cs_item_sk - and cs_sold_date_sk = d3.d_date_sk - and d3.d_year in (1999,1999+1,1999+2) - group by - i_item_id - ,i_item_desc - ,s_store_id - ,s_store_name - order by - i_item_id - ,i_item_desc - ,s_store_id - ,s_store_name - limit 100; - - ''' - String plan = sql "${stmt}" - println plan - def getRuntimeFilters = { plantree -> - { - def lst = [] - plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { - ch -> - { - lst.add(ch.replaceAll("#\\d+", '')) - } - } - return lst.join(',') - } - } - - // def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.29" - // File file = new File(outFile) - // file.write(getRuntimeFilters(plan)) - assertEquals("RF9[d_date_sk->[cs_sold_date_sk],RF7[sr_customer_sk->[cs_bill_customer_sk],RF8[sr_item_sk->[cs_item_sk],RF6[s_store_sk->[ss_store_sk],RF5[i_item_sk->[ss_item_sk],RF4[d_date_sk->[sr_returned_date_sk],RF1[ss_customer_sk->[sr_customer_sk],RF2[ss_item_sk->[sr_item_sk],RF3[ss_ticket_number->[sr_ticket_number],RF0[d_date_sk->[ss_sold_date_sk]", getRuntimeFilters(plan)) -} +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +suite("ds_rf29") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_fragment_exec_instance_num=8; ' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set broadcast_row_count_limit = 30000000' + sql 'set enable_nereids_timeout = false' + sql 'set enable_pipeline_engine=true' + String stmt = ''' + explain physical plan + select + i_item_id + ,i_item_desc + ,s_store_id + ,s_store_name + ,avg(ss_quantity) as store_sales_quantity + ,avg(sr_return_quantity) as store_returns_quantity + ,avg(cs_quantity) as catalog_sales_quantity + from + store_sales + ,store_returns + ,catalog_sales + ,date_dim d1 + ,date_dim d2 + ,date_dim d3 + ,store + ,item + where + d1.d_moy = 4 + and d1.d_year = 1999 + and d1.d_date_sk = ss_sold_date_sk + and i_item_sk = ss_item_sk + and s_store_sk = ss_store_sk + and ss_customer_sk = sr_customer_sk + and ss_item_sk = sr_item_sk + and ss_ticket_number = sr_ticket_number + and sr_returned_date_sk = d2.d_date_sk + and d2.d_moy between 4 and 4 + 3 + and d2.d_year = 1999 + and sr_customer_sk = cs_bill_customer_sk + and sr_item_sk = cs_item_sk + and cs_sold_date_sk = d3.d_date_sk + and d3.d_year in (1999,1999+1,1999+2) + group by + i_item_id + ,i_item_desc + ,s_store_id + ,s_store_name + order by + i_item_id + ,i_item_desc + ,s_store_id + ,s_store_name + limit 100; + + ''' + String plan = sql "${stmt}" + println plan + def getRuntimeFilters = { plantree -> + { + def lst = [] + plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { + ch -> + { + lst.add(ch.replaceAll("#\\d+", '')) + } + } + return lst.join(',') + } + } + + //def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.29" + //File file = new File(outFile) + //file.write(getRuntimeFilters(plan)) + + assertEquals("RF9[ss_store_sk->[s_store_sk],RF8[ss_item_sk->[i_item_sk],RF7[cs_sold_date_sk->[d_date_sk],RF5[sr_customer_sk->[cs_bill_customer_sk],RF6[sr_item_sk->[cs_item_sk],RF4[d_date_sk->[ss_sold_date_sk],RF1[sr_customer_sk->[ss_customer_sk],RF2[sr_item_sk->[ss_item_sk],RF3[sr_ticket_number->[ss_ticket_number],RF0[d_date_sk->[sr_returned_date_sk]", getRuntimeFilters(plan)) +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf3.groovy b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf3.groovy index eea5867025599a..38fcfafe513e8c 100644 --- a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf3.groovy +++ b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf3.groovy @@ -1,37 +1,37 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -suite("ds_rf3") { - String db = context.config.getDbNameByFile(new File(context.file.parent)) - sql "use ${db}" - sql 'set enable_nereids_planner=true' - sql 'set enable_fallback_to_original_planner=false' - sql 'set exec_mem_limit=21G' - sql 'set be_number_for_test=3' - sql 'set parallel_fragment_exec_instance_num=8; ' - sql 'set parallel_pipeline_task_num=8; ' - sql 'set forbid_unknown_col_stats=true' - sql 'set broadcast_row_count_limit = 30000000' - sql 'set enable_nereids_timeout = false' - sql 'set enable_pipeline_engine=true' - String stmt = ''' - explain physical plan +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +suite("ds_rf3") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_fragment_exec_instance_num=8; ' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set broadcast_row_count_limit = 30000000' + sql 'set enable_nereids_timeout = false' + sql 'set enable_pipeline_engine=true' + String stmt = ''' + explain physical plan select dt.d_year ,item.i_brand_id brand_id ,item.i_brand brand @@ -50,26 +50,26 @@ suite("ds_rf3") { ,sum_agg desc ,brand_id limit 100; - - ''' - String plan = sql "${stmt}" - println plan - def getRuntimeFilters = { plantree -> - { - def lst = [] - plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { - ch -> - { - lst.add(ch.replaceAll("#\\d+", '')) - } - } - return lst.join(',') - } - } - - // def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.3" - // File file = new File(outFile) - // file.write(getRuntimeFilters(plan)) - - assertEquals("RF1[d_date_sk->[ss_sold_date_sk],RF0[i_item_sk->[ss_item_sk]", getRuntimeFilters(plan)) -} + + ''' + String plan = sql "${stmt}" + println plan + def getRuntimeFilters = { plantree -> + { + def lst = [] + plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { + ch -> + { + lst.add(ch.replaceAll("#\\d+", '')) + } + } + return lst.join(',') + } + } + + //def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.3" + //File file = new File(outFile) + //file.write(getRuntimeFilters(plan)) + + assertEquals("RF1[d_date_sk->[ss_sold_date_sk],RF0[i_item_sk->[ss_item_sk]", getRuntimeFilters(plan)) +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf30.groovy b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf30.groovy index a05a90cdb2c9a9..557e30a1fd7ba7 100644 --- a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf30.groovy +++ b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf30.groovy @@ -1,37 +1,37 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -suite("ds_rf30") { - String db = context.config.getDbNameByFile(new File(context.file.parent)) - sql "use ${db}" - sql 'set enable_nereids_planner=true' - sql 'set enable_fallback_to_original_planner=false' - sql 'set exec_mem_limit=21G' - sql 'set be_number_for_test=3' - sql 'set parallel_fragment_exec_instance_num=8; ' - sql 'set parallel_pipeline_task_num=8; ' - sql 'set forbid_unknown_col_stats=true' - sql 'set broadcast_row_count_limit = 30000000' - sql 'set enable_nereids_timeout = false' - sql 'set enable_pipeline_engine=true' - String stmt = ''' - explain physical plan +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +suite("ds_rf30") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_fragment_exec_instance_num=8; ' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set broadcast_row_count_limit = 30000000' + sql 'set enable_nereids_timeout = false' + sql 'set enable_pipeline_engine=true' + String stmt = ''' + explain physical plan with customer_total_return as (select wr_returning_customer_sk as ctr_customer_sk ,ca_state as ctr_state, @@ -60,26 +60,26 @@ suite("ds_rf30") { ,c_birth_day,c_birth_month,c_birth_year,c_birth_country,c_login,c_email_address ,c_last_review_date_sk,ctr_total_return limit 100; - - ''' - String plan = sql "${stmt}" - println plan - def getRuntimeFilters = { plantree -> - { - def lst = [] - plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { - ch -> - { - lst.add(ch.replaceAll("#\\d+", '')) - } - } - return lst.join(',') - } - } - - // def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.30" - // File file = new File(outFile) - // file.write(getRuntimeFilters(plan)) - - assertEquals("RF1[ca_address_sk->[wr_returning_addr_sk],RF0[d_date_sk->[wr_returned_date_sk],RF3[c_customer_sk->[ctr_customer_sk],RF2[ca_address_sk->[c_current_addr_sk]", getRuntimeFilters(plan)) -} + + ''' + String plan = sql "${stmt}" + println plan + def getRuntimeFilters = { plantree -> + { + def lst = [] + plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { + ch -> + { + lst.add(ch.replaceAll("#\\d+", '')) + } + } + return lst.join(',') + } + } + + //def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.30" + //File file = new File(outFile) + //file.write(getRuntimeFilters(plan)) + + assertEquals("RF2[ca_address_sk->[wr_returning_addr_sk],RF1[d_date_sk->[wr_returned_date_sk],RF0[ca_address_sk->[c_current_addr_sk]", getRuntimeFilters(plan)) +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf31.groovy b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf31.groovy index de42ac0c39e65f..d38ae514ed9e7a 100644 --- a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf31.groovy +++ b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf31.groovy @@ -1,37 +1,37 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -suite("ds_rf31") { - String db = context.config.getDbNameByFile(new File(context.file.parent)) - sql "use ${db}" - sql 'set enable_nereids_planner=true' - sql 'set enable_fallback_to_original_planner=false' - sql 'set exec_mem_limit=21G' - sql 'set be_number_for_test=3' - sql 'set parallel_fragment_exec_instance_num=8; ' - sql 'set parallel_pipeline_task_num=8; ' - sql 'set forbid_unknown_col_stats=true' - sql 'set broadcast_row_count_limit = 30000000' - sql 'set enable_nereids_timeout = false' - sql 'set enable_pipeline_engine=true' - String stmt = ''' - explain physical plan +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +suite("ds_rf31") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_fragment_exec_instance_num=8; ' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set broadcast_row_count_limit = 30000000' + sql 'set enable_nereids_timeout = false' + sql 'set enable_pipeline_engine=true' + String stmt = ''' + explain physical plan with ss as (select ca_county,d_qoy, d_year,sum(ss_ext_sales_price) as store_sales from store_sales,date_dim,customer_address @@ -81,26 +81,26 @@ suite("ds_rf31") { and case when ws2.web_sales > 0 then ws3.web_sales/ws2.web_sales else null end > case when ss2.store_sales > 0 then ss3.store_sales/ss2.store_sales else null end order by web_q1_q2_increase; - - ''' - String plan = sql "${stmt}" - println plan - def getRuntimeFilters = { plantree -> - { - def lst = [] - plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { - ch -> - { - lst.add(ch.replaceAll("#\\d+", '')) - } - } - return lst.join(',') - } - } - - // def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.31" - // File file = new File(outFile) - // file.write(getRuntimeFilters(plan)) - - assertEquals("RF1[ca_address_sk->[ss_addr_sk],RF0[d_date_sk->[ss_sold_date_sk],RF3[ca_address_sk->[ws_bill_addr_sk],RF2[d_date_sk->[ws_sold_date_sk]", getRuntimeFilters(plan)) -} + + ''' + String plan = sql "${stmt}" + println plan + def getRuntimeFilters = { plantree -> + { + def lst = [] + plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { + ch -> + { + lst.add(ch.replaceAll("#\\d+", '')) + } + } + return lst.join(',') + } + } + + //def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.31" + //File file = new File(outFile) + //file.write(getRuntimeFilters(plan)) + + assertEquals("RF1[ca_address_sk->[ss_addr_sk],RF0[d_date_sk->[ss_sold_date_sk],RF3[ca_address_sk->[ws_bill_addr_sk],RF2[d_date_sk->[ws_sold_date_sk]", getRuntimeFilters(plan)) +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf32.groovy b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf32.groovy index e8aa475c1ba01c..8714f4bb227625 100644 --- a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf32.groovy +++ b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf32.groovy @@ -1,37 +1,37 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -suite("ds_rf32") { - String db = context.config.getDbNameByFile(new File(context.file.parent)) - sql "use ${db}" - sql 'set enable_nereids_planner=true' - sql 'set enable_fallback_to_original_planner=false' - sql 'set exec_mem_limit=21G' - sql 'set be_number_for_test=3' - sql 'set parallel_fragment_exec_instance_num=8; ' - sql 'set parallel_pipeline_task_num=8; ' - sql 'set forbid_unknown_col_stats=true' - sql 'set broadcast_row_count_limit = 30000000' - sql 'set enable_nereids_timeout = false' - sql 'set enable_pipeline_engine=true' - String stmt = ''' - explain physical plan +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +suite("ds_rf32") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_fragment_exec_instance_num=8; ' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set broadcast_row_count_limit = 30000000' + sql 'set enable_nereids_timeout = false' + sql 'set enable_pipeline_engine=true' + String stmt = ''' + explain physical plan select sum(cs_ext_discount_amt) as "excess discount amount" from catalog_sales @@ -57,26 +57,26 @@ and cs_ext_discount_amt and d_date_sk = cs_sold_date_sk ) limit 100; - - ''' - String plan = sql "${stmt}" - println plan - def getRuntimeFilters = { plantree -> - { - def lst = [] - plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { - ch -> - { - lst.add(ch.replaceAll("#\\d+", '')) - } - } - return lst.join(',') - } - } - - // def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.32" - // File file = new File(outFile) - // file.write(getRuntimeFilters(plan)) - - assertEquals("RF1[d_date_sk->[cs_sold_date_sk],RF0[i_item_sk->[cs_item_sk]", getRuntimeFilters(plan)) -} + + ''' + String plan = sql "${stmt}" + println plan + def getRuntimeFilters = { plantree -> + { + def lst = [] + plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { + ch -> + { + lst.add(ch.replaceAll("#\\d+", '')) + } + } + return lst.join(',') + } + } + + //def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.32" + //File file = new File(outFile) + //file.write(getRuntimeFilters(plan)) + + assertEquals("RF1[d_date_sk->[cs_sold_date_sk],RF0[i_item_sk->[cs_item_sk]", getRuntimeFilters(plan)) +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf33.groovy b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf33.groovy index c9c44210696677..942a49f4ad7f01 100644 --- a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf33.groovy +++ b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf33.groovy @@ -107,7 +107,7 @@ limit 100; ''' String plan = sql "${stmt}" - log.info(plan) + println plan def getRuntimeFilters = { plantree -> { def lst = [] @@ -121,9 +121,9 @@ limit 100; } } - // def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.33" - // File file = new File(outFile) - // file.write(getRuntimeFilters(plan)) + //def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.33" + //File file = new File(outFile) + //file.write(getRuntimeFilters(plan)) - assertEquals("RF3[i_manufact_id->[i_manufact_id],RF2[i_item_sk->[ss_item_sk],RF1[ca_address_sk->[ss_addr_sk],RF0[d_date_sk->[ss_sold_date_sk],RF7[i_manufact_id->[i_manufact_id],RF6[i_item_sk->[cs_item_sk],RF5[ca_address_sk->[cs_bill_addr_sk],RF4[d_date_sk->[cs_sold_date_sk],RF11[i_manufact_id->[i_manufact_id],RF10[ws_item_sk->[i_item_sk],RF9[ca_address_sk->[ws_bill_addr_sk],RF8[d_date_sk->[ws_sold_date_sk]", getRuntimeFilters(plan)) + assertEquals("RF3[i_manufact_id->[i_manufact_id],RF2[i_item_sk->[ss_item_sk],RF1[ca_address_sk->[ss_addr_sk],RF0[d_date_sk->[ss_sold_date_sk],RF7[i_manufact_id->[i_manufact_id],RF6[i_item_sk->[cs_item_sk],RF5[ca_address_sk->[cs_bill_addr_sk],RF4[d_date_sk->[cs_sold_date_sk],RF11[i_manufact_id->[i_manufact_id],RF10[ws_item_sk->[i_item_sk],RF9[ca_address_sk->[ws_bill_addr_sk],RF8[d_date_sk->[ws_sold_date_sk]", getRuntimeFilters(plan)) } diff --git a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf34.groovy b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf34.groovy index 8dfbf0361536ad..83021b54c067ae 100644 --- a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf34.groovy +++ b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf34.groovy @@ -1,37 +1,37 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -suite("ds_rf34") { - String db = context.config.getDbNameByFile(new File(context.file.parent)) - sql "use ${db}" - sql 'set enable_nereids_planner=true' - sql 'set enable_fallback_to_original_planner=false' - sql 'set exec_mem_limit=21G' - sql 'set be_number_for_test=3' - sql 'set parallel_fragment_exec_instance_num=8; ' - sql 'set parallel_pipeline_task_num=8; ' - sql 'set forbid_unknown_col_stats=true' - sql 'set broadcast_row_count_limit = 30000000' - sql 'set enable_nereids_timeout = false' - sql 'set enable_pipeline_engine=true' - String stmt = ''' - explain physical plan +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +suite("ds_rf34") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_fragment_exec_instance_num=8; ' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set broadcast_row_count_limit = 30000000' + sql 'set enable_nereids_timeout = false' + sql 'set enable_pipeline_engine=true' + String stmt = ''' + explain physical plan select c_last_name ,c_first_name ,c_salutation @@ -60,26 +60,26 @@ suite("ds_rf34") { where ss_customer_sk = c_customer_sk and cnt between 15 and 20 order by c_last_name,c_first_name,c_salutation,c_preferred_cust_flag desc, ss_ticket_number; - - ''' - String plan = sql "${stmt}" - println plan - def getRuntimeFilters = { plantree -> - { - def lst = [] - plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { - ch -> - { - lst.add(ch.replaceAll("#\\d+", '')) - } - } - return lst.join(',') - } - } - - // def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.34" - // File file = new File(outFile) - // file.write(getRuntimeFilters(plan)) - - assertEquals("RF3[ss_customer_sk->[c_customer_sk],RF2[s_store_sk->[ss_store_sk],RF1[hd_demo_sk->[ss_hdemo_sk],RF0[d_date_sk->[ss_sold_date_sk]", getRuntimeFilters(plan)) -} + + ''' + String plan = sql "${stmt}" + println plan + def getRuntimeFilters = { plantree -> + { + def lst = [] + plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { + ch -> + { + lst.add(ch.replaceAll("#\\d+", '')) + } + } + return lst.join(',') + } + } + + //def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.34" + //File file = new File(outFile) + //file.write(getRuntimeFilters(plan)) + + assertEquals("RF3[ss_customer_sk->[c_customer_sk],RF2[s_store_sk->[ss_store_sk],RF1[hd_demo_sk->[ss_hdemo_sk],RF0[d_date_sk->[ss_sold_date_sk]", getRuntimeFilters(plan)) +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf35.groovy b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf35.groovy index 123775ba9018ff..625b69acd09edc 100644 --- a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf35.groovy +++ b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf35.groovy @@ -1,37 +1,37 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -suite("ds_rf35") { - String db = context.config.getDbNameByFile(new File(context.file.parent)) - sql "use ${db}" - sql 'set enable_nereids_planner=true' - sql 'set enable_fallback_to_original_planner=false' - sql 'set exec_mem_limit=21G' - sql 'set be_number_for_test=3' - sql 'set parallel_fragment_exec_instance_num=8; ' - sql 'set parallel_pipeline_task_num=8; ' - sql 'set forbid_unknown_col_stats=true' - sql 'set broadcast_row_count_limit = 30000000' - sql 'set enable_nereids_timeout = false' - sql 'set enable_pipeline_engine=true' - String stmt = ''' - explain physical plan +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +suite("ds_rf35") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_fragment_exec_instance_num=8; ' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set broadcast_row_count_limit = 30000000' + sql 'set enable_nereids_timeout = false' + sql 'set enable_pipeline_engine=true' + String stmt = ''' + explain physical plan select ca_state, cd_gender, @@ -87,26 +87,26 @@ suite("ds_rf35") { cd_dep_employed_count, cd_dep_college_count limit 100; - - ''' - String plan = sql "${stmt}" - println plan - def getRuntimeFilters = { plantree -> - { - def lst = [] - plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { - ch -> - { - lst.add(ch.replaceAll("#\\d+", '')) - } - } - return lst.join(',') - } - } - - // def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.35" - // File file = new File(outFile) - // file.write(getRuntimeFilters(plan)) - - assertEquals("RF5[cd_demo_sk->[c_current_cdemo_sk],RF4[ca_address_sk->[c_current_addr_sk],RF3[c_customer_sk->[ss_customer_sk],RF2[d_date_sk->[ss_sold_date_sk],RF1[d_date_sk->[ws_sold_date_sk],RF0[d_date_sk->[cs_sold_date_sk]", getRuntimeFilters(plan)) -} + + ''' + String plan = sql "${stmt}" + println plan + def getRuntimeFilters = { plantree -> + { + def lst = [] + plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { + ch -> + { + lst.add(ch.replaceAll("#\\d+", '')) + } + } + return lst.join(',') + } + } + + //def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.35" + //File file = new File(outFile) + //file.write(getRuntimeFilters(plan)) + + assertEquals("RF5[cd_demo_sk->[c_current_cdemo_sk],RF4[ca_address_sk->[c_current_addr_sk],RF3[c_customer_sk->[ss_customer_sk],RF2[d_date_sk->[ss_sold_date_sk],RF1[d_date_sk->[ws_sold_date_sk],RF0[d_date_sk->[cs_sold_date_sk]", getRuntimeFilters(plan)) +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf36.groovy b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf36.groovy index d74bcda63851bc..80a969a670d070 100644 --- a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf36.groovy +++ b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf36.groovy @@ -1,37 +1,37 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -suite("ds_rf36") { - String db = context.config.getDbNameByFile(new File(context.file.parent)) - sql "use ${db}" - sql 'set enable_nereids_planner=true' - sql 'set enable_fallback_to_original_planner=false' - sql 'set exec_mem_limit=21G' - sql 'set be_number_for_test=3' - sql 'set parallel_fragment_exec_instance_num=8; ' - sql 'set parallel_pipeline_task_num=8; ' - sql 'set forbid_unknown_col_stats=true' - sql 'set broadcast_row_count_limit = 30000000' - sql 'set enable_nereids_timeout = false' - sql 'set enable_pipeline_engine=true' - String stmt = ''' - explain physical plan +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +suite("ds_rf36") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_fragment_exec_instance_num=8; ' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set broadcast_row_count_limit = 30000000' + sql 'set enable_nereids_timeout = false' + sql 'set enable_pipeline_engine=true' + String stmt = ''' + explain physical plan select sum(ss_net_profit)/sum(ss_ext_sales_price) as gross_margin ,i_category @@ -59,26 +59,26 @@ suite("ds_rf36") { ,case when lochierarchy = 0 then i_category end ,rank_within_parent limit 100; - - ''' - String plan = sql "${stmt}" - println plan - def getRuntimeFilters = { plantree -> - { - def lst = [] - plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { - ch -> - { - lst.add(ch.replaceAll("#\\d+", '')) - } - } - return lst.join(',') - } - } - - // def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.36" - // File file = new File(outFile) - // file.write(getRuntimeFilters(plan)) - - assertEquals("RF2[s_store_sk->[ss_store_sk],RF1[i_item_sk->[ss_item_sk],RF0[d_date_sk->[ss_sold_date_sk]", getRuntimeFilters(plan)) -} + + ''' + String plan = sql "${stmt}" + println plan + def getRuntimeFilters = { plantree -> + { + def lst = [] + plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { + ch -> + { + lst.add(ch.replaceAll("#\\d+", '')) + } + } + return lst.join(',') + } + } + + //def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.36" + //File file = new File(outFile) + //file.write(getRuntimeFilters(plan)) + + assertEquals("RF2[s_store_sk->[ss_store_sk],RF1[i_item_sk->[ss_item_sk],RF0[d_date_sk->[ss_sold_date_sk]", getRuntimeFilters(plan)) +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf37.groovy b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf37.groovy index 1c0b52482b2261..064dd4d6db48f6 100644 --- a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf37.groovy +++ b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf37.groovy @@ -1,37 +1,37 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -suite("ds_rf37") { - String db = context.config.getDbNameByFile(new File(context.file.parent)) - sql "use ${db}" - sql 'set enable_nereids_planner=true' - sql 'set enable_fallback_to_original_planner=false' - sql 'set exec_mem_limit=21G' - sql 'set be_number_for_test=3' - sql 'set parallel_fragment_exec_instance_num=8; ' - sql 'set parallel_pipeline_task_num=8; ' - sql 'set forbid_unknown_col_stats=true' - sql 'set broadcast_row_count_limit = 30000000' - sql 'set enable_nereids_timeout = false' - sql 'set enable_pipeline_engine=true' - String stmt = ''' - explain physical plan +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +suite("ds_rf37") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_fragment_exec_instance_num=8; ' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set broadcast_row_count_limit = 30000000' + sql 'set enable_nereids_timeout = false' + sql 'set enable_pipeline_engine=true' + String stmt = ''' + explain physical plan select i_item_id ,i_item_desc ,i_current_price @@ -46,26 +46,26 @@ suite("ds_rf37") { group by i_item_id,i_item_desc,i_current_price order by i_item_id limit 100; - - ''' - String plan = sql "${stmt}" - println plan - def getRuntimeFilters = { plantree -> - { - def lst = [] - plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { - ch -> - { - lst.add(ch.replaceAll("#\\d+", '')) - } - } - return lst.join(',') - } - } - - // def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.37" - // File file = new File(outFile) - // file.write(getRuntimeFilters(plan)) - - assertEquals("RF2[i_item_sk->[cs_item_sk],RF1[d_date_sk->[inv_date_sk],RF0[i_item_sk->[inv_item_sk]", getRuntimeFilters(plan)) -} + + ''' + String plan = sql "${stmt}" + println plan + def getRuntimeFilters = { plantree -> + { + def lst = [] + plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { + ch -> + { + lst.add(ch.replaceAll("#\\d+", '')) + } + } + return lst.join(',') + } + } + + //def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.37" + //File file = new File(outFile) + //file.write(getRuntimeFilters(plan)) + + assertEquals("RF2[i_item_sk->[cs_item_sk],RF1[d_date_sk->[inv_date_sk],RF0[i_item_sk->[inv_item_sk]", getRuntimeFilters(plan)) +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf38.groovy b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf38.groovy index 595c132d6ca887..bc8e705a236b07 100644 --- a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf38.groovy +++ b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf38.groovy @@ -1,37 +1,37 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -suite("ds_rf38") { - String db = context.config.getDbNameByFile(new File(context.file.parent)) - sql "use ${db}" - sql 'set enable_nereids_planner=true' - sql 'set enable_fallback_to_original_planner=false' - sql 'set exec_mem_limit=21G' - sql 'set be_number_for_test=3' - sql 'set parallel_fragment_exec_instance_num=8; ' - sql 'set parallel_pipeline_task_num=8; ' - sql 'set forbid_unknown_col_stats=true' - sql 'set broadcast_row_count_limit = 30000000' - sql 'set enable_nereids_timeout = false' - sql 'set enable_pipeline_engine=true' - String stmt = ''' - explain physical plan +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +suite("ds_rf38") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_fragment_exec_instance_num=8; ' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set broadcast_row_count_limit = 30000000' + sql 'set enable_nereids_timeout = false' + sql 'set enable_pipeline_engine=true' + String stmt = ''' + explain physical plan select count(*) from ( select distinct c_last_name, c_first_name, d_date from store_sales, date_dim, customer @@ -52,26 +52,26 @@ suite("ds_rf38") { and d_month_seq between 1183 and 1183 + 11 ) hot_cust limit 100; - - ''' - String plan = sql "${stmt}" - println plan - def getRuntimeFilters = { plantree -> - { - def lst = [] - plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { - ch -> - { - lst.add(ch.replaceAll("#\\d+", '')) - } - } - return lst.join(',') - } - } - - // def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.38" - // File file = new File(outFile) - // file.write(getRuntimeFilters(plan)) - - assertEquals("RF1[c_customer_sk->[ss_customer_sk],RF0[d_date_sk->[ss_sold_date_sk],RF3[c_customer_sk->[cs_bill_customer_sk],RF2[d_date_sk->[cs_sold_date_sk],RF5[c_customer_sk->[ws_bill_customer_sk],RF4[d_date_sk->[ws_sold_date_sk]", getRuntimeFilters(plan)) -} + + ''' + String plan = sql "${stmt}" + println plan + def getRuntimeFilters = { plantree -> + { + def lst = [] + plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { + ch -> + { + lst.add(ch.replaceAll("#\\d+", '')) + } + } + return lst.join(',') + } + } + + //def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.38" + //File file = new File(outFile) + //file.write(getRuntimeFilters(plan)) + + assertEquals("RF1[c_customer_sk->[ss_customer_sk],RF0[d_date_sk->[ss_sold_date_sk],RF3[c_customer_sk->[cs_bill_customer_sk],RF2[d_date_sk->[cs_sold_date_sk],RF5[c_customer_sk->[ws_bill_customer_sk],RF4[d_date_sk->[ws_sold_date_sk]", getRuntimeFilters(plan)) +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf39.groovy b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf39.groovy index 2881698527f986..4a11a5e9cc658e 100644 --- a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf39.groovy +++ b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf39.groovy @@ -1,37 +1,37 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -suite("ds_rf39") { - String db = context.config.getDbNameByFile(new File(context.file.parent)) - sql "use ${db}" - sql 'set enable_nereids_planner=true' - sql 'set enable_fallback_to_original_planner=false' - sql 'set exec_mem_limit=21G' - sql 'set be_number_for_test=3' - sql 'set parallel_fragment_exec_instance_num=8; ' - sql 'set parallel_pipeline_task_num=8; ' - sql 'set forbid_unknown_col_stats=true' - sql 'set broadcast_row_count_limit = 30000000' - sql 'set enable_nereids_timeout = false' - sql 'set enable_pipeline_engine=true' - String stmt = ''' - explain physical plan +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +suite("ds_rf39") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_fragment_exec_instance_num=8; ' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set broadcast_row_count_limit = 30000000' + sql 'set enable_nereids_timeout = false' + sql 'set enable_pipeline_engine=true' + String stmt = ''' + explain physical plan with inv as (select w_warehouse_name,w_warehouse_sk,i_item_sk,d_moy ,stdev,mean, case mean when 0 then null else stdev/mean end cov @@ -56,26 +56,26 @@ where inv1.i_item_sk = inv2.i_item_sk and inv2.d_moy=1+1 order by inv1.w_warehouse_sk,inv1.i_item_sk,inv1.d_moy,inv1.mean,inv1.cov ,inv2.d_moy,inv2.mean, inv2.cov; - - ''' - String plan = sql "${stmt}" - println plan - def getRuntimeFilters = { plantree -> - { - def lst = [] - plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { - ch -> - { - lst.add(ch.replaceAll("#\\d+", '')) - } - } - return lst.join(',') - } - } - - // def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.39" - // File file = new File(outFile) - // file.write(getRuntimeFilters(plan)) - - assertEquals("RF2[w_warehouse_sk->[inv_warehouse_sk],RF1[i_item_sk->[inv_item_sk],RF0[d_date_sk->[inv_date_sk]", getRuntimeFilters(plan)) -} + + ''' + String plan = sql "${stmt}" + println plan + def getRuntimeFilters = { plantree -> + { + def lst = [] + plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { + ch -> + { + lst.add(ch.replaceAll("#\\d+", '')) + } + } + return lst.join(',') + } + } + + //def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.39" + //File file = new File(outFile) + //file.write(getRuntimeFilters(plan)) + + assertEquals("RF2[w_warehouse_sk->[inv_warehouse_sk],RF1[i_item_sk->[inv_item_sk],RF0[d_date_sk->[inv_date_sk]", getRuntimeFilters(plan)) +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf4.groovy b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf4.groovy index 8f669956ba6743..1739991c297f4d 100644 --- a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf4.groovy +++ b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf4.groovy @@ -148,7 +148,7 @@ limit 100; ''' String plan = sql "${stmt}" - log.info(plan) + println plan def getRuntimeFilters = { plantree -> { def lst = [] @@ -162,9 +162,9 @@ limit 100; } } - // def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.4" - // File file = new File(outFile) - // file.write(getRuntimeFilters(plan)) + //def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.4" + //File file = new File(outFile) + //file.write(getRuntimeFilters(plan)) - assertEquals("RF1[c_customer_sk->[ss_customer_sk],RF0[d_date_sk->[ss_sold_date_sk],RF3[c_customer_sk->[cs_bill_customer_sk],RF2[d_date_sk->[cs_sold_date_sk],RF5[c_customer_sk->[ws_bill_customer_sk],RF4[d_date_sk->[ws_sold_date_sk]", getRuntimeFilters(plan)) + assertEquals("RF1[c_customer_sk->[ss_customer_sk],RF0[d_date_sk->[ss_sold_date_sk],RF3[c_customer_sk->[cs_bill_customer_sk],RF2[d_date_sk->[cs_sold_date_sk],RF5[c_customer_sk->[ws_bill_customer_sk],RF4[d_date_sk->[ws_sold_date_sk]", getRuntimeFilters(plan)) } diff --git a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf40.groovy b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf40.groovy index 4fbd4124cce0ab..88e7bdedcfc6b2 100644 --- a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf40.groovy +++ b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf40.groovy @@ -1,81 +1,82 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -suite("ds_rf40") { - String db = context.config.getDbNameByFile(new File(context.file.parent)) - sql "use ${db}" - sql 'set enable_nereids_planner=true' - sql 'set enable_fallback_to_original_planner=false' - sql 'set exec_mem_limit=21G' - sql 'set be_number_for_test=3' - sql 'set parallel_fragment_exec_instance_num=8; ' - sql 'set parallel_pipeline_task_num=8; ' - sql 'set forbid_unknown_col_stats=true' - sql 'set broadcast_row_count_limit = 30000000' - sql 'set enable_nereids_timeout = false' - sql 'set enable_pipeline_engine=true' - String stmt = ''' - explain physical plan - select - w_state - ,i_item_id - ,sum(case when (cast(d_date as date) < cast ('2001-04-02' as date)) - then cs_sales_price - coalesce(cr_refunded_cash,0) else 0 end) as sales_before - ,sum(case when (cast(d_date as date) >= cast ('2001-04-02' as date)) - then cs_sales_price - coalesce(cr_refunded_cash,0) else 0 end) as sales_after - from - catalog_sales left outer join catalog_returns on - (cs_order_number = cr_order_number - and cs_item_sk = cr_item_sk) - ,warehouse - ,item - ,date_dim - where - i_current_price between 0.99 and 1.49 - and i_item_sk = cs_item_sk - and cs_warehouse_sk = w_warehouse_sk - and cs_sold_date_sk = d_date_sk - and d_date between (cast ('2001-04-02' as date) - interval 30 day) - and (cast ('2001-04-02' as date) + interval 30 day) - group by - w_state,i_item_id - order by w_state,i_item_id -limit 100; - - ''' - String plan = sql "${stmt}" - println plan - def getRuntimeFilters = { plantree -> - { - def lst = [] - plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { - ch -> - { - lst.add(ch.replaceAll("#\\d+", '')) - } - } - return lst.join(',') - } - } - - // def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.40" - // File file = new File(outFile) - // file.write(getRuntimeFilters(plan)) - assertEquals("RF4[w_warehouse_sk->[cs_warehouse_sk],RF2[cs_order_number->[cr_order_number],RF3[cs_item_sk->[cr_item_sk],RF1[d_date_sk->[cs_sold_date_sk],RF0[i_item_sk->[cs_item_sk]", getRuntimeFilters(plan)) -} +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +suite("ds_rf40") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_fragment_exec_instance_num=8; ' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set broadcast_row_count_limit = 30000000' + sql 'set enable_nereids_timeout = false' + sql 'set enable_pipeline_engine=true' + String stmt = ''' + explain physical plan + select + w_state + ,i_item_id + ,sum(case when (cast(d_date as date) < cast ('2001-04-02' as date)) + then cs_sales_price - coalesce(cr_refunded_cash,0) else 0 end) as sales_before + ,sum(case when (cast(d_date as date) >= cast ('2001-04-02' as date)) + then cs_sales_price - coalesce(cr_refunded_cash,0) else 0 end) as sales_after + from + catalog_sales left outer join catalog_returns on + (cs_order_number = cr_order_number + and cs_item_sk = cr_item_sk) + ,warehouse + ,item + ,date_dim + where + i_current_price between 0.99 and 1.49 + and i_item_sk = cs_item_sk + and cs_warehouse_sk = w_warehouse_sk + and cs_sold_date_sk = d_date_sk + and d_date between (cast ('2001-04-02' as date) - interval 30 day) + and (cast ('2001-04-02' as date) + interval 30 day) + group by + w_state,i_item_id + order by w_state,i_item_id +limit 100; + + ''' + String plan = sql "${stmt}" + println plan + def getRuntimeFilters = { plantree -> + { + def lst = [] + plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { + ch -> + { + lst.add(ch.replaceAll("#\\d+", '')) + } + } + return lst.join(',') + } + } + + //def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.40" + //File file = new File(outFile) + //file.write(getRuntimeFilters(plan)) + + assertEquals("RF4[w_warehouse_sk->[cs_warehouse_sk],RF2[cs_order_number->[cr_order_number],RF3[cs_item_sk->[cr_item_sk],RF1[d_date_sk->[cs_sold_date_sk],RF0[i_item_sk->[cs_item_sk]", getRuntimeFilters(plan)) +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf41.groovy b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf41.groovy index 54c0369f0a475d..fc55fb18aa97ad 100644 --- a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf41.groovy +++ b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf41.groovy @@ -1,37 +1,37 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -suite("ds_rf41") { - String db = context.config.getDbNameByFile(new File(context.file.parent)) - sql "use ${db}" - sql 'set enable_nereids_planner=true' - sql 'set enable_fallback_to_original_planner=false' - sql 'set exec_mem_limit=21G' - sql 'set be_number_for_test=3' - sql 'set parallel_fragment_exec_instance_num=8; ' - sql 'set parallel_pipeline_task_num=8; ' - sql 'set forbid_unknown_col_stats=true' - sql 'set broadcast_row_count_limit = 30000000' - sql 'set enable_nereids_timeout = false' - sql 'set enable_pipeline_engine=true' - String stmt = ''' - explain physical plan +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +suite("ds_rf41") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_fragment_exec_instance_num=8; ' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set broadcast_row_count_limit = 30000000' + sql 'set enable_nereids_timeout = false' + sql 'set enable_pipeline_engine=true' + String stmt = ''' + explain physical plan select distinct(i_product_name) from item i1 where i_manufact_id between 748 and 748+40 @@ -81,26 +81,26 @@ suite("ds_rf41") { )))) > 0 order by i_product_name limit 100; - - ''' - String plan = sql "${stmt}" - println plan - def getRuntimeFilters = { plantree -> - { - def lst = [] - plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { - ch -> - { - lst.add(ch.replaceAll("#\\d+", '')) - } - } - return lst.join(',') - } - } - - // def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.41" - // File file = new File(outFile) - // file.write(getRuntimeFilters(plan)) - - assertEquals("RF0[i_manufact->[i_manufact]", getRuntimeFilters(plan)) -} + + ''' + String plan = sql "${stmt}" + println plan + def getRuntimeFilters = { plantree -> + { + def lst = [] + plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { + ch -> + { + lst.add(ch.replaceAll("#\\d+", '')) + } + } + return lst.join(',') + } + } + + //def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.41" + //File file = new File(outFile) + //file.write(getRuntimeFilters(plan)) + + assertEquals("RF0[i_manufact->[i_manufact]", getRuntimeFilters(plan)) +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf42.groovy b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf42.groovy index 0e478423e07955..78e85d7148db77 100644 --- a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf42.groovy +++ b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf42.groovy @@ -1,37 +1,37 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -suite("ds_rf42") { - String db = context.config.getDbNameByFile(new File(context.file.parent)) - sql "use ${db}" - sql 'set enable_nereids_planner=true' - sql 'set enable_fallback_to_original_planner=false' - sql 'set exec_mem_limit=21G' - sql 'set be_number_for_test=3' - sql 'set parallel_fragment_exec_instance_num=8; ' - sql 'set parallel_pipeline_task_num=8; ' - sql 'set forbid_unknown_col_stats=true' - sql 'set broadcast_row_count_limit = 30000000' - sql 'set enable_nereids_timeout = false' - sql 'set enable_pipeline_engine=true' - String stmt = ''' - explain physical plan +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +suite("ds_rf42") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_fragment_exec_instance_num=8; ' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set broadcast_row_count_limit = 30000000' + sql 'set enable_nereids_timeout = false' + sql 'set enable_pipeline_engine=true' + String stmt = ''' + explain physical plan select dt.d_year ,item.i_category_id ,item.i_category @@ -51,26 +51,26 @@ suite("ds_rf42") { ,item.i_category_id ,item.i_category limit 100 ; - - ''' - String plan = sql "${stmt}" - println plan - def getRuntimeFilters = { plantree -> - { - def lst = [] - plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { - ch -> - { - lst.add(ch.replaceAll("#\\d+", '')) - } - } - return lst.join(',') - } - } - - // def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.42" - // File file = new File(outFile) - // file.write(getRuntimeFilters(plan)) - - assertEquals("RF1[d_date_sk->[ss_sold_date_sk],RF0[i_item_sk->[ss_item_sk]", getRuntimeFilters(plan)) -} + + ''' + String plan = sql "${stmt}" + println plan + def getRuntimeFilters = { plantree -> + { + def lst = [] + plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { + ch -> + { + lst.add(ch.replaceAll("#\\d+", '')) + } + } + return lst.join(',') + } + } + + //def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.42" + //File file = new File(outFile) + //file.write(getRuntimeFilters(plan)) + + assertEquals("RF1[d_date_sk->[ss_sold_date_sk],RF0[i_item_sk->[ss_item_sk]", getRuntimeFilters(plan)) +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf43.groovy b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf43.groovy index e7da261b03cd81..af373757661f4d 100644 --- a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf43.groovy +++ b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf43.groovy @@ -1,37 +1,37 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -suite("ds_rf43") { - String db = context.config.getDbNameByFile(new File(context.file.parent)) - sql "use ${db}" - sql 'set enable_nereids_planner=true' - sql 'set enable_fallback_to_original_planner=false' - sql 'set exec_mem_limit=21G' - sql 'set be_number_for_test=3' - sql 'set parallel_fragment_exec_instance_num=8; ' - sql 'set parallel_pipeline_task_num=8; ' - sql 'set forbid_unknown_col_stats=true' - sql 'set broadcast_row_count_limit = 30000000' - sql 'set enable_nereids_timeout = false' - sql 'set enable_pipeline_engine=true' - String stmt = ''' - explain physical plan +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +suite("ds_rf43") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_fragment_exec_instance_num=8; ' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set broadcast_row_count_limit = 30000000' + sql 'set enable_nereids_timeout = false' + sql 'set enable_pipeline_engine=true' + String stmt = ''' + explain physical plan select s_store_name, s_store_id, sum(case when (d_day_name='Sunday') then ss_sales_price else null end) sun_sales, sum(case when (d_day_name='Monday') then ss_sales_price else null end) mon_sales, @@ -48,26 +48,26 @@ suite("ds_rf43") { group by s_store_name, s_store_id order by s_store_name, s_store_id,sun_sales,mon_sales,tue_sales,wed_sales,thu_sales,fri_sales,sat_sales limit 100; - - ''' - String plan = sql "${stmt}" - println plan - def getRuntimeFilters = { plantree -> - { - def lst = [] - plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { - ch -> - { - lst.add(ch.replaceAll("#\\d+", '')) - } - } - return lst.join(',') - } - } - - // def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.43" - // File file = new File(outFile) - // file.write(getRuntimeFilters(plan)) - - assertEquals("RF1[s_store_sk->[ss_store_sk],RF0[d_date_sk->[ss_sold_date_sk]", getRuntimeFilters(plan)) -} + + ''' + String plan = sql "${stmt}" + println plan + def getRuntimeFilters = { plantree -> + { + def lst = [] + plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { + ch -> + { + lst.add(ch.replaceAll("#\\d+", '')) + } + } + return lst.join(',') + } + } + + //def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.43" + //File file = new File(outFile) + //file.write(getRuntimeFilters(plan)) + + assertEquals("RF1[s_store_sk->[ss_store_sk],RF0[d_date_sk->[ss_sold_date_sk]", getRuntimeFilters(plan)) +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf44.groovy b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf44.groovy index f626136021a0d2..784864a8ef30c8 100644 --- a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf44.groovy +++ b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf44.groovy @@ -1,37 +1,37 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -suite("ds_rf44") { - String db = context.config.getDbNameByFile(new File(context.file.parent)) - sql "use ${db}" - sql 'set enable_nereids_planner=true' - sql 'set enable_fallback_to_original_planner=false' - sql 'set exec_mem_limit=21G' - sql 'set be_number_for_test=3' - sql 'set parallel_fragment_exec_instance_num=8; ' - sql 'set parallel_pipeline_task_num=8; ' - sql 'set forbid_unknown_col_stats=true' - sql 'set broadcast_row_count_limit = 30000000' - sql 'set enable_nereids_timeout = false' - sql 'set enable_pipeline_engine=true' - String stmt = ''' - explain physical plan +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +suite("ds_rf44") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_fragment_exec_instance_num=8; ' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set broadcast_row_count_limit = 30000000' + sql 'set enable_nereids_timeout = false' + sql 'set enable_pipeline_engine=true' + String stmt = ''' + explain physical plan select asceding.rnk, i1.i_product_name best_performing, i2.i_product_name worst_performing from(select * from (select item_sk,rank() over (order by rank_col asc) rnk @@ -64,26 +64,26 @@ where asceding.rnk = descending.rnk and i2.i_item_sk=descending.item_sk order by asceding.rnk limit 100; - - ''' - String plan = sql "${stmt}" - println plan - def getRuntimeFilters = { plantree -> - { - def lst = [] - plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { - ch -> - { - lst.add(ch.replaceAll("#\\d+", '')) - } - } - return lst.join(',') - } - } - - // def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.44" - // File file = new File(outFile) - // file.write(getRuntimeFilters(plan)) - - assertEquals("RF1[item_sk->[i_item_sk],RF0[item_sk->[i_item_sk]", getRuntimeFilters(plan)) -} + + ''' + String plan = sql "${stmt}" + println plan + def getRuntimeFilters = { plantree -> + { + def lst = [] + plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { + ch -> + { + lst.add(ch.replaceAll("#\\d+", '')) + } + } + return lst.join(',') + } + } + + //def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.44" + //File file = new File(outFile) + //file.write(getRuntimeFilters(plan)) + + assertEquals("RF1[item_sk->[i_item_sk],RF0[item_sk->[i_item_sk]", getRuntimeFilters(plan)) +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf45.groovy b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf45.groovy index 15d79d0e57a244..637db92961dd20 100644 --- a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf45.groovy +++ b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf45.groovy @@ -1,37 +1,37 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -suite("ds_rf45") { - String db = context.config.getDbNameByFile(new File(context.file.parent)) - sql "use ${db}" - sql 'set enable_nereids_planner=true' - sql 'set enable_fallback_to_original_planner=false' - sql 'set exec_mem_limit=21G' - sql 'set be_number_for_test=3' - sql 'set parallel_fragment_exec_instance_num=8; ' - sql 'set parallel_pipeline_task_num=8; ' - sql 'set forbid_unknown_col_stats=true' - sql 'set broadcast_row_count_limit = 30000000' - sql 'set enable_nereids_timeout = false' - sql 'set enable_pipeline_engine=true' - String stmt = ''' - explain physical plan +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +suite("ds_rf45") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_fragment_exec_instance_num=8; ' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set broadcast_row_count_limit = 30000000' + sql 'set enable_nereids_timeout = false' + sql 'set enable_pipeline_engine=true' + String stmt = ''' + explain physical plan select ca_zip, ca_city, sum(ws_sales_price) from web_sales, customer, customer_address, date_dim, item where ws_bill_customer_sk = c_customer_sk @@ -49,26 +49,26 @@ suite("ds_rf45") { group by ca_zip, ca_city order by ca_zip, ca_city limit 100; - - ''' - String plan = sql "${stmt}" - println plan - def getRuntimeFilters = { plantree -> - { - def lst = [] - plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { - ch -> - { - lst.add(ch.replaceAll("#\\d+", '')) - } - } - return lst.join(',') - } - } - - // def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.45" - // File file = new File(outFile) - // file.write(getRuntimeFilters(plan)) - - assertEquals("RF3[c_customer_sk->[ws_bill_customer_sk],RF2[i_item_sk->[ws_item_sk],RF1[d_date_sk->[ws_sold_date_sk],RF0[ca_address_sk->[c_current_addr_sk]", getRuntimeFilters(plan)) -} + + ''' + String plan = sql "${stmt}" + println plan + def getRuntimeFilters = { plantree -> + { + def lst = [] + plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { + ch -> + { + lst.add(ch.replaceAll("#\\d+", '')) + } + } + return lst.join(',') + } + } + + //def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.45" + //File file = new File(outFile) + //file.write(getRuntimeFilters(plan)) + + assertEquals("RF3[c_customer_sk->[ws_bill_customer_sk],RF2[i_item_sk->[ws_item_sk],RF1[d_date_sk->[ws_sold_date_sk],RF0[ca_address_sk->[c_current_addr_sk]", getRuntimeFilters(plan)) +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf46.groovy b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf46.groovy index 6bc6203536b0d8..183495a979041f 100644 --- a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf46.groovy +++ b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf46.groovy @@ -1,37 +1,37 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -suite("ds_rf46") { - String db = context.config.getDbNameByFile(new File(context.file.parent)) - sql "use ${db}" - sql 'set enable_nereids_planner=true' - sql 'set enable_fallback_to_original_planner=false' - sql 'set exec_mem_limit=21G' - sql 'set be_number_for_test=3' - sql 'set parallel_fragment_exec_instance_num=8; ' - sql 'set parallel_pipeline_task_num=8; ' - sql 'set forbid_unknown_col_stats=true' - sql 'set broadcast_row_count_limit = 30000000' - sql 'set enable_nereids_timeout = false' - sql 'set enable_pipeline_engine=true' - String stmt = ''' - explain physical plan +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +suite("ds_rf46") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_fragment_exec_instance_num=8; ' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set broadcast_row_count_limit = 30000000' + sql 'set enable_nereids_timeout = false' + sql 'set enable_pipeline_engine=true' + String stmt = ''' + explain physical plan select c_last_name ,c_first_name ,ca_city @@ -64,25 +64,26 @@ suite("ds_rf46") { ,bought_city ,ss_ticket_number limit 100; - - ''' - String plan = sql "${stmt}" - println plan - def getRuntimeFilters = { plantree -> - { - def lst = [] - plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { - ch -> - { - lst.add(ch.replaceAll("#\\d+", '')) - } - } - return lst.join(',') - } - } - - // def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.46" - // File file = new File(outFile) - // file.write(getRuntimeFilters(plan)) - assertEquals("RF5[c_customer_sk->[ss_customer_sk],RF4[ca_address_sk->[ss_addr_sk],RF3[s_store_sk->[ss_store_sk],RF2[hd_demo_sk->[ss_hdemo_sk],RF1[d_date_sk->[ss_sold_date_sk],RF0[ca_address_sk->[c_current_addr_sk]", getRuntimeFilters(plan)) -} + + ''' + String plan = sql "${stmt}" + println plan + def getRuntimeFilters = { plantree -> + { + def lst = [] + plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { + ch -> + { + lst.add(ch.replaceAll("#\\d+", '')) + } + } + return lst.join(',') + } + } + + //def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.46" + //File file = new File(outFile) + //file.write(getRuntimeFilters(plan)) + + assertEquals("RF5[c_customer_sk->[ss_customer_sk],RF4[ca_address_sk->[ss_addr_sk],RF3[s_store_sk->[ss_store_sk],RF2[hd_demo_sk->[ss_hdemo_sk],RF1[d_date_sk->[ss_sold_date_sk],RF0[ca_address_sk->[c_current_addr_sk]", getRuntimeFilters(plan)) +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf47.groovy b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf47.groovy index 769227e276e6db..ea7b99513b6f50 100644 --- a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf47.groovy +++ b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf47.groovy @@ -1,37 +1,37 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -suite("ds_rf47") { - String db = context.config.getDbNameByFile(new File(context.file.parent)) - sql "use ${db}" - sql 'set enable_nereids_planner=true' - sql 'set enable_fallback_to_original_planner=false' - sql 'set exec_mem_limit=21G' - sql 'set be_number_for_test=3' - sql 'set parallel_fragment_exec_instance_num=8; ' - sql 'set parallel_pipeline_task_num=8; ' - sql 'set forbid_unknown_col_stats=true' - sql 'set broadcast_row_count_limit = 30000000' - sql 'set enable_nereids_timeout = false' - sql 'set enable_pipeline_engine=true' - String stmt = ''' - explain physical plan +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +suite("ds_rf47") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_fragment_exec_instance_num=8; ' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set broadcast_row_count_limit = 30000000' + sql 'set enable_nereids_timeout = false' + sql 'set enable_pipeline_engine=true' + String stmt = ''' + explain physical plan with v1 as( select i_category, i_brand, s_store_name, s_company_name, @@ -80,26 +80,26 @@ suite("ds_rf47") { case when avg_monthly_sales > 0 then abs(sum_sales - avg_monthly_sales) / avg_monthly_sales else null end > 0.1 order by sum_sales - avg_monthly_sales, nsum limit 100; - - ''' - String plan = sql "${stmt}" - println plan - def getRuntimeFilters = { plantree -> - { - def lst = [] - plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { - ch -> - { - lst.add(ch.replaceAll("#\\d+", '')) - } - } - return lst.join(',') - } - } - - // def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.47" - // File file = new File(outFile) - // file.write(getRuntimeFilters(plan)) - - assertEquals("RF2[s_store_sk->[ss_store_sk],RF1[i_item_sk->[ss_item_sk],RF0[d_date_sk->[ss_sold_date_sk]", getRuntimeFilters(plan)) -} + + ''' + String plan = sql "${stmt}" + println plan + def getRuntimeFilters = { plantree -> + { + def lst = [] + plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { + ch -> + { + lst.add(ch.replaceAll("#\\d+", '')) + } + } + return lst.join(',') + } + } + + //def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.47" + //File file = new File(outFile) + //file.write(getRuntimeFilters(plan)) + + assertEquals("RF2[s_store_sk->[ss_store_sk],RF1[i_item_sk->[ss_item_sk],RF0[d_date_sk->[ss_sold_date_sk]", getRuntimeFilters(plan)) +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf48.groovy b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf48.groovy index 32f767349fd6a1..4be7ad5317a156 100644 --- a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf48.groovy +++ b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf48.groovy @@ -1,37 +1,37 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -suite("ds_rf48") { - String db = context.config.getDbNameByFile(new File(context.file.parent)) - sql "use ${db}" - sql 'set enable_nereids_planner=true' - sql 'set enable_fallback_to_original_planner=false' - sql 'set exec_mem_limit=21G' - sql 'set be_number_for_test=3' - sql 'set parallel_fragment_exec_instance_num=8; ' - sql 'set parallel_pipeline_task_num=8; ' - sql 'set forbid_unknown_col_stats=true' - sql 'set broadcast_row_count_limit = 30000000' - sql 'set enable_nereids_timeout = false' - sql 'set enable_pipeline_engine=true' - String stmt = ''' - explain physical plan +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +suite("ds_rf48") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_fragment_exec_instance_num=8; ' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set broadcast_row_count_limit = 30000000' + sql 'set enable_nereids_timeout = false' + sql 'set enable_pipeline_engine=true' + String stmt = ''' + explain physical plan select sum (ss_quantity) from store_sales, store, customer_demographics, customer_address, date_dim where s_store_sk = ss_store_sk @@ -96,26 +96,26 @@ suite("ds_rf48") { ) ) ; - - ''' - String plan = sql "${stmt}" - println plan - def getRuntimeFilters = { plantree -> - { - def lst = [] - plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { - ch -> - { - lst.add(ch.replaceAll("#\\d+", '')) - } - } - return lst.join(',') - } - } - - // def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.48" - // File file = new File(outFile) - // file.write(getRuntimeFilters(plan)) - - assertEquals("RF3[s_store_sk->[ss_store_sk],RF2[d_date_sk->[ss_sold_date_sk],RF1[cd_demo_sk->[ss_cdemo_sk],RF0[ca_address_sk->[ss_addr_sk]", getRuntimeFilters(plan)) -} + + ''' + String plan = sql "${stmt}" + println plan + def getRuntimeFilters = { plantree -> + { + def lst = [] + plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { + ch -> + { + lst.add(ch.replaceAll("#\\d+", '')) + } + } + return lst.join(',') + } + } + + //def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.48" + //File file = new File(outFile) + //file.write(getRuntimeFilters(plan)) + + assertEquals("RF3[s_store_sk->[ss_store_sk],RF2[d_date_sk->[ss_sold_date_sk],RF1[ca_address_sk->[ss_addr_sk],RF0[cd_demo_sk->[ss_cdemo_sk]", getRuntimeFilters(plan)) +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf49.groovy b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf49.groovy index 91d46661fa8a32..0dd0546a7a07f8 100644 --- a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf49.groovy +++ b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf49.groovy @@ -161,7 +161,7 @@ suite("ds_rf49") { ''' String plan = sql "${stmt}" - log.info(plan) + println plan def getRuntimeFilters = { plantree -> { def lst = [] @@ -175,9 +175,9 @@ suite("ds_rf49") { } } - // def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.49" - // File file = new File(outFile) - // file.write(getRuntimeFilters(plan)) + //def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.49" + //File file = new File(outFile) + //file.write(getRuntimeFilters(plan)) - assertEquals("RF1[ws_order_number->[wr_order_number],RF2[ws_item_sk->[wr_item_sk],RF0[d_date_sk->[ws_sold_date_sk],RF4[cs_order_number->[cr_order_number],RF5[cs_item_sk->[cr_item_sk],RF3[d_date_sk->[cs_sold_date_sk],RF7[ss_ticket_number->[sr_ticket_number],RF8[ss_item_sk->[sr_item_sk],RF6[d_date_sk->[ss_sold_date_sk]", getRuntimeFilters(plan)) + assertEquals("RF1[ws_order_number->[wr_order_number],RF2[ws_item_sk->[wr_item_sk],RF0[d_date_sk->[ws_sold_date_sk],RF4[cs_order_number->[cr_order_number],RF5[cs_item_sk->[cr_item_sk],RF3[d_date_sk->[cs_sold_date_sk],RF7[ss_ticket_number->[sr_ticket_number],RF8[ss_item_sk->[sr_item_sk],RF6[d_date_sk->[ss_sold_date_sk]", getRuntimeFilters(plan)) } diff --git a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf5.groovy b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf5.groovy index 55714f66736b13..1daef3672b57e5 100644 --- a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf5.groovy +++ b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf5.groovy @@ -157,9 +157,10 @@ suite("ds_rf5") { order by channel ,id limit 100; + ''' String plan = sql "${stmt}" - log.info(plan) + println plan def getRuntimeFilters = { plantree -> { def lst = [] @@ -173,9 +174,9 @@ suite("ds_rf5") { } } - // def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.5" - // File file = new File(outFile) - // file.write(getRuntimeFilters(plan)) + //def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.5" + //File file = new File(outFile) + //file.write(getRuntimeFilters(plan)) - assertEquals("RF2[s_store_sk->[ss_store_sk],RF3[s_store_sk->[sr_store_sk],RF0[d_date_sk->[ss_sold_date_sk],RF1[d_date_sk->[sr_returned_date_sk],RF6[cp_catalog_page_sk->[cs_catalog_page_sk],RF7[cp_catalog_page_sk->[cr_catalog_page_sk],RF4[d_date_sk->[cs_sold_date_sk],RF5[d_date_sk->[cr_returned_date_sk],RF12[web_site_sk->[ws_web_site_sk],RF13[web_site_sk->[ws_web_site_sk],RF10[d_date_sk->[ws_sold_date_sk],RF11[d_date_sk->[wr_returned_date_sk],RF8[wr_item_sk->[ws_item_sk],RF9[wr_order_number->[ws_order_number]", getRuntimeFilters(plan)) + assertEquals("RF0[wr_item_sk->[ws_item_sk],RF1[wr_order_number->[ws_order_number]", getRuntimeFilters(plan)) } diff --git a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf50.groovy b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf50.groovy index 4eaafd1090325d..76302d570b74ae 100644 --- a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf50.groovy +++ b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf50.groovy @@ -1,37 +1,37 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -suite("ds_rf50") { - String db = context.config.getDbNameByFile(new File(context.file.parent)) - sql "use ${db}" - sql 'set enable_nereids_planner=true' - sql 'set enable_fallback_to_original_planner=false' - sql 'set exec_mem_limit=21G' - sql 'set be_number_for_test=3' - sql 'set parallel_fragment_exec_instance_num=8; ' - sql 'set parallel_pipeline_task_num=8; ' - sql 'set forbid_unknown_col_stats=true' - sql 'set broadcast_row_count_limit = 30000000' - sql 'set enable_nereids_timeout = false' - sql 'set enable_pipeline_engine=true' - String stmt = ''' - explain physical plan +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +suite("ds_rf50") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_fragment_exec_instance_num=8; ' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set broadcast_row_count_limit = 30000000' + sql 'set enable_nereids_timeout = false' + sql 'set enable_pipeline_engine=true' + String stmt = ''' + explain physical plan select s_store_name ,s_company_id @@ -88,25 +88,26 @@ order by s_store_name ,s_state ,s_zip limit 100; - - ''' - String plan = sql "${stmt}" - println plan - def getRuntimeFilters = { plantree -> - { - def lst = [] - plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { - ch -> - { - lst.add(ch.replaceAll("#\\d+", '')) - } - } - return lst.join(',') - } - } - - // def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.50" - // File file = new File(outFile) - // file.write(getRuntimeFilters(plan)) - assertEquals("RF5[s_store_sk->[ss_store_sk],RF4[d_date_sk->[ss_sold_date_sk],RF1[sr_customer_sk->[ss_customer_sk],RF2[sr_item_sk->[ss_item_sk],RF3[sr_ticket_number->[ss_ticket_number],RF0[d_date_sk->[sr_returned_date_sk]", getRuntimeFilters(plan)) -} + + ''' + String plan = sql "${stmt}" + println plan + def getRuntimeFilters = { plantree -> + { + def lst = [] + plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { + ch -> + { + lst.add(ch.replaceAll("#\\d+", '')) + } + } + return lst.join(',') + } + } + + //def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.50" + //File file = new File(outFile) + //file.write(getRuntimeFilters(plan)) + + assertEquals("RF5[s_store_sk->[ss_store_sk],RF4[ss_sold_date_sk->[d_date_sk],RF1[sr_customer_sk->[ss_customer_sk],RF2[sr_item_sk->[ss_item_sk],RF3[sr_ticket_number->[ss_ticket_number],RF0[d_date_sk->[sr_returned_date_sk]", getRuntimeFilters(plan)) +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf51.groovy b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf51.groovy index 28ea4237cfa561..778a4cce90ec90 100644 --- a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf51.groovy +++ b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf51.groovy @@ -1,37 +1,37 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -suite("ds_rf51") { - String db = context.config.getDbNameByFile(new File(context.file.parent)) - sql "use ${db}" - sql 'set enable_nereids_planner=true' - sql 'set enable_fallback_to_original_planner=false' - sql 'set exec_mem_limit=21G' - sql 'set be_number_for_test=3' - sql 'set parallel_fragment_exec_instance_num=8; ' - sql 'set parallel_pipeline_task_num=8; ' - sql 'set forbid_unknown_col_stats=true' - sql 'set broadcast_row_count_limit = 30000000' - sql 'set enable_nereids_timeout = false' - sql 'set enable_pipeline_engine=true' - String stmt = ''' - explain physical plan +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +suite("ds_rf51") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_fragment_exec_instance_num=8; ' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set broadcast_row_count_limit = 30000000' + sql 'set enable_nereids_timeout = false' + sql 'set enable_pipeline_engine=true' + String stmt = ''' + explain physical plan WITH web_v1 as ( select ws_item_sk item_sk, d_date, @@ -74,26 +74,26 @@ where web_cumulative > store_cumulative order by item_sk ,d_date limit 100; - - ''' - String plan = sql "${stmt}" - println plan - def getRuntimeFilters = { plantree -> - { - def lst = [] - plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { - ch -> - { - lst.add(ch.replaceAll("#\\d+", '')) - } - } - return lst.join(',') - } - } - - // def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.51" - // File file = new File(outFile) - // file.write(getRuntimeFilters(plan)) - - assertEquals("RF1[d_date_sk->[ss_sold_date_sk],RF0[d_date_sk->[ws_sold_date_sk]", getRuntimeFilters(plan)) -} + + ''' + String plan = sql "${stmt}" + println plan + def getRuntimeFilters = { plantree -> + { + def lst = [] + plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { + ch -> + { + lst.add(ch.replaceAll("#\\d+", '')) + } + } + return lst.join(',') + } + } + + //def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.51" + //File file = new File(outFile) + //file.write(getRuntimeFilters(plan)) + + assertEquals("RF1[d_date_sk->[ss_sold_date_sk],RF0[d_date_sk->[ws_sold_date_sk]", getRuntimeFilters(plan)) +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf52.groovy b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf52.groovy index 8967a32396d4d7..cc6512ad2cd569 100644 --- a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf52.groovy +++ b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf52.groovy @@ -1,37 +1,37 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -suite("ds_rf52") { - String db = context.config.getDbNameByFile(new File(context.file.parent)) - sql "use ${db}" - sql 'set enable_nereids_planner=true' - sql 'set enable_fallback_to_original_planner=false' - sql 'set exec_mem_limit=21G' - sql 'set be_number_for_test=3' - sql 'set parallel_fragment_exec_instance_num=8; ' - sql 'set parallel_pipeline_task_num=8; ' - sql 'set forbid_unknown_col_stats=true' - sql 'set broadcast_row_count_limit = 30000000' - sql 'set enable_nereids_timeout = false' - sql 'set enable_pipeline_engine=true' - String stmt = ''' - explain physical plan +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +suite("ds_rf52") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_fragment_exec_instance_num=8; ' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set broadcast_row_count_limit = 30000000' + sql 'set enable_nereids_timeout = false' + sql 'set enable_pipeline_engine=true' + String stmt = ''' + explain physical plan select dt.d_year ,item.i_brand_id brand_id ,item.i_brand brand @@ -51,26 +51,26 @@ suite("ds_rf52") { ,ext_price desc ,brand_id limit 100 ; - - ''' - String plan = sql "${stmt}" - println plan - def getRuntimeFilters = { plantree -> - { - def lst = [] - plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { - ch -> - { - lst.add(ch.replaceAll("#\\d+", '')) - } - } - return lst.join(',') - } - } - - // def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.52" - // File file = new File(outFile) - // file.write(getRuntimeFilters(plan)) - - assertEquals("RF1[d_date_sk->[ss_sold_date_sk],RF0[i_item_sk->[ss_item_sk]", getRuntimeFilters(plan)) -} + + ''' + String plan = sql "${stmt}" + println plan + def getRuntimeFilters = { plantree -> + { + def lst = [] + plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { + ch -> + { + lst.add(ch.replaceAll("#\\d+", '')) + } + } + return lst.join(',') + } + } + + //def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.52" + //File file = new File(outFile) + //file.write(getRuntimeFilters(plan)) + + assertEquals("RF1[d_date_sk->[ss_sold_date_sk],RF0[i_item_sk->[ss_item_sk]", getRuntimeFilters(plan)) +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf53.groovy b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf53.groovy index e74d96cf475cce..9f0026036e7c6f 100644 --- a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf53.groovy +++ b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf53.groovy @@ -1,37 +1,37 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -suite("ds_rf53") { - String db = context.config.getDbNameByFile(new File(context.file.parent)) - sql "use ${db}" - sql 'set enable_nereids_planner=true' - sql 'set enable_fallback_to_original_planner=false' - sql 'set exec_mem_limit=21G' - sql 'set be_number_for_test=3' - sql 'set parallel_fragment_exec_instance_num=8; ' - sql 'set parallel_pipeline_task_num=8; ' - sql 'set forbid_unknown_col_stats=true' - sql 'set broadcast_row_count_limit = 30000000' - sql 'set enable_nereids_timeout = false' - sql 'set enable_pipeline_engine=true' - String stmt = ''' - explain physical plan +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +suite("ds_rf53") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_fragment_exec_instance_num=8; ' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set broadcast_row_count_limit = 30000000' + sql 'set enable_nereids_timeout = false' + sql 'set enable_pipeline_engine=true' + String stmt = ''' + explain physical plan select * from (select i_manufact_id, sum(ss_sales_price) sum_sales, @@ -57,26 +57,26 @@ order by avg_quarterly_sales, sum_sales, i_manufact_id limit 100; - - ''' - String plan = sql "${stmt}" - println plan - def getRuntimeFilters = { plantree -> - { - def lst = [] - plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { - ch -> - { - lst.add(ch.replaceAll("#\\d+", '')) - } - } - return lst.join(',') - } - } - - // def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.53" - // File file = new File(outFile) - // file.write(getRuntimeFilters(plan)) - - assertEquals("RF2[s_store_sk->[ss_store_sk],RF1[d_date_sk->[ss_sold_date_sk],RF0[i_item_sk->[ss_item_sk]", getRuntimeFilters(plan)) -} + + ''' + String plan = sql "${stmt}" + println plan + def getRuntimeFilters = { plantree -> + { + def lst = [] + plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { + ch -> + { + lst.add(ch.replaceAll("#\\d+", '')) + } + } + return lst.join(',') + } + } + + //def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.53" + //File file = new File(outFile) + //file.write(getRuntimeFilters(plan)) + + assertEquals("RF2[s_store_sk->[ss_store_sk],RF1[d_date_sk->[ss_sold_date_sk],RF0[i_item_sk->[ss_item_sk]", getRuntimeFilters(plan)) +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf54.groovy b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf54.groovy index 234c4c0d5fcaaf..ac58b688da3549 100644 --- a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf54.groovy +++ b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf54.groovy @@ -1,110 +1,110 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -suite("ds_rf54") { - String db = context.config.getDbNameByFile(new File(context.file.parent)) - sql "use ${db}" - sql 'set enable_nereids_planner=true' - sql 'set enable_fallback_to_original_planner=false' - sql 'set exec_mem_limit=21G' - sql 'set be_number_for_test=3' - sql 'set parallel_fragment_exec_instance_num=8; ' - sql 'set parallel_pipeline_task_num=8; ' - sql 'set forbid_unknown_col_stats=true' - sql 'set broadcast_row_count_limit = 30000000' - sql 'set enable_nereids_timeout = false' - sql 'set enable_pipeline_engine=true' - String stmt = ''' - explain physical plan - with my_customers as ( - select distinct c_customer_sk - , c_current_addr_sk - from - ( select cs_sold_date_sk sold_date_sk, - cs_bill_customer_sk customer_sk, - cs_item_sk item_sk - from catalog_sales - union all - select ws_sold_date_sk sold_date_sk, - ws_bill_customer_sk customer_sk, - ws_item_sk item_sk - from web_sales - ) cs_or_ws_sales, - item, - date_dim, - customer - where sold_date_sk = d_date_sk - and item_sk = i_item_sk - and i_category = 'Women' - and i_class = 'maternity' - and c_customer_sk = cs_or_ws_sales.customer_sk - and d_moy = 5 - and d_year = 1998 - ) - , my_revenue as ( - select c_customer_sk, - sum(ss_ext_sales_price) as revenue - from my_customers, - store_sales, - customer_address, - store, - date_dim - where c_current_addr_sk = ca_address_sk - and ca_county = s_county - and ca_state = s_state - and ss_sold_date_sk = d_date_sk - and c_customer_sk = ss_customer_sk - and d_month_seq between (select distinct d_month_seq+1 - from date_dim where d_year = 1998 and d_moy = 5) - and (select distinct d_month_seq+3 - from date_dim where d_year = 1998 and d_moy = 5) - group by c_customer_sk - ) - , segments as - (select cast((revenue/50) as int) as segment - from my_revenue - ) - select segment, count(*) as num_customers, segment*50 as segment_base - from segments - group by segment - order by segment, num_customers - limit 100; - - ''' - String plan = sql "${stmt}" - println plan - def getRuntimeFilters = { plantree -> - { - def lst = [] - plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { - ch -> - { - lst.add(ch.replaceAll("#\\d+", '')) - } - } - return lst.join(',') - } - } - - // def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.54" - // File file = new File(outFile) - // file.write(getRuntimeFilters(plan)) - - assertEquals("RF6[d_date_sk->[ss_sold_date_sk],RF5[c_customer_sk->[ss_customer_sk],RF3[s_county->[ca_county],RF4[s_state->[ca_state],RF2[c_current_addr_sk->[ca_address_sk],RF1[customer_sk->[c_customer_sk],RF0[i_item_sk->[cs_item_sk, ws_item_sk]", getRuntimeFilters(plan)) -} +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +suite("ds_rf54") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_fragment_exec_instance_num=8; ' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set broadcast_row_count_limit = 30000000' + sql 'set enable_nereids_timeout = false' + sql 'set enable_pipeline_engine=true' + String stmt = ''' + explain physical plan + with my_customers as ( + select distinct c_customer_sk + , c_current_addr_sk + from + ( select cs_sold_date_sk sold_date_sk, + cs_bill_customer_sk customer_sk, + cs_item_sk item_sk + from catalog_sales + union all + select ws_sold_date_sk sold_date_sk, + ws_bill_customer_sk customer_sk, + ws_item_sk item_sk + from web_sales + ) cs_or_ws_sales, + item, + date_dim, + customer + where sold_date_sk = d_date_sk + and item_sk = i_item_sk + and i_category = 'Women' + and i_class = 'maternity' + and c_customer_sk = cs_or_ws_sales.customer_sk + and d_moy = 5 + and d_year = 1998 + ) + , my_revenue as ( + select c_customer_sk, + sum(ss_ext_sales_price) as revenue + from my_customers, + store_sales, + customer_address, + store, + date_dim + where c_current_addr_sk = ca_address_sk + and ca_county = s_county + and ca_state = s_state + and ss_sold_date_sk = d_date_sk + and c_customer_sk = ss_customer_sk + and d_month_seq between (select distinct d_month_seq+1 + from date_dim where d_year = 1998 and d_moy = 5) + and (select distinct d_month_seq+3 + from date_dim where d_year = 1998 and d_moy = 5) + group by c_customer_sk + ) + , segments as + (select cast((revenue/50) as int) as segment + from my_revenue + ) + select segment, count(*) as num_customers, segment*50 as segment_base + from segments + group by segment + order by segment, num_customers + limit 100; + + ''' + String plan = sql "${stmt}" + println plan + def getRuntimeFilters = { plantree -> + { + def lst = [] + plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { + ch -> + { + lst.add(ch.replaceAll("#\\d+", '')) + } + } + return lst.join(',') + } + } + + //def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.54" + //File file = new File(outFile) + //file.write(getRuntimeFilters(plan)) + + assertEquals("RF5[d_date_sk->[ss_sold_date_sk],RF4[c_customer_sk->[ss_customer_sk],RF2[s_county->[ca_county],RF3[s_state->[ca_state],RF1[c_current_addr_sk->[ca_address_sk],RF0[customer_sk->[c_customer_sk]", getRuntimeFilters(plan)) +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf55.groovy b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf55.groovy index 90fd6e30b7e7a5..0b57e874cc2365 100644 --- a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf55.groovy +++ b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf55.groovy @@ -1,37 +1,37 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -suite("ds_rf55") { - String db = context.config.getDbNameByFile(new File(context.file.parent)) - sql "use ${db}" - sql 'set enable_nereids_planner=true' - sql 'set enable_fallback_to_original_planner=false' - sql 'set exec_mem_limit=21G' - sql 'set be_number_for_test=3' - sql 'set parallel_fragment_exec_instance_num=8; ' - sql 'set parallel_pipeline_task_num=8; ' - sql 'set forbid_unknown_col_stats=true' - sql 'set broadcast_row_count_limit = 30000000' - sql 'set enable_nereids_timeout = false' - sql 'set enable_pipeline_engine=true' - String stmt = ''' - explain physical plan +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +suite("ds_rf55") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_fragment_exec_instance_num=8; ' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set broadcast_row_count_limit = 30000000' + sql 'set enable_nereids_timeout = false' + sql 'set enable_pipeline_engine=true' + String stmt = ''' + explain physical plan select i_brand_id brand_id, i_brand brand, sum(ss_ext_sales_price) ext_price from date_dim, store_sales, item @@ -43,26 +43,26 @@ suite("ds_rf55") { group by i_brand, i_brand_id order by ext_price desc, i_brand_id limit 100 ; - - ''' - String plan = sql "${stmt}" - println plan - def getRuntimeFilters = { plantree -> - { - def lst = [] - plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { - ch -> - { - lst.add(ch.replaceAll("#\\d+", '')) - } - } - return lst.join(',') - } - } - - // def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.55" - // File file = new File(outFile) - // file.write(getRuntimeFilters(plan)) - - assertEquals("RF1[d_date_sk->[ss_sold_date_sk],RF0[i_item_sk->[ss_item_sk]", getRuntimeFilters(plan)) -} + + ''' + String plan = sql "${stmt}" + println plan + def getRuntimeFilters = { plantree -> + { + def lst = [] + plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { + ch -> + { + lst.add(ch.replaceAll("#\\d+", '')) + } + } + return lst.join(',') + } + } + + //def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.55" + //File file = new File(outFile) + //file.write(getRuntimeFilters(plan)) + + assertEquals("RF1[d_date_sk->[ss_sold_date_sk],RF0[i_item_sk->[ss_item_sk]", getRuntimeFilters(plan)) +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf56.groovy b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf56.groovy index 9e793e6163fafd..398c66a9fb23d7 100644 --- a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf56.groovy +++ b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf56.groovy @@ -101,7 +101,7 @@ where i_color in ('powder','green','cyan')) ''' String plan = sql "${stmt}" - log.info(plan) + println plan def getRuntimeFilters = { plantree -> { def lst = [] @@ -115,9 +115,9 @@ where i_color in ('powder','green','cyan')) } } - // def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.56" - // File file = new File(outFile) - // file.write(getRuntimeFilters(plan)) + //def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.56" + //File file = new File(outFile) + //file.write(getRuntimeFilters(plan)) - assertEquals("RF3[ca_address_sk->[ss_addr_sk],RF2[i_item_sk->[ss_item_sk],RF1[d_date_sk->[ss_sold_date_sk],RF0[i_item_id->[i_item_id],RF7[cs_bill_addr_sk->[ca_address_sk],RF6[i_item_sk->[cs_item_sk],RF5[d_date_sk->[cs_sold_date_sk],RF4[i_item_id->[i_item_id],RF11[ws_bill_addr_sk->[ca_address_sk],RF10[i_item_sk->[ws_item_sk],RF9[d_date_sk->[ws_sold_date_sk],RF8[i_item_id->[i_item_id]", getRuntimeFilters(plan)) + assertEquals("RF3[ca_address_sk->[ss_addr_sk],RF2[i_item_sk->[ss_item_sk],RF1[d_date_sk->[ss_sold_date_sk],RF0[i_item_id->[i_item_id],RF7[cs_bill_addr_sk->[ca_address_sk],RF6[i_item_sk->[cs_item_sk],RF5[d_date_sk->[cs_sold_date_sk],RF4[i_item_id->[i_item_id],RF11[ws_bill_addr_sk->[ca_address_sk],RF10[i_item_sk->[ws_item_sk],RF9[d_date_sk->[ws_sold_date_sk],RF8[i_item_id->[i_item_id]", getRuntimeFilters(plan)) } diff --git a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf57.groovy b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf57.groovy index 4633893be3e57c..6748c221e36d83 100644 --- a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf57.groovy +++ b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf57.groovy @@ -1,37 +1,37 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -suite("ds_rf57") { - String db = context.config.getDbNameByFile(new File(context.file.parent)) - sql "use ${db}" - sql 'set enable_nereids_planner=true' - sql 'set enable_fallback_to_original_planner=false' - sql 'set exec_mem_limit=21G' - sql 'set be_number_for_test=3' - sql 'set parallel_fragment_exec_instance_num=8; ' - sql 'set parallel_pipeline_task_num=8; ' - sql 'set forbid_unknown_col_stats=true' - sql 'set broadcast_row_count_limit = 30000000' - sql 'set enable_nereids_timeout = false' - sql 'set enable_pipeline_engine=true' - String stmt = ''' - explain physical plan +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +suite("ds_rf57") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_fragment_exec_instance_num=8; ' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set broadcast_row_count_limit = 30000000' + sql 'set enable_nereids_timeout = false' + sql 'set enable_pipeline_engine=true' + String stmt = ''' + explain physical plan with v1 as( select i_category, i_brand, cc_name, @@ -77,26 +77,26 @@ suite("ds_rf57") { case when avg_monthly_sales > 0 then abs(sum_sales - avg_monthly_sales) / avg_monthly_sales else null end > 0.1 order by sum_sales - avg_monthly_sales, nsum limit 100; - - ''' - String plan = sql "${stmt}" - println plan - def getRuntimeFilters = { plantree -> - { - def lst = [] - plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { - ch -> - { - lst.add(ch.replaceAll("#\\d+", '')) - } - } - return lst.join(',') - } - } - - // def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.57" - // File file = new File(outFile) - // file.write(getRuntimeFilters(plan)) - - assertEquals("RF2[cc_call_center_sk->[cs_call_center_sk],RF1[i_item_sk->[cs_item_sk],RF0[d_date_sk->[cs_sold_date_sk]", getRuntimeFilters(plan)) -} + + ''' + String plan = sql "${stmt}" + println plan + def getRuntimeFilters = { plantree -> + { + def lst = [] + plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { + ch -> + { + lst.add(ch.replaceAll("#\\d+", '')) + } + } + return lst.join(',') + } + } + + //def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.57" + //File file = new File(outFile) + //file.write(getRuntimeFilters(plan)) + + assertEquals("RF2[cc_call_center_sk->[cs_call_center_sk],RF1[i_item_sk->[cs_item_sk],RF0[d_date_sk->[cs_sold_date_sk]", getRuntimeFilters(plan)) +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf58.groovy b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf58.groovy index 89e39ed0709283..ff90f57177e5f6 100644 --- a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf58.groovy +++ b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf58.groovy @@ -97,7 +97,7 @@ suite("ds_rf58") { ''' String plan = sql "${stmt}" - log.info(plan) + println plan def getRuntimeFilters = { plantree -> { def lst = [] @@ -111,9 +111,9 @@ suite("ds_rf58") { } } - // def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.58" - // File file = new File(outFile) - // file.write(getRuntimeFilters(plan)) + //def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.58" + //File file = new File(outFile) + //file.write(getRuntimeFilters(plan)) - assertEquals("RF13[item_id->[i_item_id],RF12[i_item_sk->[cs_item_sk],RF11[d_date_sk->[cs_sold_date_sk],RF10[d_date->[d_date],RF9[d_week_seq->[d_week_seq],RF8[item_id->[i_item_id],RF7[i_item_sk->[ws_item_sk],RF6[d_date_sk->[ws_sold_date_sk],RF5[d_date->[d_date],RF4[d_week_seq->[d_week_seq],RF3[i_item_sk->[ss_item_sk],RF2[d_date_sk->[ss_sold_date_sk],RF1[d_date->[d_date],RF0[d_week_seq->[d_week_seq]", getRuntimeFilters(plan)) + assertEquals("RF13[item_id->[i_item_id],RF12[cs_item_sk->[i_item_sk],RF11[d_date_sk->[cs_sold_date_sk],RF10[d_date->[d_date],RF9[d_week_seq->[d_week_seq],RF8[item_id->[i_item_id],RF7[ss_item_sk->[i_item_sk],RF6[d_date_sk->[ss_sold_date_sk],RF5[d_date->[d_date],RF4[d_week_seq->[d_week_seq],RF3[ws_item_sk->[i_item_sk],RF2[d_date_sk->[ws_sold_date_sk],RF1[d_date->[d_date],RF0[d_week_seq->[d_week_seq]", getRuntimeFilters(plan)) } diff --git a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf59.groovy b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf59.groovy index 22a9561c3fcac6..d7f673e720b580 100644 --- a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf59.groovy +++ b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf59.groovy @@ -1,97 +1,98 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -suite("ds_rf59") { - String db = context.config.getDbNameByFile(new File(context.file.parent)) - sql "use ${db}" - sql 'set enable_nereids_planner=true' - sql 'set enable_fallback_to_original_planner=false' - sql 'set exec_mem_limit=21G' - sql 'set be_number_for_test=3' - sql 'set parallel_fragment_exec_instance_num=8; ' - sql 'set parallel_pipeline_task_num=8; ' - sql 'set forbid_unknown_col_stats=true' - sql 'set broadcast_row_count_limit = 30000000' - sql 'set enable_nereids_timeout = false' - sql 'set enable_pipeline_engine=true' - String stmt = ''' - explain physical plan - with wss as - (select d_week_seq, - ss_store_sk, - sum(case when (d_day_name='Sunday') then ss_sales_price else null end) sun_sales, - sum(case when (d_day_name='Monday') then ss_sales_price else null end) mon_sales, - sum(case when (d_day_name='Tuesday') then ss_sales_price else null end) tue_sales, - sum(case when (d_day_name='Wednesday') then ss_sales_price else null end) wed_sales, - sum(case when (d_day_name='Thursday') then ss_sales_price else null end) thu_sales, - sum(case when (d_day_name='Friday') then ss_sales_price else null end) fri_sales, - sum(case when (d_day_name='Saturday') then ss_sales_price else null end) sat_sales - from store_sales,date_dim - where d_date_sk = ss_sold_date_sk - group by d_week_seq,ss_store_sk - ) - select s_store_name1,s_store_id1,d_week_seq1 - ,sun_sales1/sun_sales2,mon_sales1/mon_sales2 - ,tue_sales1/tue_sales2,wed_sales1/wed_sales2,thu_sales1/thu_sales2 - ,fri_sales1/fri_sales2,sat_sales1/sat_sales2 - from - (select s_store_name s_store_name1,wss.d_week_seq d_week_seq1 - ,s_store_id s_store_id1,sun_sales sun_sales1 - ,mon_sales mon_sales1,tue_sales tue_sales1 - ,wed_sales wed_sales1,thu_sales thu_sales1 - ,fri_sales fri_sales1,sat_sales sat_sales1 - from wss,store,date_dim d - where d.d_week_seq = wss.d_week_seq and - ss_store_sk = s_store_sk and - d_month_seq between 1196 and 1196 + 11) y, - (select s_store_name s_store_name2,wss.d_week_seq d_week_seq2 - ,s_store_id s_store_id2,sun_sales sun_sales2 - ,mon_sales mon_sales2,tue_sales tue_sales2 - ,wed_sales wed_sales2,thu_sales thu_sales2 - ,fri_sales fri_sales2,sat_sales sat_sales2 - from wss,store,date_dim d - where d.d_week_seq = wss.d_week_seq and - ss_store_sk = s_store_sk and - d_month_seq between 1196+ 12 and 1196 + 23) x - where s_store_id1=s_store_id2 - and d_week_seq1=d_week_seq2-52 - order by s_store_name1,s_store_id1,d_week_seq1 -limit 100; - - ''' - String plan = sql "${stmt}" - println plan - def getRuntimeFilters = { plantree -> - { - def lst = [] - plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { - ch -> - { - lst.add(ch.replaceAll("#\\d+", '')) - } - } - return lst.join(',') - } - } - - // def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.59" - // File file = new File(outFile) - // file.write(getRuntimeFilters(plan)) - assertEquals("RF0[d_date_sk->[ss_sold_date_sk],RF4[s_store_sk->[ss_store_sk],RF3[d_week_seq->[d_week_seq],RF2[s_store_sk->[ss_store_sk],RF1[d_week_seq->[d_week_seq]", getRuntimeFilters(plan)) -} +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +suite("ds_rf59") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_fragment_exec_instance_num=8; ' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set broadcast_row_count_limit = 30000000' + sql 'set enable_nereids_timeout = false' + sql 'set enable_pipeline_engine=true' + String stmt = ''' + explain physical plan + with wss as + (select d_week_seq, + ss_store_sk, + sum(case when (d_day_name='Sunday') then ss_sales_price else null end) sun_sales, + sum(case when (d_day_name='Monday') then ss_sales_price else null end) mon_sales, + sum(case when (d_day_name='Tuesday') then ss_sales_price else null end) tue_sales, + sum(case when (d_day_name='Wednesday') then ss_sales_price else null end) wed_sales, + sum(case when (d_day_name='Thursday') then ss_sales_price else null end) thu_sales, + sum(case when (d_day_name='Friday') then ss_sales_price else null end) fri_sales, + sum(case when (d_day_name='Saturday') then ss_sales_price else null end) sat_sales + from store_sales,date_dim + where d_date_sk = ss_sold_date_sk + group by d_week_seq,ss_store_sk + ) + select s_store_name1,s_store_id1,d_week_seq1 + ,sun_sales1/sun_sales2,mon_sales1/mon_sales2 + ,tue_sales1/tue_sales2,wed_sales1/wed_sales2,thu_sales1/thu_sales2 + ,fri_sales1/fri_sales2,sat_sales1/sat_sales2 + from + (select s_store_name s_store_name1,wss.d_week_seq d_week_seq1 + ,s_store_id s_store_id1,sun_sales sun_sales1 + ,mon_sales mon_sales1,tue_sales tue_sales1 + ,wed_sales wed_sales1,thu_sales thu_sales1 + ,fri_sales fri_sales1,sat_sales sat_sales1 + from wss,store,date_dim d + where d.d_week_seq = wss.d_week_seq and + ss_store_sk = s_store_sk and + d_month_seq between 1196 and 1196 + 11) y, + (select s_store_name s_store_name2,wss.d_week_seq d_week_seq2 + ,s_store_id s_store_id2,sun_sales sun_sales2 + ,mon_sales mon_sales2,tue_sales tue_sales2 + ,wed_sales wed_sales2,thu_sales thu_sales2 + ,fri_sales fri_sales2,sat_sales sat_sales2 + from wss,store,date_dim d + where d.d_week_seq = wss.d_week_seq and + ss_store_sk = s_store_sk and + d_month_seq between 1196+ 12 and 1196 + 23) x + where s_store_id1=s_store_id2 + and d_week_seq1=d_week_seq2-52 + order by s_store_name1,s_store_id1,d_week_seq1 +limit 100; + + ''' + String plan = sql "${stmt}" + println plan + def getRuntimeFilters = { plantree -> + { + def lst = [] + plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { + ch -> + { + lst.add(ch.replaceAll("#\\d+", '')) + } + } + return lst.join(',') + } + } + + //def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.59" + //File file = new File(outFile) + //file.write(getRuntimeFilters(plan)) + + assertEquals("RF0[d_date_sk->[ss_sold_date_sk],RF1[s_store_id1->[s_store_id]", getRuntimeFilters(plan)) +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf6.groovy b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf6.groovy index 9e58d08dab0f63..b7f591b75a0fd2 100644 --- a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf6.groovy +++ b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf6.groovy @@ -1,37 +1,37 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -suite("ds_rf6") { - String db = context.config.getDbNameByFile(new File(context.file.parent)) - sql "use ${db}" - sql 'set enable_nereids_planner=true' - sql 'set enable_fallback_to_original_planner=false' - sql 'set exec_mem_limit=21G' - sql 'set be_number_for_test=3' - sql 'set parallel_fragment_exec_instance_num=8; ' - sql 'set parallel_pipeline_task_num=8; ' - sql 'set forbid_unknown_col_stats=true' - sql 'set broadcast_row_count_limit = 30000000' - sql 'set enable_nereids_timeout = false' - sql 'set enable_pipeline_engine=true' - String stmt = ''' - explain physical plan +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +suite("ds_rf6") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_fragment_exec_instance_num=8; ' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set broadcast_row_count_limit = 30000000' + sql 'set enable_nereids_timeout = false' + sql 'set enable_pipeline_engine=true' + String stmt = ''' + explain physical plan select a.ca_state state, count(*) cnt from customer_address a ,customer c @@ -55,26 +55,26 @@ suite("ds_rf6") { having count(*) >= 10 order by cnt, a.ca_state limit 100; - - ''' - String plan = sql "${stmt}" - println plan - def getRuntimeFilters = { plantree -> - { - def lst = [] - plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { - ch -> - { - lst.add(ch.replaceAll("#\\d+", '')) - } - } - return lst.join(',') - } - } - - // def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.6" - // File file = new File(outFile) - // file.write(getRuntimeFilters(plan)) - - assertEquals("RF5[ca_address_sk->[c_current_addr_sk],RF4[ss_customer_sk->[c_customer_sk],RF3[i_category->[i_category],RF2[i_item_sk->[ss_item_sk],RF1[d_date_sk->[ss_sold_date_sk],RF0[d_month_seq->[d_month_seq]", getRuntimeFilters(plan)) -} + + ''' + String plan = sql "${stmt}" + println plan + def getRuntimeFilters = { plantree -> + { + def lst = [] + plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { + ch -> + { + lst.add(ch.replaceAll("#\\d+", '')) + } + } + return lst.join(',') + } + } + + //def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.6" + //File file = new File(outFile) + //file.write(getRuntimeFilters(plan)) + + assertEquals("RF5[ca_address_sk->[c_current_addr_sk],RF4[ss_customer_sk->[c_customer_sk],RF3[i_category->[i_category],RF2[i_item_sk->[ss_item_sk],RF1[d_date_sk->[ss_sold_date_sk],RF0[d_month_seq->[d_month_seq]", getRuntimeFilters(plan)) +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf60.groovy b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf60.groovy index 96d5edec07c3da..999550b7b312e2 100644 --- a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf60.groovy +++ b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf60.groovy @@ -110,7 +110,7 @@ where i_category in ('Children')) ''' String plan = sql "${stmt}" - log.info(plan) + println plan def getRuntimeFilters = { plantree -> { def lst = [] @@ -124,9 +124,9 @@ where i_category in ('Children')) } } - // def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.60" - // File file = new File(outFile) - // file.write(getRuntimeFilters(plan)) + //def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.60" + //File file = new File(outFile) + //file.write(getRuntimeFilters(plan)) - assertEquals("RF3[ca_address_sk->[ss_addr_sk],RF2[i_item_sk->[ss_item_sk],RF1[d_date_sk->[ss_sold_date_sk],RF0[i_item_id->[i_item_id],RF7[ca_address_sk->[cs_bill_addr_sk],RF6[i_item_sk->[cs_item_sk],RF5[d_date_sk->[cs_sold_date_sk],RF4[i_item_id->[i_item_id],RF11[ca_address_sk->[ws_bill_addr_sk],RF10[i_item_sk->[ws_item_sk],RF9[d_date_sk->[ws_sold_date_sk],RF8[i_item_id->[i_item_id]", getRuntimeFilters(plan)) + assertEquals("RF3[ca_address_sk->[ss_addr_sk],RF2[i_item_sk->[ss_item_sk],RF1[d_date_sk->[ss_sold_date_sk],RF0[i_item_id->[i_item_id],RF7[ca_address_sk->[cs_bill_addr_sk],RF6[i_item_sk->[cs_item_sk],RF5[d_date_sk->[cs_sold_date_sk],RF4[i_item_id->[i_item_id],RF11[i_item_sk->[ws_item_sk],RF10[ca_address_sk->[ws_bill_addr_sk],RF9[d_date_sk->[ws_sold_date_sk],RF8[i_item_id->[i_item_id]", getRuntimeFilters(plan)) } diff --git a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf61.groovy b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf61.groovy index 656f37961492e4..cc20fb4f29def1 100644 --- a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf61.groovy +++ b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf61.groovy @@ -1,98 +1,98 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -suite("ds_rf61") { - String db = context.config.getDbNameByFile(new File(context.file.parent)) - sql "use ${db}" - sql 'set enable_nereids_planner=true' - sql 'set enable_fallback_to_original_planner=false' - sql 'set exec_mem_limit=21G' - sql 'set be_number_for_test=3' - sql 'set parallel_fragment_exec_instance_num=8; ' - sql 'set parallel_pipeline_task_num=8; ' - sql 'set forbid_unknown_col_stats=true' - sql 'set broadcast_row_count_limit = 30000000' - sql 'set enable_nereids_timeout = false' - sql 'set enable_pipeline_engine=true' - String stmt = ''' - explain physical plan - select promotions,total,cast(promotions as decimal(15,4))/cast(total as decimal(15,4))*100 -from - (select sum(ss_ext_sales_price) promotions - from store_sales - ,store - ,promotion - ,date_dim - ,customer - ,customer_address - ,item - where ss_sold_date_sk = d_date_sk - and ss_store_sk = s_store_sk - and ss_promo_sk = p_promo_sk - and ss_customer_sk= c_customer_sk - and ca_address_sk = c_current_addr_sk - and ss_item_sk = i_item_sk - and ca_gmt_offset = -7 - and i_category = 'Jewelry' - and (p_channel_dmail = 'Y' or p_channel_email = 'Y' or p_channel_tv = 'Y') - and s_gmt_offset = -7 - and d_year = 1999 - and d_moy = 11) promotional_sales, - (select sum(ss_ext_sales_price) total - from store_sales - ,store - ,date_dim - ,customer - ,customer_address - ,item - where ss_sold_date_sk = d_date_sk - and ss_store_sk = s_store_sk - and ss_customer_sk= c_customer_sk - and ca_address_sk = c_current_addr_sk - and ss_item_sk = i_item_sk - and ca_gmt_offset = -7 - and i_category = 'Jewelry' - and s_gmt_offset = -7 - and d_year = 1999 - and d_moy = 11) all_sales -order by promotions, total -limit 100; - - ''' - String plan = sql "${stmt}" - println plan - def getRuntimeFilters = { plantree -> - { - def lst = [] - plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { - ch -> - { - lst.add(ch.replaceAll("#\\d+", '')) - } - } - return lst.join(',') - } - } - - // def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.61" - // File file = new File(outFile) - // file.write(getRuntimeFilters(plan)) - - assertEquals("RF10[ss_item_sk->[i_item_sk],RF9[c_current_addr_sk->[ca_address_sk],RF8[ss_customer_sk->[c_customer_sk],RF7[d_date_sk->[ss_sold_date_sk],RF6[p_promo_sk->[ss_promo_sk],RF5[s_store_sk->[ss_store_sk],RF4[ss_item_sk->[i_item_sk],RF3[c_current_addr_sk->[ca_address_sk],RF2[ss_customer_sk->[c_customer_sk],RF1[d_date_sk->[ss_sold_date_sk],RF0[s_store_sk->[ss_store_sk]", getRuntimeFilters(plan)) -} +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +suite("ds_rf61") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_fragment_exec_instance_num=8; ' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set broadcast_row_count_limit = 30000000' + sql 'set enable_nereids_timeout = false' + sql 'set enable_pipeline_engine=true' + String stmt = ''' + explain physical plan + select promotions,total,cast(promotions as decimal(15,4))/cast(total as decimal(15,4))*100 +from + (select sum(ss_ext_sales_price) promotions + from store_sales + ,store + ,promotion + ,date_dim + ,customer + ,customer_address + ,item + where ss_sold_date_sk = d_date_sk + and ss_store_sk = s_store_sk + and ss_promo_sk = p_promo_sk + and ss_customer_sk= c_customer_sk + and ca_address_sk = c_current_addr_sk + and ss_item_sk = i_item_sk + and ca_gmt_offset = -7 + and i_category = 'Jewelry' + and (p_channel_dmail = 'Y' or p_channel_email = 'Y' or p_channel_tv = 'Y') + and s_gmt_offset = -7 + and d_year = 1999 + and d_moy = 11) promotional_sales, + (select sum(ss_ext_sales_price) total + from store_sales + ,store + ,date_dim + ,customer + ,customer_address + ,item + where ss_sold_date_sk = d_date_sk + and ss_store_sk = s_store_sk + and ss_customer_sk= c_customer_sk + and ca_address_sk = c_current_addr_sk + and ss_item_sk = i_item_sk + and ca_gmt_offset = -7 + and i_category = 'Jewelry' + and s_gmt_offset = -7 + and d_year = 1999 + and d_moy = 11) all_sales +order by promotions, total +limit 100; + + ''' + String plan = sql "${stmt}" + println plan + def getRuntimeFilters = { plantree -> + { + def lst = [] + plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { + ch -> + { + lst.add(ch.replaceAll("#\\d+", '')) + } + } + return lst.join(',') + } + } + + //def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.61" + //File file = new File(outFile) + //file.write(getRuntimeFilters(plan)) + + assertEquals("RF10[c_current_addr_sk->[ca_address_sk],RF9[ss_item_sk->[i_item_sk],RF8[ss_customer_sk->[c_customer_sk],RF7[ss_promo_sk->[p_promo_sk],RF6[ss_sold_date_sk->[d_date_sk],RF5[s_store_sk->[ss_store_sk],RF4[c_current_addr_sk->[ca_address_sk],RF3[ss_item_sk->[i_item_sk],RF2[ss_sold_date_sk->[d_date_sk],RF1[ss_customer_sk->[c_customer_sk],RF0[s_store_sk->[ss_store_sk]", getRuntimeFilters(plan)) +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf62.groovy b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf62.groovy index 8a044331c36166..716b618daa059b 100644 --- a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf62.groovy +++ b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf62.groovy @@ -1,37 +1,37 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -suite("ds_rf62") { - String db = context.config.getDbNameByFile(new File(context.file.parent)) - sql "use ${db}" - sql 'set enable_nereids_planner=true' - sql 'set enable_fallback_to_original_planner=false' - sql 'set exec_mem_limit=21G' - sql 'set be_number_for_test=3' - sql 'set parallel_fragment_exec_instance_num=8; ' - sql 'set parallel_pipeline_task_num=8; ' - sql 'set forbid_unknown_col_stats=true' - sql 'set broadcast_row_count_limit = 30000000' - sql 'set enable_nereids_timeout = false' - sql 'set enable_pipeline_engine=true' - String stmt = ''' - explain physical plan +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +suite("ds_rf62") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_fragment_exec_instance_num=8; ' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set broadcast_row_count_limit = 30000000' + sql 'set enable_nereids_timeout = false' + sql 'set enable_pipeline_engine=true' + String stmt = ''' + explain physical plan select substr(w_warehouse_name,1,20) ,sm_type @@ -64,26 +64,26 @@ order by substr(w_warehouse_name,1,20) ,sm_type ,web_name limit 100; - - ''' - String plan = sql "${stmt}" - println plan - def getRuntimeFilters = { plantree -> - { - def lst = [] - plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { - ch -> - { - lst.add(ch.replaceAll("#\\d+", '')) - } - } - return lst.join(',') - } - } - - // def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.62" - // File file = new File(outFile) - // file.write(getRuntimeFilters(plan)) - - assertEquals("RF3[w_warehouse_sk->[ws_warehouse_sk],RF2[sm_ship_mode_sk->[ws_ship_mode_sk],RF1[web_site_sk->[ws_web_site_sk],RF0[d_date_sk->[ws_ship_date_sk]", getRuntimeFilters(plan)) -} + + ''' + String plan = sql "${stmt}" + println plan + def getRuntimeFilters = { plantree -> + { + def lst = [] + plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { + ch -> + { + lst.add(ch.replaceAll("#\\d+", '')) + } + } + return lst.join(',') + } + } + + //def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.62" + //File file = new File(outFile) + //file.write(getRuntimeFilters(plan)) + + assertEquals("RF3[w_warehouse_sk->[ws_warehouse_sk],RF2[sm_ship_mode_sk->[ws_ship_mode_sk],RF1[web_site_sk->[ws_web_site_sk],RF0[d_date_sk->[ws_ship_date_sk]", getRuntimeFilters(plan)) +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf63.groovy b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf63.groovy index 55148d4a047351..18697740e6027c 100644 --- a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf63.groovy +++ b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf63.groovy @@ -1,37 +1,37 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -suite("ds_rf63") { - String db = context.config.getDbNameByFile(new File(context.file.parent)) - sql "use ${db}" - sql 'set enable_nereids_planner=true' - sql 'set enable_fallback_to_original_planner=false' - sql 'set exec_mem_limit=21G' - sql 'set be_number_for_test=3' - sql 'set parallel_fragment_exec_instance_num=8; ' - sql 'set parallel_pipeline_task_num=8; ' - sql 'set forbid_unknown_col_stats=true' - sql 'set broadcast_row_count_limit = 30000000' - sql 'set enable_nereids_timeout = false' - sql 'set enable_pipeline_engine=true' - String stmt = ''' - explain physical plan +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +suite("ds_rf63") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_fragment_exec_instance_num=8; ' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set broadcast_row_count_limit = 30000000' + sql 'set enable_nereids_timeout = false' + sql 'set enable_pipeline_engine=true' + String stmt = ''' + explain physical plan select * from (select i_manager_id ,sum(ss_sales_price) sum_sales @@ -58,26 +58,26 @@ order by i_manager_id ,avg_monthly_sales ,sum_sales limit 100; - - ''' - String plan = sql "${stmt}" - println plan - def getRuntimeFilters = { plantree -> - { - def lst = [] - plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { - ch -> - { - lst.add(ch.replaceAll("#\\d+", '')) - } - } - return lst.join(',') - } - } - - // def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.63" - // File file = new File(outFile) - // file.write(getRuntimeFilters(plan)) - - assertEquals("RF2[s_store_sk->[ss_store_sk],RF1[d_date_sk->[ss_sold_date_sk],RF0[i_item_sk->[ss_item_sk]", getRuntimeFilters(plan)) -} + + ''' + String plan = sql "${stmt}" + println plan + def getRuntimeFilters = { plantree -> + { + def lst = [] + plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { + ch -> + { + lst.add(ch.replaceAll("#\\d+", '')) + } + } + return lst.join(',') + } + } + + //def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.63" + //File file = new File(outFile) + //file.write(getRuntimeFilters(plan)) + + assertEquals("RF2[s_store_sk->[ss_store_sk],RF1[d_date_sk->[ss_sold_date_sk],RF0[i_item_sk->[ss_item_sk]", getRuntimeFilters(plan)) +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf64.groovy b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf64.groovy index 2542bf98e39934..9a92477ee238fe 100644 --- a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf64.groovy +++ b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf64.groovy @@ -167,9 +167,9 @@ order by cs1.product_name } } - // def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.64" - // File file = new File(outFile) - // file.write(getRuntimeFilters(plan)) + //def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.64" + //File file = new File(outFile) + //file.write(getRuntimeFilters(plan)) - //assertEquals("RF19[c_first_shipto_date_sk->[d_date_sk],RF18[c_current_addr_sk->[ca_address_sk],RF17[ss_item_sk->[cs_item_sk],RF15[cr_order_number->[cs_order_number],RF16[cr_item_sk->[cs_item_sk],RF14[hd_income_band_sk->[ib_income_band_sk],RF13[c_first_sales_date_sk->[d_date_sk],RF12[c_current_hdemo_sk->[hd_demo_sk],RF11[ss_promo_sk->[p_promo_sk],RF10[hd_income_band_sk->[ib_income_band_sk],RF8[ss_item_sk->[sr_item_sk],RF9[ss_ticket_number->[sr_ticket_number],RF7[c_current_cdemo_sk->[cd_demo_sk],RF6[ss_cdemo_sk->[cd_demo_sk],RF5[d_date_sk->[ss_sold_date_sk],RF4[hd_demo_sk->[ss_hdemo_sk],RF3[ss_customer_sk->[c_customer_sk],RF2[s_store_sk->[ss_store_sk],RF1[ca_address_sk->[ss_addr_sk],RF0[item_sk->[ss_item_sk]", getRuntimeFilters(plan)) + assertEquals("RF18[ss_item_sk->[sr_item_sk],RF19[ss_ticket_number->[sr_ticket_number],RF17[cs_item_sk->[ss_item_sk],RF16[ss_addr_sk->[ca_address_sk],RF15[ca_address_sk->[c_current_addr_sk],RF14[d_date_sk->[c_first_sales_date_sk],RF13[ss_cdemo_sk->[cd_demo_sk],RF12[c_current_cdemo_sk->[cd_demo_sk],RF11[ib_income_band_sk->[hd_income_band_sk],RF10[d_date_sk->[c_first_shipto_date_sk],RF9[hd_demo_sk->[c_current_hdemo_sk],RF8[ss_customer_sk->[c_customer_sk],RF7[s_store_sk->[ss_store_sk],RF6[ib_income_band_sk->[hd_income_band_sk],RF5[hd_demo_sk->[ss_hdemo_sk],RF4[p_promo_sk->[ss_promo_sk],RF3[d_date_sk->[ss_sold_date_sk],RF2[i_item_sk->[ss_item_sk],RF0[cr_order_number->[cs_order_number],RF1[cr_item_sk->[cs_item_sk]", getRuntimeFilters(plan)) } diff --git a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf65.groovy b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf65.groovy index ea0856c3030f93..7856c01a6e2702 100644 --- a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf65.groovy +++ b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf65.groovy @@ -1,37 +1,37 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -suite("ds_rf65") { - String db = context.config.getDbNameByFile(new File(context.file.parent)) - sql "use ${db}" - sql 'set enable_nereids_planner=true' - sql 'set enable_fallback_to_original_planner=false' - sql 'set exec_mem_limit=21G' - sql 'set be_number_for_test=3' - sql 'set parallel_fragment_exec_instance_num=8; ' - sql 'set parallel_pipeline_task_num=8; ' - sql 'set forbid_unknown_col_stats=true' - sql 'set broadcast_row_count_limit = 30000000' - sql 'set enable_nereids_timeout = false' - sql 'set enable_pipeline_engine=true' - String stmt = ''' - explain physical plan +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +suite("ds_rf65") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_fragment_exec_instance_num=8; ' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set broadcast_row_count_limit = 30000000' + sql 'set enable_nereids_timeout = false' + sql 'set enable_pipeline_engine=true' + String stmt = ''' + explain physical plan select s_store_name, i_item_desc, @@ -58,26 +58,26 @@ suite("ds_rf65") { i_item_sk = sc.ss_item_sk order by s_store_name, i_item_desc limit 100; - - ''' - String plan = sql "${stmt}" - println plan - def getRuntimeFilters = { plantree -> - { - def lst = [] - plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { - ch -> - { - lst.add(ch.replaceAll("#\\d+", '')) - } - } - return lst.join(',') - } - } - - // def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.65" - // File file = new File(outFile) - // file.write(getRuntimeFilters(plan)) - - assertEquals("RF4[s_store_sk->[ss_store_sk],RF3[i_item_sk->[ss_item_sk],RF2[ss_store_sk->[ss_store_sk],RF1[d_date_sk->[ss_sold_date_sk],RF0[d_date_sk->[ss_sold_date_sk]", getRuntimeFilters(plan)) -} + + ''' + String plan = sql "${stmt}" + println plan + def getRuntimeFilters = { plantree -> + { + def lst = [] + plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { + ch -> + { + lst.add(ch.replaceAll("#\\d+", '')) + } + } + return lst.join(',') + } + } + + //def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.65" + //File file = new File(outFile) + //file.write(getRuntimeFilters(plan)) + + assertEquals("RF4[s_store_sk->[ss_store_sk],RF3[i_item_sk->[ss_item_sk],RF2[ss_store_sk->[ss_store_sk],RF1[d_date_sk->[ss_sold_date_sk],RF0[d_date_sk->[ss_sold_date_sk]", getRuntimeFilters(plan)) +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf66.groovy b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf66.groovy index d6011f9c721e0a..c49827ceac0185 100644 --- a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf66.groovy +++ b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf66.groovy @@ -1,37 +1,37 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -suite("ds_rf66") { - String db = context.config.getDbNameByFile(new File(context.file.parent)) - sql "use ${db}" - sql 'set enable_nereids_planner=true' - sql 'set enable_fallback_to_original_planner=false' - sql 'set exec_mem_limit=21G' - sql 'set be_number_for_test=3' - sql 'set parallel_fragment_exec_instance_num=8; ' - sql 'set parallel_pipeline_task_num=8; ' - sql 'set forbid_unknown_col_stats=true' - sql 'set broadcast_row_count_limit = 30000000' - sql 'set enable_nereids_timeout = false' - sql 'set enable_pipeline_engine=true' - String stmt = ''' - explain physical plan +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +suite("ds_rf66") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_fragment_exec_instance_num=8; ' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set broadcast_row_count_limit = 30000000' + sql 'set enable_nereids_timeout = false' + sql 'set enable_pipeline_engine=true' + String stmt = ''' + explain physical plan select w_warehouse_name ,w_warehouse_sq_ft @@ -249,26 +249,26 @@ suite("ds_rf66") { ,year order by w_warehouse_name limit 100; - - ''' - String plan = sql "${stmt}" - println plan - def getRuntimeFilters = { plantree -> - { - def lst = [] - plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { - ch -> - { - lst.add(ch.replaceAll("#\\d+", '')) - } - } - return lst.join(',') - } - } - - // def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.66" - // File file = new File(outFile) - // file.write(getRuntimeFilters(plan)) - - assertEquals("RF3[w_warehouse_sk->[ws_warehouse_sk],RF2[t_time_sk->[ws_sold_time_sk],RF1[d_date_sk->[ws_sold_date_sk],RF0[sm_ship_mode_sk->[ws_ship_mode_sk],RF7[w_warehouse_sk->[cs_warehouse_sk],RF6[t_time_sk->[cs_sold_time_sk],RF5[d_date_sk->[cs_sold_date_sk],RF4[sm_ship_mode_sk->[cs_ship_mode_sk]", getRuntimeFilters(plan)) -} + + ''' + String plan = sql "${stmt}" + println plan + def getRuntimeFilters = { plantree -> + { + def lst = [] + plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { + ch -> + { + lst.add(ch.replaceAll("#\\d+", '')) + } + } + return lst.join(',') + } + } + + //def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.66" + //File file = new File(outFile) + //file.write(getRuntimeFilters(plan)) + + assertEquals("RF3[w_warehouse_sk->[ws_warehouse_sk],RF2[t_time_sk->[ws_sold_time_sk],RF1[d_date_sk->[ws_sold_date_sk],RF0[sm_ship_mode_sk->[ws_ship_mode_sk],RF7[w_warehouse_sk->[cs_warehouse_sk],RF6[t_time_sk->[cs_sold_time_sk],RF5[d_date_sk->[cs_sold_date_sk],RF4[sm_ship_mode_sk->[cs_ship_mode_sk]", getRuntimeFilters(plan)) +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf67.groovy b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf67.groovy index e3dd38c7391556..f63c37d66f2f26 100644 --- a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf67.groovy +++ b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf67.groovy @@ -1,37 +1,37 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -suite("ds_rf67") { - String db = context.config.getDbNameByFile(new File(context.file.parent)) - sql "use ${db}" - sql 'set enable_nereids_planner=true' - sql 'set enable_fallback_to_original_planner=false' - sql 'set exec_mem_limit=21G' - sql 'set be_number_for_test=3' - sql 'set parallel_fragment_exec_instance_num=8; ' - sql 'set parallel_pipeline_task_num=8; ' - sql 'set forbid_unknown_col_stats=true' - sql 'set broadcast_row_count_limit = 30000000' - sql 'set enable_nereids_timeout = false' - sql 'set enable_pipeline_engine=true' - String stmt = ''' - explain physical plan +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +suite("ds_rf67") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_fragment_exec_instance_num=8; ' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set broadcast_row_count_limit = 30000000' + sql 'set enable_nereids_timeout = false' + sql 'set enable_pipeline_engine=true' + String stmt = ''' + explain physical plan select * from (select i_category ,i_class @@ -73,26 +73,26 @@ order by i_category ,sumsales ,rk limit 100; - - ''' - String plan = sql "${stmt}" - println plan - def getRuntimeFilters = { plantree -> - { - def lst = [] - plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { - ch -> - { - lst.add(ch.replaceAll("#\\d+", '')) - } - } - return lst.join(',') - } - } - - // def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.67" - // File file = new File(outFile) - // file.write(getRuntimeFilters(plan)) - - assertEquals("RF2[s_store_sk->[ss_store_sk],RF1[i_item_sk->[ss_item_sk],RF0[d_date_sk->[ss_sold_date_sk]", getRuntimeFilters(plan)) -} + + ''' + String plan = sql "${stmt}" + println plan + def getRuntimeFilters = { plantree -> + { + def lst = [] + plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { + ch -> + { + lst.add(ch.replaceAll("#\\d+", '')) + } + } + return lst.join(',') + } + } + + //def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.67" + //File file = new File(outFile) + //file.write(getRuntimeFilters(plan)) + + assertEquals("RF2[s_store_sk->[ss_store_sk],RF1[i_item_sk->[ss_item_sk],RF0[d_date_sk->[ss_sold_date_sk]", getRuntimeFilters(plan)) +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf68.groovy b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf68.groovy index 6acaed55b9ba68..3d5a091859a85b 100644 --- a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf68.groovy +++ b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf68.groovy @@ -1,37 +1,37 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -suite("ds_rf68") { - String db = context.config.getDbNameByFile(new File(context.file.parent)) - sql "use ${db}" - sql 'set enable_nereids_planner=true' - sql 'set enable_fallback_to_original_planner=false' - sql 'set exec_mem_limit=21G' - sql 'set be_number_for_test=3' - sql 'set parallel_fragment_exec_instance_num=8; ' - sql 'set parallel_pipeline_task_num=8; ' - sql 'set forbid_unknown_col_stats=true' - sql 'set broadcast_row_count_limit = 30000000' - sql 'set enable_nereids_timeout = false' - sql 'set enable_pipeline_engine=true' - String stmt = ''' - explain physical plan +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +suite("ds_rf68") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_fragment_exec_instance_num=8; ' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set broadcast_row_count_limit = 30000000' + sql 'set enable_nereids_timeout = false' + sql 'set enable_pipeline_engine=true' + String stmt = ''' + explain physical plan select c_last_name ,c_first_name ,ca_city @@ -71,26 +71,26 @@ suite("ds_rf68") { order by c_last_name ,ss_ticket_number limit 100; - - ''' - String plan = sql "${stmt}" - println plan - def getRuntimeFilters = { plantree -> - { - def lst = [] - plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { - ch -> - { - lst.add(ch.replaceAll("#\\d+", '')) - } - } - return lst.join(',') - } - } - - // def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.68" - // File file = new File(outFile) - // file.write(getRuntimeFilters(plan)) - - assertEquals("RF5[c_current_addr_sk->[ca_address_sk],RF4[ss_customer_sk->[c_customer_sk],RF3[ss_addr_sk->[ca_address_sk],RF2[hd_demo_sk->[ss_hdemo_sk],RF1[s_store_sk->[ss_store_sk],RF0[d_date_sk->[ss_sold_date_sk]", getRuntimeFilters(plan)) -} + + ''' + String plan = sql "${stmt}" + println plan + def getRuntimeFilters = { plantree -> + { + def lst = [] + plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { + ch -> + { + lst.add(ch.replaceAll("#\\d+", '')) + } + } + return lst.join(',') + } + } + + //def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.68" + //File file = new File(outFile) + //file.write(getRuntimeFilters(plan)) + + assertEquals("RF5[c_current_addr_sk->[ca_address_sk],RF4[ss_customer_sk->[c_customer_sk],RF3[ss_addr_sk->[ca_address_sk],RF2[hd_demo_sk->[ss_hdemo_sk],RF1[s_store_sk->[ss_store_sk],RF0[d_date_sk->[ss_sold_date_sk]", getRuntimeFilters(plan)) +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf69.groovy b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf69.groovy index b6990127826b80..4635a7f79f0d01 100644 --- a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf69.groovy +++ b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf69.groovy @@ -1,37 +1,37 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -suite("ds_rf69") { - String db = context.config.getDbNameByFile(new File(context.file.parent)) - sql "use ${db}" - sql 'set enable_nereids_planner=true' - sql 'set enable_fallback_to_original_planner=false' - sql 'set exec_mem_limit=21G' - sql 'set be_number_for_test=3' - sql 'set parallel_fragment_exec_instance_num=8; ' - sql 'set parallel_pipeline_task_num=8; ' - sql 'set forbid_unknown_col_stats=true' - sql 'set broadcast_row_count_limit = 30000000' - sql 'set enable_nereids_timeout = false' - sql 'set enable_pipeline_engine=true' - String stmt = ''' - explain physical plan +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +suite("ds_rf69") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_fragment_exec_instance_num=8; ' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set broadcast_row_count_limit = 30000000' + sql 'set enable_nereids_timeout = false' + sql 'set enable_pipeline_engine=true' + String stmt = ''' + explain physical plan select cd_gender, cd_marital_status, @@ -76,26 +76,26 @@ suite("ds_rf69") { cd_purchase_estimate, cd_credit_rating limit 100; - - ''' - String plan = sql "${stmt}" - println plan - def getRuntimeFilters = { plantree -> - { - def lst = [] - plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { - ch -> - { - lst.add(ch.replaceAll("#\\d+", '')) - } - } - return lst.join(',') - } - } - - // def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.69" - // File file = new File(outFile) - // file.write(getRuntimeFilters(plan)) - - assertEquals("RF7[c_customer_sk->[ss_customer_sk],RF6[d_date_sk->[ss_sold_date_sk],RF5[c_customer_sk->[cs_ship_customer_sk],RF4[d_date_sk->[cs_sold_date_sk],RF3[c_current_cdemo_sk->[cd_demo_sk],RF2[c_customer_sk->[ws_bill_customer_sk],RF1[d_date_sk->[ws_sold_date_sk],RF0[ca_address_sk->[c_current_addr_sk]", getRuntimeFilters(plan)) -} + + ''' + String plan = sql "${stmt}" + println plan + def getRuntimeFilters = { plantree -> + { + def lst = [] + plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { + ch -> + { + lst.add(ch.replaceAll("#\\d+", '')) + } + } + return lst.join(',') + } + } + + //def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.69" + //File file = new File(outFile) + //file.write(getRuntimeFilters(plan)) + + assertEquals("RF7[c_customer_sk->[ss_customer_sk],RF6[d_date_sk->[ss_sold_date_sk],RF5[c_customer_sk->[cs_ship_customer_sk],RF4[d_date_sk->[cs_sold_date_sk],RF3[c_current_cdemo_sk->[cd_demo_sk],RF2[c_customer_sk->[ws_bill_customer_sk],RF1[d_date_sk->[ws_sold_date_sk],RF0[ca_address_sk->[c_current_addr_sk]", getRuntimeFilters(plan)) +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf7.groovy b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf7.groovy index 4df10c25ea7058..988cb6222cc732 100644 --- a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf7.groovy +++ b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf7.groovy @@ -1,37 +1,37 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -suite("ds_rf7") { - String db = context.config.getDbNameByFile(new File(context.file.parent)) - sql "use ${db}" - sql 'set enable_nereids_planner=true' - sql 'set enable_fallback_to_original_planner=false' - sql 'set exec_mem_limit=21G' - sql 'set be_number_for_test=3' - sql 'set parallel_fragment_exec_instance_num=8; ' - sql 'set parallel_pipeline_task_num=8; ' - sql 'set forbid_unknown_col_stats=true' - sql 'set broadcast_row_count_limit = 30000000' - sql 'set enable_nereids_timeout = false' - sql 'set enable_pipeline_engine=true' - String stmt = ''' - explain physical plan +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +suite("ds_rf7") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_fragment_exec_instance_num=8; ' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set broadcast_row_count_limit = 30000000' + sql 'set enable_nereids_timeout = false' + sql 'set enable_pipeline_engine=true' + String stmt = ''' + explain physical plan select i_item_id, avg(ss_quantity) agg1, avg(ss_list_price) agg2, @@ -50,26 +50,26 @@ suite("ds_rf7") { group by i_item_id order by i_item_id limit 100; - - ''' - String plan = sql "${stmt}" - println plan - def getRuntimeFilters = { plantree -> - { - def lst = [] - plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { - ch -> - { - lst.add(ch.replaceAll("#\\d+", '')) - } - } - return lst.join(',') - } - } - - // def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.7" - // File file = new File(outFile) - // file.write(getRuntimeFilters(plan)) - - assertEquals("RF3[i_item_sk->[ss_item_sk],RF2[p_promo_sk->[ss_promo_sk],RF1[d_date_sk->[ss_sold_date_sk],RF0[cd_demo_sk->[ss_cdemo_sk]", getRuntimeFilters(plan)) -} + + ''' + String plan = sql "${stmt}" + println plan + def getRuntimeFilters = { plantree -> + { + def lst = [] + plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { + ch -> + { + lst.add(ch.replaceAll("#\\d+", '')) + } + } + return lst.join(',') + } + } + + //def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.7" + //File file = new File(outFile) + //file.write(getRuntimeFilters(plan)) + + assertEquals("RF3[i_item_sk->[ss_item_sk],RF2[p_promo_sk->[ss_promo_sk],RF1[d_date_sk->[ss_sold_date_sk],RF0[cd_demo_sk->[ss_cdemo_sk]", getRuntimeFilters(plan)) +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf70.groovy b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf70.groovy index f0e55374d3f76c..e7b8268ec16c29 100644 --- a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf70.groovy +++ b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf70.groovy @@ -1,37 +1,37 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -suite("ds_rf70") { - String db = context.config.getDbNameByFile(new File(context.file.parent)) - sql "use ${db}" - sql 'set enable_nereids_planner=true' - sql 'set enable_fallback_to_original_planner=false' - sql 'set exec_mem_limit=21G' - sql 'set be_number_for_test=3' - sql 'set parallel_fragment_exec_instance_num=8; ' - sql 'set parallel_pipeline_task_num=8; ' - sql 'set forbid_unknown_col_stats=true' - sql 'set broadcast_row_count_limit = 30000000' - sql 'set enable_nereids_timeout = false' - sql 'set enable_pipeline_engine=true' - String stmt = ''' - explain physical plan +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +suite("ds_rf70") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_fragment_exec_instance_num=8; ' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set broadcast_row_count_limit = 30000000' + sql 'set enable_nereids_timeout = false' + sql 'set enable_pipeline_engine=true' + String stmt = ''' + explain physical plan select sum(ss_net_profit) as total_sum ,s_state @@ -67,26 +67,26 @@ suite("ds_rf70") { ,case when lochierarchy = 0 then s_state end ,rank_within_parent limit 100; - - ''' - String plan = sql "${stmt}" - println plan - def getRuntimeFilters = { plantree -> - { - def lst = [] - plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { - ch -> - { - lst.add(ch.replaceAll("#\\d+", '')) - } - } - return lst.join(',') - } - } - - // def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.70" - // File file = new File(outFile) - // file.write(getRuntimeFilters(plan)) - - assertEquals("RF4[s_store_sk->[ss_store_sk],RF3[d_date_sk->[ss_sold_date_sk],RF2[s_state->[s_state],RF1[s_store_sk->[ss_store_sk],RF0[d_date_sk->[ss_sold_date_sk]", getRuntimeFilters(plan)) -} + + ''' + String plan = sql "${stmt}" + println plan + def getRuntimeFilters = { plantree -> + { + def lst = [] + plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { + ch -> + { + lst.add(ch.replaceAll("#\\d+", '')) + } + } + return lst.join(',') + } + } + + //def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.70" + //File file = new File(outFile) + //file.write(getRuntimeFilters(plan)) + + assertEquals("RF4[s_store_sk->[ss_store_sk],RF3[d_date_sk->[ss_sold_date_sk],RF2[s_state->[s_state],RF1[s_store_sk->[ss_store_sk],RF0[d_date_sk->[ss_sold_date_sk]", getRuntimeFilters(plan)) +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf71.groovy b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf71.groovy index 27b946f62112ff..77c09db07a43be 100644 --- a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf71.groovy +++ b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf71.groovy @@ -1,37 +1,37 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -suite("ds_rf71") { - String db = context.config.getDbNameByFile(new File(context.file.parent)) - sql "use ${db}" - sql 'set enable_nereids_planner=true' - sql 'set enable_fallback_to_original_planner=false' - sql 'set exec_mem_limit=21G' - sql 'set be_number_for_test=3' - sql 'set parallel_fragment_exec_instance_num=8; ' - sql 'set parallel_pipeline_task_num=8; ' - sql 'set forbid_unknown_col_stats=true' - sql 'set broadcast_row_count_limit = 30000000' - sql 'set enable_nereids_timeout = false' - sql 'set enable_pipeline_engine=true' - String stmt = ''' - explain physical plan +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +suite("ds_rf71") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_fragment_exec_instance_num=8; ' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set broadcast_row_count_limit = 30000000' + sql 'set enable_nereids_timeout = false' + sql 'set enable_pipeline_engine=true' + String stmt = ''' + explain physical plan select i_brand_id brand_id, i_brand brand,t_hour,t_minute, sum(ext_price) ext_price from item, (select ws_ext_sales_price as ext_price, @@ -69,26 +69,26 @@ suite("ds_rf71") { group by i_brand, i_brand_id,t_hour,t_minute order by ext_price desc, i_brand_id ; - - ''' - String plan = sql "${stmt}" - println plan - def getRuntimeFilters = { plantree -> - { - def lst = [] - plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { - ch -> - { - lst.add(ch.replaceAll("#\\d+", '')) - } - } - return lst.join(',') - } - } - - // def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.71" - // File file = new File(outFile) - // file.write(getRuntimeFilters(plan)) - - assertEquals("RF0[d_date_sk->[ws_sold_date_sk],RF1[d_date_sk->[cs_sold_date_sk],RF2[d_date_sk->[ss_sold_date_sk]", getRuntimeFilters(plan)) -} + + ''' + String plan = sql "${stmt}" + println plan + def getRuntimeFilters = { plantree -> + { + def lst = [] + plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { + ch -> + { + lst.add(ch.replaceAll("#\\d+", '')) + } + } + return lst.join(',') + } + } + + //def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.71" + //File file = new File(outFile) + //file.write(getRuntimeFilters(plan)) + + assertEquals("RF0[d_date_sk->[ws_sold_date_sk],RF1[d_date_sk->[cs_sold_date_sk],RF2[d_date_sk->[ss_sold_date_sk]", getRuntimeFilters(plan)) +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf72.groovy b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf72.groovy index 2ce7b3f61e1153..58948f3bfb5e1c 100644 --- a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf72.groovy +++ b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf72.groovy @@ -1,83 +1,83 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -suite("ds_rf72") { - String db = context.config.getDbNameByFile(new File(context.file.parent)) - sql "use ${db}" - sql 'set enable_nereids_planner=true' - sql 'set enable_fallback_to_original_planner=false' - sql 'set exec_mem_limit=21G' - sql 'set be_number_for_test=3' - sql 'set parallel_fragment_exec_instance_num=8; ' - sql 'set parallel_pipeline_task_num=8; ' - sql 'set forbid_unknown_col_stats=true' - sql 'set broadcast_row_count_limit = 30000000' - sql 'set enable_nereids_timeout = false' - sql 'set enable_pipeline_engine=true' - String stmt = ''' - explain physical plan - select i_item_desc - ,w_warehouse_name - ,d1.d_week_seq - ,sum(case when p_promo_sk is null then 1 else 0 end) no_promo - ,sum(case when p_promo_sk is not null then 1 else 0 end) promo - ,count(*) total_cnt -from catalog_sales -join inventory on (cs_item_sk = inv_item_sk) -join warehouse on (w_warehouse_sk=inv_warehouse_sk) -join item on (i_item_sk = cs_item_sk) -join customer_demographics on (cs_bill_cdemo_sk = cd_demo_sk) -join household_demographics on (cs_bill_hdemo_sk = hd_demo_sk) -join date_dim d1 on (cs_sold_date_sk = d1.d_date_sk) -join date_dim d2 on (inv_date_sk = d2.d_date_sk) -join date_dim d3 on (cs_ship_date_sk = d3.d_date_sk) -left outer join promotion on (cs_promo_sk=p_promo_sk) -left outer join catalog_returns on (cr_item_sk = cs_item_sk and cr_order_number = cs_order_number) -where d1.d_week_seq = d2.d_week_seq - and inv_quantity_on_hand < cs_quantity - and (d3.d_date > (d1.d_date + INTERVAL '5' DAY)) - and hd_buy_potential = '501-1000' - and d1.d_year = 2002 - and cd_marital_status = 'W' -group by i_item_desc,w_warehouse_name,d1.d_week_seq -order by total_cnt desc, i_item_desc, w_warehouse_name, d_week_seq -limit 100; - - ''' - String plan = sql "${stmt}" - println plan - def getRuntimeFilters = { plantree -> - { - def lst = [] - plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { - ch -> - { - lst.add(ch.replaceAll("#\\d+", '')) - } - } - return lst.join(',') - } - } - - // def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.72" - // File file = new File(outFile) - // file.write(getRuntimeFilters(plan)) - - assertEquals("RF8[w_warehouse_sk->[inv_warehouse_sk],RF6[d_date_sk->[inv_date_sk],RF7[cs_item_sk->[inv_item_sk],RF5[d_week_seq->[d_week_seq],RF4[i_item_sk->[cs_item_sk],RF3[d_date_sk->[cs_ship_date_sk],RF2[cd_demo_sk->[cs_bill_cdemo_sk],RF1[d_date_sk->[cs_sold_date_sk],RF0[hd_demo_sk->[cs_bill_hdemo_sk]", getRuntimeFilters(plan)) -} +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +suite("ds_rf72") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_fragment_exec_instance_num=8; ' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set broadcast_row_count_limit = 30000000' + sql 'set enable_nereids_timeout = false' + sql 'set enable_pipeline_engine=true' + String stmt = ''' + explain physical plan + select i_item_desc + ,w_warehouse_name + ,d1.d_week_seq + ,sum(case when p_promo_sk is null then 1 else 0 end) no_promo + ,sum(case when p_promo_sk is not null then 1 else 0 end) promo + ,count(*) total_cnt + from catalog_sales + join inventory on (cs_item_sk = inv_item_sk) + join warehouse on (w_warehouse_sk=inv_warehouse_sk) + join item on (i_item_sk = cs_item_sk) + join customer_demographics on (cs_bill_cdemo_sk = cd_demo_sk) + join household_demographics on (cs_bill_hdemo_sk = hd_demo_sk) + join date_dim d1 on (cs_sold_date_sk = d1.d_date_sk) + join date_dim d2 on (inv_date_sk = d2.d_date_sk) + join date_dim d3 on (cs_ship_date_sk = d3.d_date_sk) + left outer join promotion on (cs_promo_sk=p_promo_sk) + left outer join catalog_returns on (cr_item_sk = cs_item_sk and cr_order_number = cs_order_number) + where d1.d_week_seq = d2.d_week_seq + and inv_quantity_on_hand < cs_quantity + and (d3.d_date > (d1.d_date + INTERVAL '5' DAY)) + and hd_buy_potential = '501-1000' + and d1.d_year = 2002 + and cd_marital_status = 'W' + group by i_item_desc,w_warehouse_name,d1.d_week_seq + order by total_cnt desc, i_item_desc, w_warehouse_name, d_week_seq + limit 100; + + ''' + String plan = sql "${stmt}" + println plan + def getRuntimeFilters = { plantree -> + { + def lst = [] + plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { + ch -> + { + lst.add(ch.replaceAll("#\\d+", '')) + } + } + return lst.join(',') + } + } + + //def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.72" + //File file = new File(outFile) + //file.write(getRuntimeFilters(plan)) + + assertEquals("RF9[cs_item_sk->[cr_item_sk],RF10[cs_order_number->[cr_order_number],RF8[w_warehouse_sk->[inv_warehouse_sk],RF7[cs_item_sk->[i_item_sk],RF5[d_date_sk->[inv_date_sk],RF6[cs_item_sk->[inv_item_sk],RF4[d_week_seq->[d_week_seq],RF3[d_date_sk->[cs_ship_date_sk],RF2[cd_demo_sk->[cs_bill_cdemo_sk],RF1[d_date_sk->[cs_sold_date_sk],RF0[hd_demo_sk->[cs_bill_hdemo_sk]", getRuntimeFilters(plan)) +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf73.groovy b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf73.groovy index ae91db3b06afac..6f4483b6477af8 100644 --- a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf73.groovy +++ b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf73.groovy @@ -1,37 +1,37 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -suite("ds_rf73") { - String db = context.config.getDbNameByFile(new File(context.file.parent)) - sql "use ${db}" - sql 'set enable_nereids_planner=true' - sql 'set enable_fallback_to_original_planner=false' - sql 'set exec_mem_limit=21G' - sql 'set be_number_for_test=3' - sql 'set parallel_fragment_exec_instance_num=8; ' - sql 'set parallel_pipeline_task_num=8; ' - sql 'set forbid_unknown_col_stats=true' - sql 'set broadcast_row_count_limit = 30000000' - sql 'set enable_nereids_timeout = false' - sql 'set enable_pipeline_engine=true' - String stmt = ''' - explain physical plan +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +suite("ds_rf73") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_fragment_exec_instance_num=8; ' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set broadcast_row_count_limit = 30000000' + sql 'set enable_nereids_timeout = false' + sql 'set enable_pipeline_engine=true' + String stmt = ''' + explain physical plan select c_last_name ,c_first_name ,c_salutation @@ -57,26 +57,26 @@ suite("ds_rf73") { where ss_customer_sk = c_customer_sk and cnt between 1 and 5 order by cnt desc, c_last_name asc; - - ''' - String plan = sql "${stmt}" - println plan - def getRuntimeFilters = { plantree -> - { - def lst = [] - plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { - ch -> - { - lst.add(ch.replaceAll("#\\d+", '')) - } - } - return lst.join(',') - } - } - - // def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.73" - // File file = new File(outFile) - // file.write(getRuntimeFilters(plan)) - - assertEquals("RF3[ss_customer_sk->[c_customer_sk],RF2[s_store_sk->[ss_store_sk],RF1[hd_demo_sk->[ss_hdemo_sk],RF0[d_date_sk->[ss_sold_date_sk]", getRuntimeFilters(plan)) -} + + ''' + String plan = sql "${stmt}" + println plan + def getRuntimeFilters = { plantree -> + { + def lst = [] + plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { + ch -> + { + lst.add(ch.replaceAll("#\\d+", '')) + } + } + return lst.join(',') + } + } + + //def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.73" + //File file = new File(outFile) + //file.write(getRuntimeFilters(plan)) + + assertEquals("RF3[ss_customer_sk->[c_customer_sk],RF2[s_store_sk->[ss_store_sk],RF1[hd_demo_sk->[ss_hdemo_sk],RF0[d_date_sk->[ss_sold_date_sk]", getRuntimeFilters(plan)) +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf74.groovy b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf74.groovy index 3d07c889d9565e..5c1ed392d999df 100644 --- a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf74.groovy +++ b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf74.groovy @@ -1,37 +1,37 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -suite("ds_rf74") { - String db = context.config.getDbNameByFile(new File(context.file.parent)) - sql "use ${db}" - sql 'set enable_nereids_planner=true' - sql 'set enable_fallback_to_original_planner=false' - sql 'set exec_mem_limit=21G' - sql 'set be_number_for_test=3' - sql 'set parallel_fragment_exec_instance_num=8; ' - sql 'set parallel_pipeline_task_num=8; ' - sql 'set forbid_unknown_col_stats=true' - sql 'set broadcast_row_count_limit = 30000000' - sql 'set enable_nereids_timeout = false' - sql 'set enable_pipeline_engine=true' - String stmt = ''' - explain physical plan +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +suite("ds_rf74") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_fragment_exec_instance_num=8; ' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set broadcast_row_count_limit = 30000000' + sql 'set enable_nereids_timeout = false' + sql 'set enable_pipeline_engine=true' + String stmt = ''' + explain physical plan with year_total as ( select c_customer_id customer_id ,c_first_name customer_first_name @@ -90,26 +90,26 @@ suite("ds_rf74") { > case when t_s_firstyear.year_total > 0 then t_s_secyear.year_total / t_s_firstyear.year_total else null end order by 2,1,3 limit 100; - - ''' - String plan = sql "${stmt}" - println plan - def getRuntimeFilters = { plantree -> - { - def lst = [] - plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { - ch -> - { - lst.add(ch.replaceAll("#\\d+", '')) - } - } - return lst.join(',') - } - } - - // def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.74" - // File file = new File(outFile) - // file.write(getRuntimeFilters(plan)) - - assertEquals("RF1[c_customer_sk->[ss_customer_sk],RF0[d_date_sk->[ss_sold_date_sk],RF3[c_customer_sk->[ws_bill_customer_sk],RF2[d_date_sk->[ws_sold_date_sk]", getRuntimeFilters(plan)) -} + + ''' + String plan = sql "${stmt}" + println plan + def getRuntimeFilters = { plantree -> + { + def lst = [] + plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { + ch -> + { + lst.add(ch.replaceAll("#\\d+", '')) + } + } + return lst.join(',') + } + } + + //def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.74" + //File file = new File(outFile) + //file.write(getRuntimeFilters(plan)) + + assertEquals("RF1[c_customer_sk->[ss_customer_sk],RF0[d_date_sk->[ss_sold_date_sk],RF3[c_customer_sk->[ws_bill_customer_sk],RF2[d_date_sk->[ws_sold_date_sk]", getRuntimeFilters(plan)) +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf75.groovy b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf75.groovy index eb6fe5390fb634..99e28f875743b0 100644 --- a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf75.groovy +++ b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf75.groovy @@ -1,37 +1,37 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -suite("ds_rf75") { - String db = context.config.getDbNameByFile(new File(context.file.parent)) - sql "use ${db}" - sql 'set enable_nereids_planner=true' - sql 'set enable_fallback_to_original_planner=false' - sql 'set exec_mem_limit=21G' - sql 'set be_number_for_test=3' - sql 'set parallel_fragment_exec_instance_num=8; ' - sql 'set parallel_pipeline_task_num=8; ' - sql 'set forbid_unknown_col_stats=true' - sql 'set broadcast_row_count_limit = 30000000' - sql 'set enable_nereids_timeout = false' - sql 'set enable_pipeline_engine=true' - String stmt = ''' - explain physical plan +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +suite("ds_rf75") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_fragment_exec_instance_num=8; ' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set broadcast_row_count_limit = 30000000' + sql 'set enable_nereids_timeout = false' + sql 'set enable_pipeline_engine=true' + String stmt = ''' + explain physical plan WITH all_sales AS ( SELECT d_year ,i_brand_id @@ -99,26 +99,26 @@ suite("ds_rf75") { AND CAST(curr_yr.sales_cnt AS DECIMAL(17,2))/CAST(prev_yr.sales_cnt AS DECIMAL(17,2))<0.9 ORDER BY sales_cnt_diff,sales_amt_diff limit 100; - - ''' - String plan = sql "${stmt}" - println plan - def getRuntimeFilters = { plantree -> - { - def lst = [] - plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { - ch -> - { - lst.add(ch.replaceAll("#\\d+", '')) - } - } - return lst.join(',') - } - } - - // def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.75" - // File file = new File(outFile) - // file.write(getRuntimeFilters(plan)) - - assertEquals("RF2[cs_order_number->[cr_order_number],RF3[cs_item_sk->[cr_item_sk],RF1[d_date_sk->[cs_sold_date_sk],RF0[i_item_sk->[cs_item_sk],RF6[ss_ticket_number->[sr_ticket_number],RF7[ss_item_sk->[sr_item_sk],RF5[d_date_sk->[ss_sold_date_sk],RF4[i_item_sk->[ss_item_sk],RF10[ws_order_number->[wr_order_number],RF11[ws_item_sk->[wr_item_sk],RF9[d_date_sk->[ws_sold_date_sk],RF8[i_item_sk->[ws_item_sk]", getRuntimeFilters(plan)) -} + + ''' + String plan = sql "${stmt}" + println plan + def getRuntimeFilters = { plantree -> + { + def lst = [] + plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { + ch -> + { + lst.add(ch.replaceAll("#\\d+", '')) + } + } + return lst.join(',') + } + } + + //def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.75" + //File file = new File(outFile) + //file.write(getRuntimeFilters(plan)) + + assertEquals("RF2[cs_order_number->[cr_order_number],RF3[cs_item_sk->[cr_item_sk],RF1[d_date_sk->[cs_sold_date_sk],RF0[i_item_sk->[cs_item_sk],RF6[ss_ticket_number->[sr_ticket_number],RF7[ss_item_sk->[sr_item_sk],RF5[d_date_sk->[ss_sold_date_sk],RF4[i_item_sk->[ss_item_sk],RF10[ws_order_number->[wr_order_number],RF11[ws_item_sk->[wr_item_sk],RF9[d_date_sk->[ws_sold_date_sk],RF8[i_item_sk->[ws_item_sk]", getRuntimeFilters(plan)) +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf76.groovy b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf76.groovy index e34cdeb7c32f4c..22267b69c27914 100644 --- a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf76.groovy +++ b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf76.groovy @@ -1,37 +1,37 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -suite("ds_rf76") { - String db = context.config.getDbNameByFile(new File(context.file.parent)) - sql "use ${db}" - sql 'set enable_nereids_planner=true' - sql 'set enable_fallback_to_original_planner=false' - sql 'set exec_mem_limit=21G' - sql 'set be_number_for_test=3' - sql 'set parallel_fragment_exec_instance_num=8; ' - sql 'set parallel_pipeline_task_num=8; ' - sql 'set forbid_unknown_col_stats=true' - sql 'set broadcast_row_count_limit = 30000000' - sql 'set enable_nereids_timeout = false' - sql 'set enable_pipeline_engine=true' - String stmt = ''' - explain physical plan +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +suite("ds_rf76") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_fragment_exec_instance_num=8; ' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set broadcast_row_count_limit = 30000000' + sql 'set enable_nereids_timeout = false' + sql 'set enable_pipeline_engine=true' + String stmt = ''' + explain physical plan select channel, col_name, d_year, d_qoy, i_category, COUNT(*) sales_cnt, SUM(ext_sales_price) sales_amt FROM ( SELECT 'store' as channel, 'ss_hdemo_sk' col_name, d_year, d_qoy, i_category, ss_ext_sales_price ext_sales_price FROM store_sales, item, date_dim @@ -53,26 +53,26 @@ suite("ds_rf76") { GROUP BY channel, col_name, d_year, d_qoy, i_category ORDER BY channel, col_name, d_year, d_qoy, i_category limit 100; - - ''' - String plan = sql "${stmt}" - println plan - def getRuntimeFilters = { plantree -> - { - def lst = [] - plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { - ch -> - { - lst.add(ch.replaceAll("#\\d+", '')) - } - } - return lst.join(',') - } - } - - // def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.76" - // File file = new File(outFile) - // file.write(getRuntimeFilters(plan)) - - assertEquals("RF1[d_date_sk->[ss_sold_date_sk],RF0[i_item_sk->[ss_item_sk],RF3[d_date_sk->[ws_sold_date_sk],RF2[i_item_sk->[ws_item_sk],RF5[d_date_sk->[cs_sold_date_sk],RF4[i_item_sk->[cs_item_sk]", getRuntimeFilters(plan)) -} + + ''' + String plan = sql "${stmt}" + println plan + def getRuntimeFilters = { plantree -> + { + def lst = [] + plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { + ch -> + { + lst.add(ch.replaceAll("#\\d+", '')) + } + } + return lst.join(',') + } + } + + //def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.76" + //File file = new File(outFile) + //file.write(getRuntimeFilters(plan)) + + assertEquals("RF1[d_date_sk->[ss_sold_date_sk],RF0[i_item_sk->[ss_item_sk],RF3[d_date_sk->[ws_sold_date_sk],RF2[i_item_sk->[ws_item_sk],RF5[d_date_sk->[cs_sold_date_sk],RF4[i_item_sk->[cs_item_sk]", getRuntimeFilters(plan)) +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf77.groovy b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf77.groovy index b7e8d8fca1c4d4..16b62ea502d583 100644 --- a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf77.groovy +++ b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf77.groovy @@ -1,37 +1,37 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -suite("ds_rf77") { - String db = context.config.getDbNameByFile(new File(context.file.parent)) - sql "use ${db}" - sql 'set enable_nereids_planner=true' - sql 'set enable_fallback_to_original_planner=false' - sql 'set exec_mem_limit=21G' - sql 'set be_number_for_test=3' - sql 'set parallel_fragment_exec_instance_num=8; ' - sql 'set parallel_pipeline_task_num=8; ' - sql 'set forbid_unknown_col_stats=true' - sql 'set broadcast_row_count_limit = 30000000' - sql 'set enable_nereids_timeout = false' - sql 'set enable_pipeline_engine=true' - String stmt = ''' - explain physical plan +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +suite("ds_rf77") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_fragment_exec_instance_num=8; ' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set broadcast_row_count_limit = 30000000' + sql 'set enable_nereids_timeout = false' + sql 'set enable_pipeline_engine=true' + String stmt = ''' + explain physical plan with ss as (select s_store_sk, sum(ss_ext_sales_price) as sales, @@ -137,26 +137,26 @@ suite("ds_rf77") { order by channel ,id limit 100; - - ''' - String plan = sql "${stmt}" - println plan - def getRuntimeFilters = { plantree -> - { - def lst = [] - plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { - ch -> - { - lst.add(ch.replaceAll("#\\d+", '')) - } - } - return lst.join(',') - } - } - - // def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.77" - // File file = new File(outFile) - // file.write(getRuntimeFilters(plan)) - - assertEquals("RF3[s_store_sk->[ss_store_sk],RF2[d_date_sk->[ss_sold_date_sk],RF1[s_store_sk->[sr_store_sk],RF0[d_date_sk->[sr_returned_date_sk],RF5[d_date_sk->[cs_sold_date_sk],RF4[d_date_sk->[cr_returned_date_sk],RF9[wp_web_page_sk->[ws_web_page_sk],RF8[d_date_sk->[ws_sold_date_sk],RF7[wp_web_page_sk->[wr_web_page_sk],RF6[d_date_sk->[wr_returned_date_sk]", getRuntimeFilters(plan)) -} + + ''' + String plan = sql "${stmt}" + println plan + def getRuntimeFilters = { plantree -> + { + def lst = [] + plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { + ch -> + { + lst.add(ch.replaceAll("#\\d+", '')) + } + } + return lst.join(',') + } + } + + //def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.77" + //File file = new File(outFile) + //file.write(getRuntimeFilters(plan)) + + assertEquals("RF3[s_store_sk->[ss_store_sk],RF2[d_date_sk->[ss_sold_date_sk],RF1[s_store_sk->[sr_store_sk],RF0[d_date_sk->[sr_returned_date_sk],RF5[d_date_sk->[cs_sold_date_sk],RF4[d_date_sk->[cr_returned_date_sk],RF9[wp_web_page_sk->[ws_web_page_sk],RF8[d_date_sk->[ws_sold_date_sk],RF7[wp_web_page_sk->[wr_web_page_sk],RF6[d_date_sk->[wr_returned_date_sk]", getRuntimeFilters(plan)) +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf78.groovy b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf78.groovy index eece3c74cf1cc9..ff672d6ce35be8 100644 --- a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf78.groovy +++ b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf78.groovy @@ -1,37 +1,37 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -suite("ds_rf78") { - String db = context.config.getDbNameByFile(new File(context.file.parent)) - sql "use ${db}" - sql 'set enable_nereids_planner=true' - sql 'set enable_fallback_to_original_planner=false' - sql 'set exec_mem_limit=21G' - sql 'set be_number_for_test=3' - sql 'set parallel_fragment_exec_instance_num=8; ' - sql 'set parallel_pipeline_task_num=8; ' - sql 'set forbid_unknown_col_stats=true' - sql 'set broadcast_row_count_limit = 30000000' - sql 'set enable_nereids_timeout = false' - sql 'set enable_pipeline_engine=true' - String stmt = ''' - explain physical plan +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +suite("ds_rf78") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_fragment_exec_instance_num=8; ' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set broadcast_row_count_limit = 30000000' + sql 'set enable_nereids_timeout = false' + sql 'set enable_pipeline_engine=true' + String stmt = ''' + explain physical plan with ws as (select d_year AS ws_sold_year, ws_item_sk, ws_bill_customer_sk ws_customer_sk, @@ -87,26 +87,26 @@ order by other_chan_sales_price, ratio limit 100; - - ''' - String plan = sql "${stmt}" - println plan - def getRuntimeFilters = { plantree -> - { - def lst = [] - plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { - ch -> - { - lst.add(ch.replaceAll("#\\d+", '')) - } - } - return lst.join(',') - } - } - - // def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.78" - // File file = new File(outFile) - // file.write(getRuntimeFilters(plan)) - - assertEquals("RF2[d_date_sk->[ss_sold_date_sk],RF1[d_date_sk->[ws_sold_date_sk],RF0[d_date_sk->[cs_sold_date_sk]", getRuntimeFilters(plan)) -} + + ''' + String plan = sql "${stmt}" + println plan + def getRuntimeFilters = { plantree -> + { + def lst = [] + plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { + ch -> + { + lst.add(ch.replaceAll("#\\d+", '')) + } + } + return lst.join(',') + } + } + + //def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.78" + //File file = new File(outFile) + //file.write(getRuntimeFilters(plan)) + + assertEquals("RF2[d_date_sk->[ss_sold_date_sk],RF1[d_date_sk->[ws_sold_date_sk],RF0[d_date_sk->[cs_sold_date_sk]", getRuntimeFilters(plan)) +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf79.groovy b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf79.groovy index bc8dd97eed0803..ba4a2b3c46fb2a 100644 --- a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf79.groovy +++ b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf79.groovy @@ -1,37 +1,37 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -suite("ds_rf79") { - String db = context.config.getDbNameByFile(new File(context.file.parent)) - sql "use ${db}" - sql 'set enable_nereids_planner=true' - sql 'set enable_fallback_to_original_planner=false' - sql 'set exec_mem_limit=21G' - sql 'set be_number_for_test=3' - sql 'set parallel_fragment_exec_instance_num=8; ' - sql 'set parallel_pipeline_task_num=8; ' - sql 'set forbid_unknown_col_stats=true' - sql 'set broadcast_row_count_limit = 30000000' - sql 'set enable_nereids_timeout = false' - sql 'set enable_pipeline_engine=true' - String stmt = ''' - explain physical plan +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +suite("ds_rf79") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_fragment_exec_instance_num=8; ' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set broadcast_row_count_limit = 30000000' + sql 'set enable_nereids_timeout = false' + sql 'set enable_pipeline_engine=true' + String stmt = ''' + explain physical plan select c_last_name,c_first_name,substr(s_city,1,30),ss_ticket_number,amt,profit from @@ -52,26 +52,26 @@ suite("ds_rf79") { where ss_customer_sk = c_customer_sk order by c_last_name,c_first_name,substr(s_city,1,30), profit limit 100; - - ''' - String plan = sql "${stmt}" - println plan - def getRuntimeFilters = { plantree -> - { - def lst = [] - plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { - ch -> - { - lst.add(ch.replaceAll("#\\d+", '')) - } - } - return lst.join(',') - } - } - - // def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.79" - // File file = new File(outFile) - // file.write(getRuntimeFilters(plan)) - - assertEquals("RF3[c_customer_sk->[ss_customer_sk],RF2[s_store_sk->[ss_store_sk],RF1[hd_demo_sk->[ss_hdemo_sk],RF0[d_date_sk->[ss_sold_date_sk]", getRuntimeFilters(plan)) -} + + ''' + String plan = sql "${stmt}" + println plan + def getRuntimeFilters = { plantree -> + { + def lst = [] + plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { + ch -> + { + lst.add(ch.replaceAll("#\\d+", '')) + } + } + return lst.join(',') + } + } + + //def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.79" + //File file = new File(outFile) + //file.write(getRuntimeFilters(plan)) + + assertEquals("RF3[c_customer_sk->[ss_customer_sk],RF2[s_store_sk->[ss_store_sk],RF1[hd_demo_sk->[ss_hdemo_sk],RF0[d_date_sk->[ss_sold_date_sk]", getRuntimeFilters(plan)) +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf8.groovy b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf8.groovy index 5b9da105d21928..d30153cc79b8e6 100644 --- a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf8.groovy +++ b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf8.groovy @@ -1,37 +1,37 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -suite("ds_rf8") { - String db = context.config.getDbNameByFile(new File(context.file.parent)) - sql "use ${db}" - sql 'set enable_nereids_planner=true' - sql 'set enable_fallback_to_original_planner=false' - sql 'set exec_mem_limit=21G' - sql 'set be_number_for_test=3' - sql 'set parallel_fragment_exec_instance_num=8; ' - sql 'set parallel_pipeline_task_num=8; ' - sql 'set forbid_unknown_col_stats=true' - sql 'set broadcast_row_count_limit = 30000000' - sql 'set enable_nereids_timeout = false' - sql 'set enable_pipeline_engine=true' - String stmt = ''' - explain physical plan +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +suite("ds_rf8") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_fragment_exec_instance_num=8; ' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set broadcast_row_count_limit = 30000000' + sql 'set enable_nereids_timeout = false' + sql 'set enable_pipeline_engine=true' + String stmt = ''' + explain physical plan select s_store_name ,sum(ss_net_profit) from store_sales @@ -137,26 +137,26 @@ suite("ds_rf8") { group by s_store_name order by s_store_name limit 100; - - ''' - String plan = sql "${stmt}" - println plan - def getRuntimeFilters = { plantree -> - { - def lst = [] - plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { - ch -> - { - lst.add(ch.replaceAll("#\\d+", '')) - } - } - return lst.join(',') - } - } - - // def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.8" - // File file = new File(outFile) - // file.write(getRuntimeFilters(plan)) - - assertEquals("RF2[s_store_sk->[ss_store_sk],RF1[d_date_sk->[ss_sold_date_sk],RF0[c_current_addr_sk->[ca_address_sk]", getRuntimeFilters(plan)) -} + + ''' + String plan = sql "${stmt}" + println plan + def getRuntimeFilters = { plantree -> + { + def lst = [] + plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { + ch -> + { + lst.add(ch.replaceAll("#\\d+", '')) + } + } + return lst.join(',') + } + } + + //def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.8" + //File file = new File(outFile) + //file.write(getRuntimeFilters(plan)) + + assertEquals("RF2[s_store_sk->[ss_store_sk],RF1[d_date_sk->[ss_sold_date_sk],RF0[c_current_addr_sk->[ca_address_sk]", getRuntimeFilters(plan)) +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf80.groovy b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf80.groovy index 739fbb942ccb00..5552d42c8f8385 100644 --- a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf80.groovy +++ b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf80.groovy @@ -128,7 +128,7 @@ group by web_site_id) ''' String plan = sql "${stmt}" - log.info(plan) + println plan def getRuntimeFilters = { plantree -> { def lst = [] @@ -142,9 +142,9 @@ group by web_site_id) } } - // def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.80" - // File file = new File(outFile) - // file.write(getRuntimeFilters(plan)) + //def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.80" + //File file = new File(outFile) + //file.write(getRuntimeFilters(plan)) - assertEquals("RF4[ss_item_sk->[sr_item_sk],RF5[ss_ticket_number->[sr_ticket_number],RF3[s_store_sk->[ss_store_sk],RF2[p_promo_sk->[ss_promo_sk],RF1[i_item_sk->[ss_item_sk],RF0[d_date_sk->[ss_sold_date_sk],RF10[cs_item_sk->[cr_item_sk],RF11[cs_order_number->[cr_order_number],RF9[cp_catalog_page_sk->[cs_catalog_page_sk],RF8[p_promo_sk->[cs_promo_sk],RF7[i_item_sk->[cs_item_sk],RF6[d_date_sk->[cs_sold_date_sk],RF16[ws_item_sk->[wr_item_sk],RF17[ws_order_number->[wr_order_number],RF15[web_site_sk->[ws_web_site_sk],RF14[i_item_sk->[ws_item_sk],RF13[p_promo_sk->[ws_promo_sk],RF12[d_date_sk->[ws_sold_date_sk]", getRuntimeFilters(plan)) + assertEquals("RF4[ss_item_sk->[sr_item_sk],RF5[ss_ticket_number->[sr_ticket_number],RF3[s_store_sk->[ss_store_sk],RF2[i_item_sk->[ss_item_sk],RF1[p_promo_sk->[ss_promo_sk],RF0[d_date_sk->[ss_sold_date_sk],RF11[cp_catalog_page_sk->[cs_catalog_page_sk],RF9[cs_item_sk->[cr_item_sk],RF10[cs_order_number->[cr_order_number],RF8[i_item_sk->[cs_item_sk],RF7[p_promo_sk->[cs_promo_sk],RF6[d_date_sk->[cs_sold_date_sk],RF16[ws_item_sk->[wr_item_sk],RF17[ws_order_number->[wr_order_number],RF15[web_site_sk->[ws_web_site_sk],RF14[i_item_sk->[ws_item_sk],RF13[p_promo_sk->[ws_promo_sk],RF12[d_date_sk->[ws_sold_date_sk]", getRuntimeFilters(plan)) } diff --git a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf81.groovy b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf81.groovy index f6f856a277c68e..96d2375aa667e0 100644 --- a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf81.groovy +++ b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf81.groovy @@ -1,37 +1,37 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -suite("ds_rf81") { - String db = context.config.getDbNameByFile(new File(context.file.parent)) - sql "use ${db}" - sql 'set enable_nereids_planner=true' - sql 'set enable_fallback_to_original_planner=false' - sql 'set exec_mem_limit=21G' - sql 'set be_number_for_test=3' - sql 'set parallel_fragment_exec_instance_num=8; ' - sql 'set parallel_pipeline_task_num=8; ' - sql 'set forbid_unknown_col_stats=true' - sql 'set broadcast_row_count_limit = 30000000' - sql 'set enable_nereids_timeout = false' - sql 'set enable_pipeline_engine=true' - String stmt = ''' - explain physical plan +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +suite("ds_rf81") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_fragment_exec_instance_num=8; ' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set broadcast_row_count_limit = 30000000' + sql 'set enable_nereids_timeout = false' + sql 'set enable_pipeline_engine=true' + String stmt = ''' + explain physical plan with customer_total_return as (select cr_returning_customer_sk as ctr_customer_sk ,ca_state as ctr_state, @@ -60,26 +60,26 @@ suite("ds_rf81") { ,ca_street_type,ca_suite_number,ca_city,ca_county,ca_state,ca_zip,ca_country,ca_gmt_offset ,ca_location_type,ctr_total_return limit 100; - - ''' - String plan = sql "${stmt}" - println plan - def getRuntimeFilters = { plantree -> - { - def lst = [] - plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { - ch -> - { - lst.add(ch.replaceAll("#\\d+", '')) - } - } - return lst.join(',') - } - } - - // def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.81" - // File file = new File(outFile) - // file.write(getRuntimeFilters(plan)) - - assertEquals("RF1[ca_address_sk->[cr_returning_addr_sk],RF0[d_date_sk->[cr_returned_date_sk],RF3[c_customer_sk->[ctr_customer_sk],RF2[ca_address_sk->[c_current_addr_sk]", getRuntimeFilters(plan)) -} + + ''' + String plan = sql "${stmt}" + println plan + def getRuntimeFilters = { plantree -> + { + def lst = [] + plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { + ch -> + { + lst.add(ch.replaceAll("#\\d+", '')) + } + } + return lst.join(',') + } + } + + //def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.81" + //File file = new File(outFile) + //file.write(getRuntimeFilters(plan)) + + assertEquals("RF2[ca_address_sk->[cr_returning_addr_sk],RF1[d_date_sk->[cr_returned_date_sk],RF0[ca_address_sk->[c_current_addr_sk]", getRuntimeFilters(plan)) +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf82.groovy b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf82.groovy index 0502e0ce2b9cdf..508e563b9a3124 100644 --- a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf82.groovy +++ b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf82.groovy @@ -1,37 +1,37 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -suite("ds_rf82") { - String db = context.config.getDbNameByFile(new File(context.file.parent)) - sql "use ${db}" - sql 'set enable_nereids_planner=true' - sql 'set enable_fallback_to_original_planner=false' - sql 'set exec_mem_limit=21G' - sql 'set be_number_for_test=3' - sql 'set parallel_fragment_exec_instance_num=8; ' - sql 'set parallel_pipeline_task_num=8; ' - sql 'set forbid_unknown_col_stats=true' - sql 'set broadcast_row_count_limit = 30000000' - sql 'set enable_nereids_timeout = false' - sql 'set enable_pipeline_engine=true' - String stmt = ''' - explain physical plan +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +suite("ds_rf82") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_fragment_exec_instance_num=8; ' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set broadcast_row_count_limit = 30000000' + sql 'set enable_nereids_timeout = false' + sql 'set enable_pipeline_engine=true' + String stmt = ''' + explain physical plan select i_item_id ,i_item_desc ,i_current_price @@ -46,26 +46,26 @@ suite("ds_rf82") { group by i_item_id,i_item_desc,i_current_price order by i_item_id limit 100; - - ''' - String plan = sql "${stmt}" - println plan - def getRuntimeFilters = { plantree -> - { - def lst = [] - plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { - ch -> - { - lst.add(ch.replaceAll("#\\d+", '')) - } - } - return lst.join(',') - } - } - - // def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.82" - // File file = new File(outFile) - // file.write(getRuntimeFilters(plan)) - - assertEquals("RF2[i_item_sk->[ss_item_sk],RF1[d_date_sk->[inv_date_sk],RF0[i_item_sk->[inv_item_sk]", getRuntimeFilters(plan)) -} + + ''' + String plan = sql "${stmt}" + println plan + def getRuntimeFilters = { plantree -> + { + def lst = [] + plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { + ch -> + { + lst.add(ch.replaceAll("#\\d+", '')) + } + } + return lst.join(',') + } + } + + //def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.82" + //File file = new File(outFile) + //file.write(getRuntimeFilters(plan)) + + assertEquals("RF2[i_item_sk->[ss_item_sk],RF1[d_date_sk->[inv_date_sk],RF0[i_item_sk->[inv_item_sk]", getRuntimeFilters(plan)) +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf83.groovy b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf83.groovy index eb3d380b05a2de..b3dfe0d518aa1a 100644 --- a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf83.groovy +++ b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf83.groovy @@ -99,7 +99,7 @@ suite("ds_rf83") { ''' String plan = sql "${stmt}" - log.info(plan) + println plan def getRuntimeFilters = { plantree -> { def lst = [] @@ -113,9 +113,9 @@ suite("ds_rf83") { } } - // def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.83" - // File file = new File(outFile) - // file.write(getRuntimeFilters(plan)) + //def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.83" + //File file = new File(outFile) + //file.write(getRuntimeFilters(plan)) - assertEquals("RF13[item_id->[i_item_id],RF12[cr_item_sk->[i_item_sk],RF11[d_date_sk->[cr_returned_date_sk],RF10[d_date->[d_date],RF9[d_week_seq->[d_week_seq],RF8[item_id->[i_item_id],RF7[i_item_sk->[sr_item_sk],RF6[d_date_sk->[sr_returned_date_sk],RF5[d_date->[d_date],RF4[d_week_seq->[d_week_seq],RF3[wr_item_sk->[i_item_sk],RF2[d_date_sk->[wr_returned_date_sk],RF1[d_date->[d_date],RF0[d_week_seq->[d_week_seq]", getRuntimeFilters(plan)) + assertEquals("RF13[item_id->[i_item_id],RF12[cr_item_sk->[i_item_sk],RF11[d_date_sk->[cr_returned_date_sk],RF10[d_date->[d_date],RF9[d_week_seq->[d_week_seq],RF8[item_id->[i_item_id],RF7[sr_item_sk->[i_item_sk],RF6[d_date_sk->[sr_returned_date_sk],RF5[d_date->[d_date],RF4[d_week_seq->[d_week_seq],RF3[wr_item_sk->[i_item_sk],RF2[d_date_sk->[wr_returned_date_sk],RF1[d_date->[d_date],RF0[d_week_seq->[d_week_seq]", getRuntimeFilters(plan)) } diff --git a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf84.groovy b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf84.groovy index 9517c3789d2603..f4e003aa536c44 100644 --- a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf84.groovy +++ b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf84.groovy @@ -1,37 +1,37 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -suite("ds_rf84") { - String db = context.config.getDbNameByFile(new File(context.file.parent)) - sql "use ${db}" - sql 'set enable_nereids_planner=true' - sql 'set enable_fallback_to_original_planner=false' - sql 'set exec_mem_limit=21G' - sql 'set be_number_for_test=3' - sql 'set parallel_fragment_exec_instance_num=8; ' - sql 'set parallel_pipeline_task_num=8; ' - sql 'set forbid_unknown_col_stats=true' - sql 'set broadcast_row_count_limit = 30000000' - sql 'set enable_nereids_timeout = false' - sql 'set enable_pipeline_engine=true' - String stmt = ''' - explain physical plan +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +suite("ds_rf84") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_fragment_exec_instance_num=8; ' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set broadcast_row_count_limit = 30000000' + sql 'set enable_nereids_timeout = false' + sql 'set enable_pipeline_engine=true' + String stmt = ''' + explain physical plan select c_customer_id as customer_id , concat(concat(coalesce(c_last_name,''), ','), coalesce(c_first_name,'')) as customername from customer @@ -50,26 +50,26 @@ suite("ds_rf84") { and sr_cdemo_sk = cd_demo_sk order by c_customer_id limit 100; - - ''' - String plan = sql "${stmt}" - println plan - def getRuntimeFilters = { plantree -> - { - def lst = [] - plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { - ch -> - { - lst.add(ch.replaceAll("#\\d+", '')) - } - } - return lst.join(',') - } - } - - // def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.84" - // File file = new File(outFile) - // file.write(getRuntimeFilters(plan)) - - assertEquals("RF4[cd_demo_sk->[sr_cdemo_sk],RF3[c_current_cdemo_sk->[cd_demo_sk],RF2[hd_demo_sk->[c_current_hdemo_sk],RF1[ca_address_sk->[c_current_addr_sk],RF0[ib_income_band_sk->[hd_income_band_sk]", getRuntimeFilters(plan)) -} + + ''' + String plan = sql "${stmt}" + println plan + def getRuntimeFilters = { plantree -> + { + def lst = [] + plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { + ch -> + { + lst.add(ch.replaceAll("#\\d+", '')) + } + } + return lst.join(',') + } + } + + //def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.84" + //File file = new File(outFile) + //file.write(getRuntimeFilters(plan)) + + assertEquals("RF4[cd_demo_sk->[sr_cdemo_sk],RF3[c_current_cdemo_sk->[cd_demo_sk],RF2[hd_demo_sk->[c_current_hdemo_sk],RF1[ca_address_sk->[c_current_addr_sk],RF0[ib_income_band_sk->[hd_income_band_sk]", getRuntimeFilters(plan)) +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf85.groovy b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf85.groovy index a7e014cd45ae5b..91ab923b212bf2 100644 --- a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf85.groovy +++ b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf85.groovy @@ -1,37 +1,37 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -suite("ds_rf85") { - String db = context.config.getDbNameByFile(new File(context.file.parent)) - sql "use ${db}" - sql 'set enable_nereids_planner=true' - sql 'set enable_fallback_to_original_planner=false' - sql 'set exec_mem_limit=21G' - sql 'set be_number_for_test=3' - sql 'set parallel_fragment_exec_instance_num=8; ' - sql 'set parallel_pipeline_task_num=8; ' - sql 'set forbid_unknown_col_stats=true' - sql 'set broadcast_row_count_limit = 30000000' - sql 'set enable_nereids_timeout = false' - sql 'set enable_pipeline_engine=true' - String stmt = ''' - explain physical plan +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +suite("ds_rf85") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_fragment_exec_instance_num=8; ' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set broadcast_row_count_limit = 30000000' + sql 'set enable_nereids_timeout = false' + sql 'set enable_pipeline_engine=true' + String stmt = ''' + explain physical plan select substr(r_reason_desc,1,20) ,avg(ws_quantity) ,avg(wr_refunded_cash) @@ -113,26 +113,26 @@ order by substr(r_reason_desc,1,20) ,avg(wr_refunded_cash) ,avg(wr_fee) limit 100; - - ''' - String plan = sql "${stmt}" - println plan - def getRuntimeFilters = { plantree -> - { - def lst = [] - plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { - ch -> - { - lst.add(ch.replaceAll("#\\d+", '')) - } - } - return lst.join(',') - } - } - - // def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.85" - // File file = new File(outFile) - // file.write(getRuntimeFilters(plan)) - - assertEquals("RF7[cd_marital_status->[cd_marital_status],RF8[cd_education_status->[cd_education_status],RF9[wr_returning_cdemo_sk->[cd_demo_sk],RF6[ws_web_page_sk->[wp_web_page_sk],RF5[wr_refunded_cdemo_sk->[cd_demo_sk],RF4[wr_reason_sk->[r_reason_sk],RF3[wr_refunded_addr_sk->[ca_address_sk],RF1[ws_item_sk->[wr_item_sk],RF2[ws_order_number->[wr_order_number],RF0[d_date_sk->[ws_sold_date_sk]", getRuntimeFilters(plan)) -} + + ''' + String plan = sql "${stmt}" + println plan + def getRuntimeFilters = { plantree -> + { + def lst = [] + plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { + ch -> + { + lst.add(ch.replaceAll("#\\d+", '')) + } + } + return lst.join(',') + } + } + + //def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.85" + //File file = new File(outFile) + //file.write(getRuntimeFilters(plan)) + + assertEquals("RF9[wr_reason_sk->[r_reason_sk],RF8[ws_web_page_sk->[wp_web_page_sk],RF5[cd_marital_status->[cd_marital_status],RF6[cd_education_status->[cd_education_status],RF7[wr_returning_cdemo_sk->[cd_demo_sk],RF4[wr_refunded_cdemo_sk->[cd_demo_sk],RF3[wr_refunded_addr_sk->[ca_address_sk],RF1[ws_item_sk->[wr_item_sk],RF2[ws_order_number->[wr_order_number],RF0[d_date_sk->[ws_sold_date_sk]", getRuntimeFilters(plan)) +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf86.groovy b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf86.groovy index f28085ad01de6f..91b446dd684f36 100644 --- a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf86.groovy +++ b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf86.groovy @@ -1,37 +1,37 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -suite("ds_rf86") { - String db = context.config.getDbNameByFile(new File(context.file.parent)) - sql "use ${db}" - sql 'set enable_nereids_planner=true' - sql 'set enable_fallback_to_original_planner=false' - sql 'set exec_mem_limit=21G' - sql 'set be_number_for_test=3' - sql 'set parallel_fragment_exec_instance_num=8; ' - sql 'set parallel_pipeline_task_num=8; ' - sql 'set forbid_unknown_col_stats=true' - sql 'set broadcast_row_count_limit = 30000000' - sql 'set enable_nereids_timeout = false' - sql 'set enable_pipeline_engine=true' - String stmt = ''' - explain physical plan +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +suite("ds_rf86") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_fragment_exec_instance_num=8; ' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set broadcast_row_count_limit = 30000000' + sql 'set enable_nereids_timeout = false' + sql 'set enable_pipeline_engine=true' + String stmt = ''' + explain physical plan select sum(ws_net_paid) as total_sum ,i_category @@ -55,26 +55,26 @@ suite("ds_rf86") { case when lochierarchy = 0 then i_category end, rank_within_parent limit 100; - - ''' - String plan = sql "${stmt}" - println plan - def getRuntimeFilters = { plantree -> - { - def lst = [] - plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { - ch -> - { - lst.add(ch.replaceAll("#\\d+", '')) - } - } - return lst.join(',') - } - } - - // def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.86" - // File file = new File(outFile) - // file.write(getRuntimeFilters(plan)) - - assertEquals("RF1[i_item_sk->[ws_item_sk],RF0[d_date_sk->[ws_sold_date_sk]", getRuntimeFilters(plan)) -} + + ''' + String plan = sql "${stmt}" + println plan + def getRuntimeFilters = { plantree -> + { + def lst = [] + plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { + ch -> + { + lst.add(ch.replaceAll("#\\d+", '')) + } + } + return lst.join(',') + } + } + + //def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.86" + //File file = new File(outFile) + //file.write(getRuntimeFilters(plan)) + + assertEquals("RF1[i_item_sk->[ws_item_sk],RF0[d_date_sk->[ws_sold_date_sk]", getRuntimeFilters(plan)) +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf87.groovy b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf87.groovy index 5eb74154b772cc..5ac0e0b0075b5b 100644 --- a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf87.groovy +++ b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf87.groovy @@ -1,37 +1,37 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -suite("ds_rf87") { - String db = context.config.getDbNameByFile(new File(context.file.parent)) - sql "use ${db}" - sql 'set enable_nereids_planner=true' - sql 'set enable_fallback_to_original_planner=false' - sql 'set exec_mem_limit=21G' - sql 'set be_number_for_test=3' - sql 'set parallel_fragment_exec_instance_num=8; ' - sql 'set parallel_pipeline_task_num=8; ' - sql 'set forbid_unknown_col_stats=true' - sql 'set broadcast_row_count_limit = 30000000' - sql 'set enable_nereids_timeout = false' - sql 'set enable_pipeline_engine=true' - String stmt = ''' - explain physical plan +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +suite("ds_rf87") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_fragment_exec_instance_num=8; ' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set broadcast_row_count_limit = 30000000' + sql 'set enable_nereids_timeout = false' + sql 'set enable_pipeline_engine=true' + String stmt = ''' + explain physical plan select count(*) from ((select distinct c_last_name, c_first_name, d_date from store_sales, date_dim, customer @@ -52,26 +52,26 @@ from ((select distinct c_last_name, c_first_name, d_date and d_month_seq between 1184 and 1184+11) ) cool_cust ; - - ''' - String plan = sql "${stmt}" - println plan - def getRuntimeFilters = { plantree -> - { - def lst = [] - plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { - ch -> - { - lst.add(ch.replaceAll("#\\d+", '')) - } - } - return lst.join(',') - } - } - - // def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.87" - // File file = new File(outFile) - // file.write(getRuntimeFilters(plan)) - - assertEquals("RF1[c_customer_sk->[ss_customer_sk],RF0[d_date_sk->[ss_sold_date_sk],RF3[c_customer_sk->[cs_bill_customer_sk],RF2[d_date_sk->[cs_sold_date_sk],RF5[c_customer_sk->[ws_bill_customer_sk],RF4[d_date_sk->[ws_sold_date_sk]", getRuntimeFilters(plan)) -} + + ''' + String plan = sql "${stmt}" + println plan + def getRuntimeFilters = { plantree -> + { + def lst = [] + plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { + ch -> + { + lst.add(ch.replaceAll("#\\d+", '')) + } + } + return lst.join(',') + } + } + + //def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.87" + //File file = new File(outFile) + //file.write(getRuntimeFilters(plan)) + + assertEquals("RF1[c_customer_sk->[ss_customer_sk],RF0[d_date_sk->[ss_sold_date_sk],RF3[c_customer_sk->[cs_bill_customer_sk],RF2[d_date_sk->[cs_sold_date_sk],RF5[c_customer_sk->[ws_bill_customer_sk],RF4[d_date_sk->[ws_sold_date_sk]", getRuntimeFilters(plan)) +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf88.groovy b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf88.groovy index 1cd5efbf805a2a..a5567b830fca28 100644 --- a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf88.groovy +++ b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf88.groovy @@ -1,37 +1,37 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -suite("ds_rf88") { - String db = context.config.getDbNameByFile(new File(context.file.parent)) - sql "use ${db}" - sql 'set enable_nereids_planner=true' - sql 'set enable_fallback_to_original_planner=false' - sql 'set exec_mem_limit=21G' - sql 'set be_number_for_test=3' - sql 'set parallel_fragment_exec_instance_num=8; ' - sql 'set parallel_pipeline_task_num=8; ' - sql 'set forbid_unknown_col_stats=true' - sql 'set broadcast_row_count_limit = 30000000' - sql 'set enable_nereids_timeout = false' - sql 'set enable_pipeline_engine=true' - String stmt = ''' - explain physical plan +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +suite("ds_rf88") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_fragment_exec_instance_num=8; ' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set broadcast_row_count_limit = 30000000' + sql 'set enable_nereids_timeout = false' + sql 'set enable_pipeline_engine=true' + String stmt = ''' + explain physical plan select * from (select count(*) h8_30_to_9 @@ -123,26 +123,26 @@ from (household_demographics.hd_dep_count = 3 and household_demographics.hd_vehicle_count<=3+2)) and store.s_store_name = 'ese') s8 ; - - ''' - String plan = sql "${stmt}" - println plan - def getRuntimeFilters = { plantree -> - { - def lst = [] - plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { - ch -> - { - lst.add(ch.replaceAll("#\\d+", '')) - } - } - return lst.join(',') - } - } - - // def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.88" - // File file = new File(outFile) - // file.write(getRuntimeFilters(plan)) - - assertEquals("RF23[hd_demo_sk->[ss_hdemo_sk],RF22[s_store_sk->[ss_store_sk],RF21[t_time_sk->[ss_sold_time_sk],RF20[hd_demo_sk->[ss_hdemo_sk],RF19[s_store_sk->[ss_store_sk],RF18[t_time_sk->[ss_sold_time_sk],RF17[hd_demo_sk->[ss_hdemo_sk],RF16[s_store_sk->[ss_store_sk],RF15[t_time_sk->[ss_sold_time_sk],RF14[hd_demo_sk->[ss_hdemo_sk],RF13[s_store_sk->[ss_store_sk],RF12[t_time_sk->[ss_sold_time_sk],RF11[hd_demo_sk->[ss_hdemo_sk],RF10[s_store_sk->[ss_store_sk],RF9[t_time_sk->[ss_sold_time_sk],RF8[hd_demo_sk->[ss_hdemo_sk],RF7[s_store_sk->[ss_store_sk],RF6[t_time_sk->[ss_sold_time_sk],RF5[hd_demo_sk->[ss_hdemo_sk],RF4[s_store_sk->[ss_store_sk],RF3[t_time_sk->[ss_sold_time_sk],RF2[hd_demo_sk->[ss_hdemo_sk],RF1[s_store_sk->[ss_store_sk],RF0[t_time_sk->[ss_sold_time_sk]", getRuntimeFilters(plan)) -} + + ''' + String plan = sql "${stmt}" + println plan + def getRuntimeFilters = { plantree -> + { + def lst = [] + plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { + ch -> + { + lst.add(ch.replaceAll("#\\d+", '')) + } + } + return lst.join(',') + } + } + + //def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.88" + //File file = new File(outFile) + //file.write(getRuntimeFilters(plan)) + + assertEquals("RF23[s_store_sk->[ss_store_sk],RF22[hd_demo_sk->[ss_hdemo_sk],RF21[t_time_sk->[ss_sold_time_sk],RF20[s_store_sk->[ss_store_sk],RF19[hd_demo_sk->[ss_hdemo_sk],RF18[t_time_sk->[ss_sold_time_sk],RF17[s_store_sk->[ss_store_sk],RF16[hd_demo_sk->[ss_hdemo_sk],RF15[t_time_sk->[ss_sold_time_sk],RF14[s_store_sk->[ss_store_sk],RF13[hd_demo_sk->[ss_hdemo_sk],RF12[t_time_sk->[ss_sold_time_sk],RF11[s_store_sk->[ss_store_sk],RF10[hd_demo_sk->[ss_hdemo_sk],RF9[t_time_sk->[ss_sold_time_sk],RF8[s_store_sk->[ss_store_sk],RF7[hd_demo_sk->[ss_hdemo_sk],RF6[t_time_sk->[ss_sold_time_sk],RF5[s_store_sk->[ss_store_sk],RF4[hd_demo_sk->[ss_hdemo_sk],RF3[t_time_sk->[ss_sold_time_sk],RF2[s_store_sk->[ss_store_sk],RF1[hd_demo_sk->[ss_hdemo_sk],RF0[t_time_sk->[ss_sold_time_sk]", getRuntimeFilters(plan)) +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf89.groovy b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf89.groovy index 14d5a65401492c..d8bc5c5fca03a2 100644 --- a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf89.groovy +++ b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf89.groovy @@ -1,37 +1,37 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -suite("ds_rf89") { - String db = context.config.getDbNameByFile(new File(context.file.parent)) - sql "use ${db}" - sql 'set enable_nereids_planner=true' - sql 'set enable_fallback_to_original_planner=false' - sql 'set exec_mem_limit=21G' - sql 'set be_number_for_test=3' - sql 'set parallel_fragment_exec_instance_num=8; ' - sql 'set parallel_pipeline_task_num=8; ' - sql 'set forbid_unknown_col_stats=true' - sql 'set broadcast_row_count_limit = 30000000' - sql 'set enable_nereids_timeout = false' - sql 'set enable_pipeline_engine=true' - String stmt = ''' - explain physical plan +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +suite("ds_rf89") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_fragment_exec_instance_num=8; ' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set broadcast_row_count_limit = 30000000' + sql 'set enable_nereids_timeout = false' + sql 'set enable_pipeline_engine=true' + String stmt = ''' + explain physical plan select * from( select i_category, i_class, i_brand, @@ -57,26 +57,26 @@ group by i_category, i_class, i_brand, where case when (avg_monthly_sales <> 0) then (abs(sum_sales - avg_monthly_sales) / avg_monthly_sales) else null end > 0.1 order by sum_sales - avg_monthly_sales, s_store_name limit 100; - - ''' - String plan = sql "${stmt}" - println plan - def getRuntimeFilters = { plantree -> - { - def lst = [] - plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { - ch -> - { - lst.add(ch.replaceAll("#\\d+", '')) - } - } - return lst.join(',') - } - } - - // def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.89" - // File file = new File(outFile) - // file.write(getRuntimeFilters(plan)) - - assertEquals("RF2[s_store_sk->[ss_store_sk],RF1[d_date_sk->[ss_sold_date_sk],RF0[i_item_sk->[ss_item_sk]", getRuntimeFilters(plan)) -} + + ''' + String plan = sql "${stmt}" + println plan + def getRuntimeFilters = { plantree -> + { + def lst = [] + plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { + ch -> + { + lst.add(ch.replaceAll("#\\d+", '')) + } + } + return lst.join(',') + } + } + + //def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.89" + //File file = new File(outFile) + //file.write(getRuntimeFilters(plan)) + + assertEquals("RF2[s_store_sk->[ss_store_sk],RF1[d_date_sk->[ss_sold_date_sk],RF0[i_item_sk->[ss_item_sk]", getRuntimeFilters(plan)) +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf9.groovy b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf9.groovy index cc7e327057668c..9ef15e9ad53820 100644 --- a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf9.groovy +++ b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf9.groovy @@ -1,37 +1,37 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -suite("ds_rf9") { - String db = context.config.getDbNameByFile(new File(context.file.parent)) - sql "use ${db}" - sql 'set enable_nereids_planner=true' - sql 'set enable_fallback_to_original_planner=false' - sql 'set exec_mem_limit=21G' - sql 'set be_number_for_test=3' - sql 'set parallel_fragment_exec_instance_num=8; ' - sql 'set parallel_pipeline_task_num=8; ' - sql 'set forbid_unknown_col_stats=true' - sql 'set broadcast_row_count_limit = 30000000' - sql 'set enable_nereids_timeout = false' - sql 'set enable_pipeline_engine=true' - String stmt = ''' - explain physical plan +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +suite("ds_rf9") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_fragment_exec_instance_num=8; ' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set broadcast_row_count_limit = 30000000' + sql 'set enable_nereids_timeout = false' + sql 'set enable_pipeline_engine=true' + String stmt = ''' + explain physical plan select case when (select count(*) from store_sales where ss_quantity between 1 and 20) > 2972190 @@ -80,26 +80,26 @@ suite("ds_rf9") { from reason where r_reason_sk = 1 ; - - ''' - String plan = sql "${stmt}" - println plan - def getRuntimeFilters = { plantree -> - { - def lst = [] - plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { - ch -> - { - lst.add(ch.replaceAll("#\\d+", '')) - } - } - return lst.join(',') - } - } - - // def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.9" - // File file = new File(outFile) - // file.write(getRuntimeFilters(plan)) - - assertEquals("", getRuntimeFilters(plan)) -} + + ''' + String plan = sql "${stmt}" + println plan + def getRuntimeFilters = { plantree -> + { + def lst = [] + plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { + ch -> + { + lst.add(ch.replaceAll("#\\d+", '')) + } + } + return lst.join(',') + } + } + + //def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.9" + //File file = new File(outFile) + //file.write(getRuntimeFilters(plan)) + + assertEquals("", getRuntimeFilters(plan)) +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf90.groovy b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf90.groovy index 31711a590ec858..9bdaae55fada77 100644 --- a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf90.groovy +++ b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf90.groovy @@ -1,37 +1,37 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -suite("ds_rf90") { - String db = context.config.getDbNameByFile(new File(context.file.parent)) - sql "use ${db}" - sql 'set enable_nereids_planner=true' - sql 'set enable_fallback_to_original_planner=false' - sql 'set exec_mem_limit=21G' - sql 'set be_number_for_test=3' - sql 'set parallel_fragment_exec_instance_num=8; ' - sql 'set parallel_pipeline_task_num=8; ' - sql 'set forbid_unknown_col_stats=true' - sql 'set broadcast_row_count_limit = 30000000' - sql 'set enable_nereids_timeout = false' - sql 'set enable_pipeline_engine=true' - String stmt = ''' - explain physical plan +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +suite("ds_rf90") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_fragment_exec_instance_num=8; ' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set broadcast_row_count_limit = 30000000' + sql 'set enable_nereids_timeout = false' + sql 'set enable_pipeline_engine=true' + String stmt = ''' + explain physical plan select cast(amc as decimal(15,4))/cast(pmc as decimal(15,4)) am_pm_ratio from ( select count(*) amc from web_sales, household_demographics , time_dim, web_page @@ -51,26 +51,26 @@ suite("ds_rf90") { and web_page.wp_char_count between 5000 and 5200) pt order by am_pm_ratio limit 100; - - ''' - String plan = sql "${stmt}" - println plan - def getRuntimeFilters = { plantree -> - { - def lst = [] - plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { - ch -> - { - lst.add(ch.replaceAll("#\\d+", '')) - } - } - return lst.join(',') - } - } - - // def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.90" - // File file = new File(outFile) - // file.write(getRuntimeFilters(plan)) - - assertEquals("RF5[hd_demo_sk->[ws_ship_hdemo_sk],RF4[t_time_sk->[ws_sold_time_sk],RF3[wp_web_page_sk->[ws_web_page_sk],RF2[hd_demo_sk->[ws_ship_hdemo_sk],RF1[t_time_sk->[ws_sold_time_sk],RF0[wp_web_page_sk->[ws_web_page_sk]", getRuntimeFilters(plan)) -} + + ''' + String plan = sql "${stmt}" + println plan + def getRuntimeFilters = { plantree -> + { + def lst = [] + plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { + ch -> + { + lst.add(ch.replaceAll("#\\d+", '')) + } + } + return lst.join(',') + } + } + + //def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.90" + //File file = new File(outFile) + //file.write(getRuntimeFilters(plan)) + + assertEquals("RF5[hd_demo_sk->[ws_ship_hdemo_sk],RF4[t_time_sk->[ws_sold_time_sk],RF3[wp_web_page_sk->[ws_web_page_sk],RF2[hd_demo_sk->[ws_ship_hdemo_sk],RF1[t_time_sk->[ws_sold_time_sk],RF0[wp_web_page_sk->[ws_web_page_sk]", getRuntimeFilters(plan)) +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf91.groovy b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf91.groovy index 321930a593bf7d..bd4c88e637f3a0 100644 --- a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf91.groovy +++ b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf91.groovy @@ -1,37 +1,37 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -suite("ds_rf91") { - String db = context.config.getDbNameByFile(new File(context.file.parent)) - sql "use ${db}" - sql 'set enable_nereids_planner=true' - sql 'set enable_fallback_to_original_planner=false' - sql 'set exec_mem_limit=21G' - sql 'set be_number_for_test=3' - sql 'set parallel_fragment_exec_instance_num=8; ' - sql 'set parallel_pipeline_task_num=8; ' - sql 'set forbid_unknown_col_stats=true' - sql 'set broadcast_row_count_limit = 30000000' - sql 'set enable_nereids_timeout = false' - sql 'set enable_pipeline_engine=true' - String stmt = ''' - explain physical plan +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +suite("ds_rf91") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_fragment_exec_instance_num=8; ' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set broadcast_row_count_limit = 30000000' + sql 'set enable_nereids_timeout = false' + sql 'set enable_pipeline_engine=true' + String stmt = ''' + explain physical plan select cc_call_center_id Call_Center, cc_name Call_Center_Name, @@ -60,26 +60,26 @@ and hd_buy_potential like '1001-5000%' and ca_gmt_offset = -6 group by cc_call_center_id,cc_name,cc_manager,cd_marital_status,cd_education_status order by sum(cr_net_loss) desc; - - ''' - String plan = sql "${stmt}" - println plan - def getRuntimeFilters = { plantree -> - { - def lst = [] - plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { - ch -> - { - lst.add(ch.replaceAll("#\\d+", '')) - } - } - return lst.join(',') - } - } - - // def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.91" - // File file = new File(outFile) - // file.write(getRuntimeFilters(plan)) - - assertEquals("RF5[cc_call_center_sk->[cr_call_center_sk],RF4[d_date_sk->[cr_returned_date_sk],RF3[c_customer_sk->[cr_returning_customer_sk],RF2[c_current_addr_sk->[ca_address_sk],RF1[hd_demo_sk->[c_current_hdemo_sk],RF0[cd_demo_sk->[c_current_cdemo_sk]", getRuntimeFilters(plan)) -} + + ''' + String plan = sql "${stmt}" + println plan + def getRuntimeFilters = { plantree -> + { + def lst = [] + plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { + ch -> + { + lst.add(ch.replaceAll("#\\d+", '')) + } + } + return lst.join(',') + } + } + + //def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.91" + //File file = new File(outFile) + //file.write(getRuntimeFilters(plan)) + + assertEquals("RF5[cc_call_center_sk->[cr_call_center_sk],RF4[d_date_sk->[cr_returned_date_sk],RF3[c_customer_sk->[cr_returning_customer_sk],RF2[c_current_addr_sk->[ca_address_sk],RF1[hd_demo_sk->[c_current_hdemo_sk],RF0[cd_demo_sk->[c_current_cdemo_sk]", getRuntimeFilters(plan)) +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf92.groovy b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf92.groovy index 4f3e0e548bce28..1bb71ce906d2c0 100644 --- a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf92.groovy +++ b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf92.groovy @@ -1,37 +1,37 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -suite("ds_rf92") { - String db = context.config.getDbNameByFile(new File(context.file.parent)) - sql "use ${db}" - sql 'set enable_nereids_planner=true' - sql 'set enable_fallback_to_original_planner=false' - sql 'set exec_mem_limit=21G' - sql 'set be_number_for_test=3' - sql 'set parallel_fragment_exec_instance_num=8; ' - sql 'set parallel_pipeline_task_num=8; ' - sql 'set forbid_unknown_col_stats=true' - sql 'set broadcast_row_count_limit = 30000000' - sql 'set enable_nereids_timeout = false' - sql 'set enable_pipeline_engine=true' - String stmt = ''' - explain physical plan +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +suite("ds_rf92") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_fragment_exec_instance_num=8; ' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set broadcast_row_count_limit = 30000000' + sql 'set enable_nereids_timeout = false' + sql 'set enable_pipeline_engine=true' + String stmt = ''' + explain physical plan select sum(ws_ext_discount_amt) as "Excess Discount Amount" from @@ -59,26 +59,26 @@ and ws_ext_discount_amt ) order by sum(ws_ext_discount_amt) limit 100; - - ''' - String plan = sql "${stmt}" - println plan - def getRuntimeFilters = { plantree -> - { - def lst = [] - plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { - ch -> - { - lst.add(ch.replaceAll("#\\d+", '')) - } - } - return lst.join(',') - } - } - - // def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.92" - // File file = new File(outFile) - // file.write(getRuntimeFilters(plan)) - - assertEquals("RF1[d_date_sk->[ws_sold_date_sk],RF0[i_item_sk->[ws_item_sk]", getRuntimeFilters(plan)) -} + + ''' + String plan = sql "${stmt}" + println plan + def getRuntimeFilters = { plantree -> + { + def lst = [] + plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { + ch -> + { + lst.add(ch.replaceAll("#\\d+", '')) + } + } + return lst.join(',') + } + } + + //def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.92" + //File file = new File(outFile) + //file.write(getRuntimeFilters(plan)) + + assertEquals("RF1[d_date_sk->[ws_sold_date_sk],RF0[i_item_sk->[ws_item_sk]", getRuntimeFilters(plan)) +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf93.groovy b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf93.groovy index 160a50b795c31b..22e8eb19ac6292 100644 --- a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf93.groovy +++ b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf93.groovy @@ -1,37 +1,37 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -suite("ds_rf93") { - String db = context.config.getDbNameByFile(new File(context.file.parent)) - sql "use ${db}" - sql 'set enable_nereids_planner=true' - sql 'set enable_fallback_to_original_planner=false' - sql 'set exec_mem_limit=21G' - sql 'set be_number_for_test=3' - sql 'set parallel_fragment_exec_instance_num=8; ' - sql 'set parallel_pipeline_task_num=8; ' - sql 'set forbid_unknown_col_stats=true' - sql 'set broadcast_row_count_limit = 30000000' - sql 'set enable_nereids_timeout = false' - sql 'set enable_pipeline_engine=true' - String stmt = ''' - explain physical plan +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +suite("ds_rf93") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_fragment_exec_instance_num=8; ' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set broadcast_row_count_limit = 30000000' + sql 'set enable_nereids_timeout = false' + sql 'set enable_pipeline_engine=true' + String stmt = ''' + explain physical plan select ss_customer_sk ,sum(act_sales) sumsales from (select ss_item_sk @@ -47,26 +47,26 @@ suite("ds_rf93") { group by ss_customer_sk order by sumsales, ss_customer_sk limit 100; - - ''' - String plan = sql "${stmt}" - println plan - def getRuntimeFilters = { plantree -> - { - def lst = [] - plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { - ch -> - { - lst.add(ch.replaceAll("#\\d+", '')) - } - } - return lst.join(',') - } - } - - // def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.93" - // File file = new File(outFile) - // file.write(getRuntimeFilters(plan)) - - assertEquals("RF1[sr_item_sk->[ss_item_sk],RF2[sr_ticket_number->[ss_ticket_number],RF0[r_reason_sk->[sr_reason_sk]", getRuntimeFilters(plan)) -} + + ''' + String plan = sql "${stmt}" + println plan + def getRuntimeFilters = { plantree -> + { + def lst = [] + plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { + ch -> + { + lst.add(ch.replaceAll("#\\d+", '')) + } + } + return lst.join(',') + } + } + + //def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.93" + //File file = new File(outFile) + //file.write(getRuntimeFilters(plan)) + + assertEquals("RF1[sr_item_sk->[ss_item_sk],RF2[sr_ticket_number->[ss_ticket_number],RF0[r_reason_sk->[sr_reason_sk]", getRuntimeFilters(plan)) +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf94.groovy b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf94.groovy index 710098a31520f5..f21ffdf0cebb7b 100644 --- a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf94.groovy +++ b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf94.groovy @@ -1,37 +1,37 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -suite("ds_rf94") { - String db = context.config.getDbNameByFile(new File(context.file.parent)) - sql "use ${db}" - sql 'set enable_nereids_planner=true' - sql 'set enable_fallback_to_original_planner=false' - sql 'set exec_mem_limit=21G' - sql 'set be_number_for_test=3' - sql 'set parallel_fragment_exec_instance_num=8; ' - sql 'set parallel_pipeline_task_num=8; ' - sql 'set forbid_unknown_col_stats=true' - sql 'set broadcast_row_count_limit = 30000000' - sql 'set enable_nereids_timeout = false' - sql 'set enable_pipeline_engine=true' - String stmt = ''' - explain physical plan +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +suite("ds_rf94") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_fragment_exec_instance_num=8; ' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set broadcast_row_count_limit = 30000000' + sql 'set enable_nereids_timeout = false' + sql 'set enable_pipeline_engine=true' + String stmt = ''' + explain physical plan select count(distinct ws_order_number) as "order count" ,sum(ws_ext_ship_cost) as "total shipping cost" @@ -58,26 +58,26 @@ and not exists(select * where ws1.ws_order_number = wr1.wr_order_number) order by count(distinct ws_order_number) limit 100; - - ''' - String plan = sql "${stmt}" - println plan - def getRuntimeFilters = { plantree -> - { - def lst = [] - plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { - ch -> - { - lst.add(ch.replaceAll("#\\d+", '')) - } - } - return lst.join(',') - } - } - - // def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.94" - // File file = new File(outFile) - // file.write(getRuntimeFilters(plan)) - - assertEquals("RF4[d_date_sk->[ws_ship_date_sk],RF3[ws_order_number->[ws_order_number],RF2[ws_order_number->[wr_order_number],RF1[web_site_sk->[ws_web_site_sk],RF0[ca_address_sk->[ws_ship_addr_sk]", getRuntimeFilters(plan)) -} + + ''' + String plan = sql "${stmt}" + println plan + def getRuntimeFilters = { plantree -> + { + def lst = [] + plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { + ch -> + { + lst.add(ch.replaceAll("#\\d+", '')) + } + } + return lst.join(',') + } + } + + //def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.94" + //File file = new File(outFile) + //file.write(getRuntimeFilters(plan)) + + assertEquals("RF4[ws_order_number->[ws_order_number],RF3[ws_order_number->[wr_order_number],RF2[web_site_sk->[ws_web_site_sk],RF1[d_date_sk->[ws_ship_date_sk],RF0[ca_address_sk->[ws_ship_addr_sk]", getRuntimeFilters(plan)) +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf95.groovy b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf95.groovy index 3785a77a131baa..d69a6c3eace471 100644 --- a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf95.groovy +++ b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf95.groovy @@ -1,37 +1,37 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -suite("ds_rf95") { - String db = context.config.getDbNameByFile(new File(context.file.parent)) - sql "use ${db}" - sql 'set enable_nereids_planner=true' - sql 'set enable_fallback_to_original_planner=false' - sql 'set exec_mem_limit=21G' - sql 'set be_number_for_test=3' - sql 'set parallel_fragment_exec_instance_num=8; ' - sql 'set parallel_pipeline_task_num=8; ' - sql 'set forbid_unknown_col_stats=true' - sql 'set broadcast_row_count_limit = 30000000' - sql 'set enable_nereids_timeout = false' - sql 'set enable_pipeline_engine=true' - String stmt = ''' - explain physical plan +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +suite("ds_rf95") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_fragment_exec_instance_num=8; ' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set broadcast_row_count_limit = 30000000' + sql 'set enable_nereids_timeout = false' + sql 'set enable_pipeline_engine=true' + String stmt = ''' + explain physical plan with ws_wh as (select ws1.ws_order_number,ws1.ws_warehouse_sk wh1,ws2.ws_warehouse_sk wh2 from web_sales ws1,web_sales ws2 @@ -61,26 +61,26 @@ and ws1.ws_order_number in (select wr_order_number where wr_order_number = ws_wh.ws_order_number) order by count(distinct ws_order_number) limit 100; - - ''' - String plan = sql "${stmt}" - println plan - def getRuntimeFilters = { plantree -> - { - def lst = [] - plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { - ch -> - { - lst.add(ch.replaceAll("#\\d+", '')) - } - } - return lst.join(',') - } - } - - // def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.95" - // File file = new File(outFile) - // file.write(getRuntimeFilters(plan)) - - assertEquals("RF0[ws_order_number->[ws_order_number],RF7[ws_ship_date_sk->[d_date_sk],RF4[wr_order_number->[ws_order_number],RF5[wr_order_number->[ws_order_number, ws_order_number],RF3[ws_order_number->[ws_order_number],RF6[ws_order_number->[ws_order_number, ws_order_number],RF2[web_site_sk->[ws_web_site_sk],RF1[ca_address_sk->[ws_ship_addr_sk]", getRuntimeFilters(plan)) -} + + ''' + String plan = sql "${stmt}" + println plan + def getRuntimeFilters = { plantree -> + { + def lst = [] + plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { + ch -> + { + lst.add(ch.replaceAll("#\\d+", '')) + } + } + return lst.join(',') + } + } + + //def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.95" + //File file = new File(outFile) + //file.write(getRuntimeFilters(plan)) + + assertEquals("RF3[ws_order_number->[ws_order_number],RF4[wr_order_number->[ws_order_number, ws_order_number],RF5[ws_order_number->[ws_order_number, ws_order_number],RF2[web_site_sk->[ws_web_site_sk],RF1[d_date_sk->[ws_ship_date_sk],RF0[ca_address_sk->[ws_ship_addr_sk]", getRuntimeFilters(plan)) +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf96.groovy b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf96.groovy index 9057e7963082f9..f403956b2317fd 100644 --- a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf96.groovy +++ b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf96.groovy @@ -1,37 +1,37 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -suite("ds_rf96") { - String db = context.config.getDbNameByFile(new File(context.file.parent)) - sql "use ${db}" - sql 'set enable_nereids_planner=true' - sql 'set enable_fallback_to_original_planner=false' - sql 'set exec_mem_limit=21G' - sql 'set be_number_for_test=3' - sql 'set parallel_fragment_exec_instance_num=8; ' - sql 'set parallel_pipeline_task_num=8; ' - sql 'set forbid_unknown_col_stats=true' - sql 'set broadcast_row_count_limit = 30000000' - sql 'set enable_nereids_timeout = false' - sql 'set enable_pipeline_engine=true' - String stmt = ''' - explain physical plan +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +suite("ds_rf96") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_fragment_exec_instance_num=8; ' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set broadcast_row_count_limit = 30000000' + sql 'set enable_nereids_timeout = false' + sql 'set enable_pipeline_engine=true' + String stmt = ''' + explain physical plan select count(*) from store_sales ,household_demographics @@ -45,26 +45,26 @@ where ss_sold_time_sk = time_dim.t_time_sk and store.s_store_name = 'ese' order by count(*) limit 100; - - ''' - String plan = sql "${stmt}" - println plan - def getRuntimeFilters = { plantree -> - { - def lst = [] - plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { - ch -> - { - lst.add(ch.replaceAll("#\\d+", '')) - } - } - return lst.join(',') - } - } - - // def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.96" - // File file = new File(outFile) - // file.write(getRuntimeFilters(plan)) - - assertEquals("RF2[s_store_sk->[ss_store_sk],RF1[hd_demo_sk->[ss_hdemo_sk],RF0[t_time_sk->[ss_sold_time_sk]", getRuntimeFilters(plan)) -} + + ''' + String plan = sql "${stmt}" + println plan + def getRuntimeFilters = { plantree -> + { + def lst = [] + plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { + ch -> + { + lst.add(ch.replaceAll("#\\d+", '')) + } + } + return lst.join(',') + } + } + + //def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.96" + //File file = new File(outFile) + //file.write(getRuntimeFilters(plan)) + + assertEquals("RF2[s_store_sk->[ss_store_sk],RF1[hd_demo_sk->[ss_hdemo_sk],RF0[t_time_sk->[ss_sold_time_sk]", getRuntimeFilters(plan)) +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf97.groovy b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf97.groovy index 38dadc718972fb..6a9ebfdfa9d062 100644 --- a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf97.groovy +++ b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf97.groovy @@ -1,37 +1,37 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -suite("ds_rf97") { - String db = context.config.getDbNameByFile(new File(context.file.parent)) - sql "use ${db}" - sql 'set enable_nereids_planner=true' - sql 'set enable_fallback_to_original_planner=false' - sql 'set exec_mem_limit=21G' - sql 'set be_number_for_test=3' - sql 'set parallel_fragment_exec_instance_num=8; ' - sql 'set parallel_pipeline_task_num=8; ' - sql 'set forbid_unknown_col_stats=true' - sql 'set broadcast_row_count_limit = 30000000' - sql 'set enable_nereids_timeout = false' - sql 'set enable_pipeline_engine=true' - String stmt = ''' - explain physical plan +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +suite("ds_rf97") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_fragment_exec_instance_num=8; ' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set broadcast_row_count_limit = 30000000' + sql 'set enable_nereids_timeout = false' + sql 'set enable_pipeline_engine=true' + String stmt = ''' + explain physical plan with ssci as ( select ss_customer_sk customer_sk ,ss_item_sk item_sk @@ -54,26 +54,26 @@ group by cs_bill_customer_sk from ssci full outer join csci on (ssci.customer_sk=csci.customer_sk and ssci.item_sk = csci.item_sk) limit 100; - - ''' - String plan = sql "${stmt}" - println plan - def getRuntimeFilters = { plantree -> - { - def lst = [] - plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { - ch -> - { - lst.add(ch.replaceAll("#\\d+", '')) - } - } - return lst.join(',') - } - } - - // def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.97" - // File file = new File(outFile) - // file.write(getRuntimeFilters(plan)) - - assertEquals("RF1[d_date_sk->[ss_sold_date_sk],RF0[d_date_sk->[cs_sold_date_sk]", getRuntimeFilters(plan)) -} + + ''' + String plan = sql "${stmt}" + println plan + def getRuntimeFilters = { plantree -> + { + def lst = [] + plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { + ch -> + { + lst.add(ch.replaceAll("#\\d+", '')) + } + } + return lst.join(',') + } + } + + //def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.97" + //File file = new File(outFile) + //file.write(getRuntimeFilters(plan)) + + assertEquals("RF1[d_date_sk->[ss_sold_date_sk],RF0[d_date_sk->[cs_sold_date_sk]", getRuntimeFilters(plan)) +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf98.groovy b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf98.groovy index e9dac0f59e14b0..9ae6869af916db 100644 --- a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf98.groovy +++ b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf98.groovy @@ -1,37 +1,37 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -suite("ds_rf98") { - String db = context.config.getDbNameByFile(new File(context.file.parent)) - sql "use ${db}" - sql 'set enable_nereids_planner=true' - sql 'set enable_fallback_to_original_planner=false' - sql 'set exec_mem_limit=21G' - sql 'set be_number_for_test=3' - sql 'set parallel_fragment_exec_instance_num=8; ' - sql 'set parallel_pipeline_task_num=8; ' - sql 'set forbid_unknown_col_stats=true' - sql 'set broadcast_row_count_limit = 30000000' - sql 'set enable_nereids_timeout = false' - sql 'set enable_pipeline_engine=true' - String stmt = ''' - explain physical plan +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +suite("ds_rf98") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_fragment_exec_instance_num=8; ' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set broadcast_row_count_limit = 30000000' + sql 'set enable_nereids_timeout = false' + sql 'set enable_pipeline_engine=true' + String stmt = ''' + explain physical plan select i_item_id ,i_item_desc ,i_category @@ -62,26 +62,26 @@ order by ,i_item_id ,i_item_desc ,revenueratio; - - ''' - String plan = sql "${stmt}" - println plan - def getRuntimeFilters = { plantree -> - { - def lst = [] - plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { - ch -> - { - lst.add(ch.replaceAll("#\\d+", '')) - } - } - return lst.join(',') - } - } - - // def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.98" - // File file = new File(outFile) - // file.write(getRuntimeFilters(plan)) - - assertEquals("RF1[i_item_sk->[ss_item_sk],RF0[d_date_sk->[ss_sold_date_sk]", getRuntimeFilters(plan)) -} + + ''' + String plan = sql "${stmt}" + println plan + def getRuntimeFilters = { plantree -> + { + def lst = [] + plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { + ch -> + { + lst.add(ch.replaceAll("#\\d+", '')) + } + } + return lst.join(',') + } + } + + //def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.98" + //File file = new File(outFile) + //file.write(getRuntimeFilters(plan)) + + assertEquals("RF1[i_item_sk->[ss_item_sk],RF0[d_date_sk->[ss_sold_date_sk]", getRuntimeFilters(plan)) +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf99.groovy b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf99.groovy index 45f1c7d5bc20f9..376a3857242d07 100644 --- a/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf99.groovy +++ b/regression-test/suites/nereids_tpcds_shape_sf100_p0/rf/ds_rf99.groovy @@ -1,37 +1,37 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -suite("ds_rf99") { - String db = context.config.getDbNameByFile(new File(context.file.parent)) - sql "use ${db}" - sql 'set enable_nereids_planner=true' - sql 'set enable_fallback_to_original_planner=false' - sql 'set exec_mem_limit=21G' - sql 'set be_number_for_test=3' - sql 'set parallel_fragment_exec_instance_num=8; ' - sql 'set parallel_pipeline_task_num=8; ' - sql 'set forbid_unknown_col_stats=true' - sql 'set broadcast_row_count_limit = 30000000' - sql 'set enable_nereids_timeout = false' - sql 'set enable_pipeline_engine=true' - String stmt = ''' - explain physical plan +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +suite("ds_rf99") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + sql "use ${db}" + sql 'set enable_nereids_planner=true' + sql 'set enable_fallback_to_original_planner=false' + sql 'set exec_mem_limit=21G' + sql 'set be_number_for_test=3' + sql 'set parallel_fragment_exec_instance_num=8; ' + sql 'set parallel_pipeline_task_num=8; ' + sql 'set forbid_unknown_col_stats=true' + sql 'set broadcast_row_count_limit = 30000000' + sql 'set enable_nereids_timeout = false' + sql 'set enable_pipeline_engine=true' + String stmt = ''' + explain physical plan select substr(w_warehouse_name,1,20) ,sm_type @@ -64,25 +64,26 @@ order by substr(w_warehouse_name,1,20) ,sm_type ,cc_name limit 100; - - ''' - String plan = sql "${stmt}" - println plan - def getRuntimeFilters = { plantree -> - { - def lst = [] - plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { - ch -> - { - lst.add(ch.replaceAll("#\\d+", '')) - } - } - return lst.join(',') - } - } - - // def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.99" - // File file = new File(outFile) - // file.write(getRuntimeFilters(plan)) - assertEquals("RF3[w_warehouse_sk->[cs_warehouse_sk],RF2[sm_ship_mode_sk->[cs_ship_mode_sk],RF1[cc_call_center_sk->[cs_call_center_sk],RF0[d_date_sk->[cs_ship_date_sk]", getRuntimeFilters(plan)) -} + + ''' + String plan = sql "${stmt}" + println plan + def getRuntimeFilters = { plantree -> + { + def lst = [] + plantree.eachMatch("RF\\d+\\[[^#]+#\\d+->\\[[^\\]]+\\]") { + ch -> + { + lst.add(ch.replaceAll("#\\d+", '')) + } + } + return lst.join(',') + } + } + + //def outFile = "regression-test/suites/nereids_tpcds_shape_sf100_p0/ddl/rf/rf.99" + //File file = new File(outFile) + //file.write(getRuntimeFilters(plan)) + + assertEquals("RF3[w_warehouse_sk->[cs_warehouse_sk],RF2[sm_ship_mode_sk->[cs_ship_mode_sk],RF1[cc_call_center_sk->[cs_call_center_sk],RF0[d_date_sk->[cs_ship_date_sk]", getRuntimeFilters(plan)) +} diff --git a/tools/tpcds-tools/queries/sf100/query1.sql b/tools/tpcds-tools/queries/sf100/query1.sql new file mode 100644 index 00000000000000..6e9870a139fcfc --- /dev/null +++ b/tools/tpcds-tools/queries/sf100/query1.sql @@ -0,0 +1,22 @@ +with customer_total_return as +(select sr_customer_sk as ctr_customer_sk +,sr_store_sk as ctr_store_sk +,sum(SR_FEE) as ctr_total_return +from store_returns +,date_dim +where sr_returned_date_sk = d_date_sk +and d_year =2000 +group by sr_customer_sk +,sr_store_sk) + select c_customer_id +from customer_total_return ctr1 +,store +,customer +where ctr1.ctr_total_return > (select avg(ctr_total_return)*1.2 +from customer_total_return ctr2 +where ctr1.ctr_store_sk = ctr2.ctr_store_sk) +and s_store_sk = ctr1.ctr_store_sk +and s_state = 'SD' +and ctr1.ctr_customer_sk = c_customer_sk +order by c_customer_id +limit 100; diff --git a/tools/tpcds-tools/queries/sf100/query10.sql b/tools/tpcds-tools/queries/sf100/query10.sql new file mode 100644 index 00000000000000..1882148ca22ad1 --- /dev/null +++ b/tools/tpcds-tools/queries/sf100/query10.sql @@ -0,0 +1,56 @@ +select + cd_gender, + cd_marital_status, + cd_education_status, + count(*) cnt1, + cd_purchase_estimate, + count(*) cnt2, + cd_credit_rating, + count(*) cnt3, + cd_dep_count, + count(*) cnt4, + cd_dep_employed_count, + count(*) cnt5, + cd_dep_college_count, + count(*) cnt6 + from + customer c,customer_address ca,customer_demographics + where + c.c_current_addr_sk = ca.ca_address_sk and + ca_county in ('Storey County','Marquette County','Warren County','Cochran County','Kandiyohi County') and + cd_demo_sk = c.c_current_cdemo_sk and + exists (select * + from store_sales,date_dim + where c.c_customer_sk = ss_customer_sk and + ss_sold_date_sk = d_date_sk and + d_year = 2001 and + d_moy between 1 and 1+3) and + (exists (select * + from web_sales,date_dim + where c.c_customer_sk = ws_bill_customer_sk and + ws_sold_date_sk = d_date_sk and + d_year = 2001 and + d_moy between 1 ANd 1+3) or + exists (select * + from catalog_sales,date_dim + where c.c_customer_sk = cs_ship_customer_sk and + cs_sold_date_sk = d_date_sk and + d_year = 2001 and + d_moy between 1 and 1+3)) + group by cd_gender, + cd_marital_status, + cd_education_status, + cd_purchase_estimate, + cd_credit_rating, + cd_dep_count, + cd_dep_employed_count, + cd_dep_college_count + order by cd_gender, + cd_marital_status, + cd_education_status, + cd_purchase_estimate, + cd_credit_rating, + cd_dep_count, + cd_dep_employed_count, + cd_dep_college_count +limit 100; diff --git a/tools/tpcds-tools/queries/sf100/query11.sql b/tools/tpcds-tools/queries/sf100/query11.sql new file mode 100644 index 00000000000000..e035dc8e76b406 --- /dev/null +++ b/tools/tpcds-tools/queries/sf100/query11.sql @@ -0,0 +1,78 @@ +with year_total as ( + select c_customer_id customer_id + ,c_first_name customer_first_name + ,c_last_name customer_last_name + ,c_preferred_cust_flag customer_preferred_cust_flag + ,c_birth_country customer_birth_country + ,c_login customer_login + ,c_email_address customer_email_address + ,d_year dyear + ,sum(ss_ext_list_price-ss_ext_discount_amt) year_total + ,'s' sale_type + from customer + ,store_sales + ,date_dim + where c_customer_sk = ss_customer_sk + and ss_sold_date_sk = d_date_sk + group by c_customer_id + ,c_first_name + ,c_last_name + ,c_preferred_cust_flag + ,c_birth_country + ,c_login + ,c_email_address + ,d_year + union all + select c_customer_id customer_id + ,c_first_name customer_first_name + ,c_last_name customer_last_name + ,c_preferred_cust_flag customer_preferred_cust_flag + ,c_birth_country customer_birth_country + ,c_login customer_login + ,c_email_address customer_email_address + ,d_year dyear + ,sum(ws_ext_list_price-ws_ext_discount_amt) year_total + ,'w' sale_type + from customer + ,web_sales + ,date_dim + where c_customer_sk = ws_bill_customer_sk + and ws_sold_date_sk = d_date_sk + group by c_customer_id + ,c_first_name + ,c_last_name + ,c_preferred_cust_flag + ,c_birth_country + ,c_login + ,c_email_address + ,d_year + ) + select + t_s_secyear.customer_id + ,t_s_secyear.customer_first_name + ,t_s_secyear.customer_last_name + ,t_s_secyear.customer_birth_country + from year_total t_s_firstyear + ,year_total t_s_secyear + ,year_total t_w_firstyear + ,year_total t_w_secyear + where t_s_secyear.customer_id = t_s_firstyear.customer_id + and t_s_firstyear.customer_id = t_w_secyear.customer_id + and t_s_firstyear.customer_id = t_w_firstyear.customer_id + and t_s_firstyear.sale_type = 's' + and t_w_firstyear.sale_type = 'w' + and t_s_secyear.sale_type = 's' + and t_w_secyear.sale_type = 'w' + and t_s_firstyear.dyear = 2001 + and t_s_secyear.dyear = 2001+1 + and t_w_firstyear.dyear = 2001 + and t_w_secyear.dyear = 2001+1 + and t_s_firstyear.year_total > 0 + and t_w_firstyear.year_total > 0 + and case when t_w_firstyear.year_total > 0 then t_w_secyear.year_total / t_w_firstyear.year_total else 0.0 end + > case when t_s_firstyear.year_total > 0 then t_s_secyear.year_total / t_s_firstyear.year_total else 0.0 end + order by t_s_secyear.customer_id + ,t_s_secyear.customer_first_name + ,t_s_secyear.customer_last_name + ,t_s_secyear.customer_birth_country +limit 100; diff --git a/tools/tpcds-tools/queries/sf100/query12.sql b/tools/tpcds-tools/queries/sf100/query12.sql new file mode 100644 index 00000000000000..4186b08e417c9f --- /dev/null +++ b/tools/tpcds-tools/queries/sf100/query12.sql @@ -0,0 +1,31 @@ +select i_item_id + ,i_item_desc + ,i_category + ,i_class + ,i_current_price + ,sum(ws_ext_sales_price) as itemrevenue + ,sum(ws_ext_sales_price)*100/sum(sum(ws_ext_sales_price)) over + (partition by i_class) as revenueratio +from + web_sales + ,item + ,date_dim +where + ws_item_sk = i_item_sk + and i_category in ('Books', 'Sports', 'Men') + and ws_sold_date_sk = d_date_sk + and d_date between cast('1998-04-06' as date) + and (cast('1998-04-06' as date) + interval 30 day) +group by + i_item_id + ,i_item_desc + ,i_category + ,i_class + ,i_current_price +order by + i_category + ,i_class + ,i_item_id + ,i_item_desc + ,revenueratio +limit 100; diff --git a/tools/tpcds-tools/queries/sf100/query13.sql b/tools/tpcds-tools/queries/sf100/query13.sql new file mode 100644 index 00000000000000..756cd9b8c035d0 --- /dev/null +++ b/tools/tpcds-tools/queries/sf100/query13.sql @@ -0,0 +1,49 @@ +select avg(ss_quantity) + ,avg(ss_ext_sales_price) + ,avg(ss_ext_wholesale_cost) + ,sum(ss_ext_wholesale_cost) + from store_sales + ,store + ,customer_demographics + ,household_demographics + ,customer_address + ,date_dim + where s_store_sk = ss_store_sk + and ss_sold_date_sk = d_date_sk and d_year = 2001 + and((ss_hdemo_sk=hd_demo_sk + and cd_demo_sk = ss_cdemo_sk + and cd_marital_status = 'D' + and cd_education_status = 'Unknown' + and ss_sales_price between 100.00 and 150.00 + and hd_dep_count = 3 + )or + (ss_hdemo_sk=hd_demo_sk + and cd_demo_sk = ss_cdemo_sk + and cd_marital_status = 'S' + and cd_education_status = 'College' + and ss_sales_price between 50.00 and 100.00 + and hd_dep_count = 1 + ) or + (ss_hdemo_sk=hd_demo_sk + and cd_demo_sk = ss_cdemo_sk + and cd_marital_status = 'M' + and cd_education_status = '4 yr Degree' + and ss_sales_price between 150.00 and 200.00 + and hd_dep_count = 1 + )) + and((ss_addr_sk = ca_address_sk + and ca_country = 'United States' + and ca_state in ('SD', 'KS', 'MI') + and ss_net_profit between 100 and 200 + ) or + (ss_addr_sk = ca_address_sk + and ca_country = 'United States' + and ca_state in ('MO', 'ND', 'CO') + and ss_net_profit between 150 and 300 + ) or + (ss_addr_sk = ca_address_sk + and ca_country = 'United States' + and ca_state in ('NH', 'OH', 'TX') + and ss_net_profit between 50 and 250 + )) +; diff --git a/tools/tpcds-tools/queries/sf100/query14.sql b/tools/tpcds-tools/queries/sf100/query14.sql new file mode 100644 index 00000000000000..774c54cc183cb1 --- /dev/null +++ b/tools/tpcds-tools/queries/sf100/query14.sql @@ -0,0 +1,207 @@ +with cross_items as + (select i_item_sk ss_item_sk + from item, + (select iss.i_brand_id brand_id + ,iss.i_class_id class_id + ,iss.i_category_id category_id + from store_sales + ,item iss + ,date_dim d1 + where ss_item_sk = iss.i_item_sk + and ss_sold_date_sk = d1.d_date_sk + and d1.d_year between 2000 AND 2000 + 2 + intersect + select ics.i_brand_id + ,ics.i_class_id + ,ics.i_category_id + from catalog_sales + ,item ics + ,date_dim d2 + where cs_item_sk = ics.i_item_sk + and cs_sold_date_sk = d2.d_date_sk + and d2.d_year between 2000 AND 2000 + 2 + intersect + select iws.i_brand_id + ,iws.i_class_id + ,iws.i_category_id + from web_sales + ,item iws + ,date_dim d3 + where ws_item_sk = iws.i_item_sk + and ws_sold_date_sk = d3.d_date_sk + and d3.d_year between 2000 AND 2000 + 2) + t where i_brand_id = brand_id + and i_class_id = class_id + and i_category_id = category_id +), + avg_sales as + (select avg(quantity*list_price) average_sales + from (select ss_quantity quantity + ,ss_list_price list_price + from store_sales + ,date_dim + where ss_sold_date_sk = d_date_sk + and d_year between 2000 and 2000 + 2 + union all + select cs_quantity quantity + ,cs_list_price list_price + from catalog_sales + ,date_dim + where cs_sold_date_sk = d_date_sk + and d_year between 2000 and 2000 + 2 + union all + select ws_quantity quantity + ,ws_list_price list_price + from web_sales + ,date_dim + where ws_sold_date_sk = d_date_sk + and d_year between 2000 and 2000 + 2) x) + select channel, i_brand_id,i_class_id,i_category_id,sum(sales), sum(number_sales) + from( + select 'store' channel, i_brand_id,i_class_id + ,i_category_id,sum(ss_quantity*ss_list_price) sales + , count(*) number_sales + from store_sales + ,item + ,date_dim + where ss_item_sk in (select ss_item_sk from cross_items) + and ss_item_sk = i_item_sk + and ss_sold_date_sk = d_date_sk + and d_year = 2000+2 + and d_moy = 11 + group by i_brand_id,i_class_id,i_category_id + having sum(ss_quantity*ss_list_price) > (select average_sales from avg_sales) + union all + select 'catalog' channel, i_brand_id,i_class_id,i_category_id, sum(cs_quantity*cs_list_price) sales, count(*) number_sales + from catalog_sales + ,item + ,date_dim + where cs_item_sk in (select ss_item_sk from cross_items) + and cs_item_sk = i_item_sk + and cs_sold_date_sk = d_date_sk + and d_year = 2000+2 + and d_moy = 11 + group by i_brand_id,i_class_id,i_category_id + having sum(cs_quantity*cs_list_price) > (select average_sales from avg_sales) + union all + select 'web' channel, i_brand_id,i_class_id,i_category_id, sum(ws_quantity*ws_list_price) sales , count(*) number_sales + from web_sales + ,item + ,date_dim + where ws_item_sk in (select ss_item_sk from cross_items) + and ws_item_sk = i_item_sk + and ws_sold_date_sk = d_date_sk + and d_year = 2000+2 + and d_moy = 11 + group by i_brand_id,i_class_id,i_category_id + having sum(ws_quantity*ws_list_price) > (select average_sales from avg_sales) + ) y + group by rollup (channel, i_brand_id,i_class_id,i_category_id) + order by channel,i_brand_id,i_class_id,i_category_id + limit 100; +with cross_items as + (select i_item_sk ss_item_sk + from item, + (select iss.i_brand_id brand_id + ,iss.i_class_id class_id + ,iss.i_category_id category_id + from store_sales + ,item iss + ,date_dim d1 + where ss_item_sk = iss.i_item_sk + and ss_sold_date_sk = d1.d_date_sk + and d1.d_year between 2000 AND 2000 + 2 + intersect + select ics.i_brand_id + ,ics.i_class_id + ,ics.i_category_id + from catalog_sales + ,item ics + ,date_dim d2 + where cs_item_sk = ics.i_item_sk + and cs_sold_date_sk = d2.d_date_sk + and d2.d_year between 2000 AND 2000 + 2 + intersect + select iws.i_brand_id + ,iws.i_class_id + ,iws.i_category_id + from web_sales + ,item iws + ,date_dim d3 + where ws_item_sk = iws.i_item_sk + and ws_sold_date_sk = d3.d_date_sk + and d3.d_year between 2000 AND 2000 + 2) x + where i_brand_id = brand_id + and i_class_id = class_id + and i_category_id = category_id +), + avg_sales as +(select avg(quantity*list_price) average_sales + from (select ss_quantity quantity + ,ss_list_price list_price + from store_sales + ,date_dim + where ss_sold_date_sk = d_date_sk + and d_year between 2000 and 2000 + 2 + union all + select cs_quantity quantity + ,cs_list_price list_price + from catalog_sales + ,date_dim + where cs_sold_date_sk = d_date_sk + and d_year between 2000 and 2000 + 2 + union all + select ws_quantity quantity + ,ws_list_price list_price + from web_sales + ,date_dim + where ws_sold_date_sk = d_date_sk + and d_year between 2000 and 2000 + 2) x) + select this_year.channel ty_channel + ,this_year.i_brand_id ty_brand + ,this_year.i_class_id ty_class + ,this_year.i_category_id ty_category + ,this_year.sales ty_sales + ,this_year.number_sales ty_number_sales + ,last_year.channel ly_channel + ,last_year.i_brand_id ly_brand + ,last_year.i_class_id ly_class + ,last_year.i_category_id ly_category + ,last_year.sales ly_sales + ,last_year.number_sales ly_number_sales + from + (select 'store' channel, i_brand_id,i_class_id,i_category_id + ,sum(ss_quantity*ss_list_price) sales, count(*) number_sales + from store_sales + ,item + ,date_dim + where ss_item_sk in (select ss_item_sk from cross_items) + and ss_item_sk = i_item_sk + and ss_sold_date_sk = d_date_sk + and d_week_seq = (select d_week_seq + from date_dim + where d_year = 2000 + 1 + and d_moy = 12 + and d_dom = 10) + group by i_brand_id,i_class_id,i_category_id + having sum(ss_quantity*ss_list_price) > (select average_sales from avg_sales)) this_year, + (select 'store' channel, i_brand_id,i_class_id + ,i_category_id, sum(ss_quantity*ss_list_price) sales, count(*) number_sales + from store_sales + ,item + ,date_dim + where ss_item_sk in (select ss_item_sk from cross_items) + and ss_item_sk = i_item_sk + and ss_sold_date_sk = d_date_sk + and d_week_seq = (select d_week_seq + from date_dim + where d_year = 2000 + and d_moy = 12 + and d_dom = 10) + group by i_brand_id,i_class_id,i_category_id + having sum(ss_quantity*ss_list_price) > (select average_sales from avg_sales)) last_year + where this_year.i_brand_id= last_year.i_brand_id + and this_year.i_class_id = last_year.i_class_id + and this_year.i_category_id = last_year.i_category_id + order by this_year.channel, this_year.i_brand_id, this_year.i_class_id, this_year.i_category_id + limit 100; diff --git a/tools/tpcds-tools/queries/sf100/query15.sql b/tools/tpcds-tools/queries/sf100/query15.sql new file mode 100644 index 00000000000000..a72bf89dac55a8 --- /dev/null +++ b/tools/tpcds-tools/queries/sf100/query15.sql @@ -0,0 +1,17 @@ +select ca_zip + ,sum(cs_sales_price) + from catalog_sales + ,customer + ,customer_address + ,date_dim + where cs_bill_customer_sk = c_customer_sk + and c_current_addr_sk = ca_address_sk + and ( substr(ca_zip,1,5) in ('85669', '86197','88274','83405','86475', + '85392', '85460', '80348', '81792') + or ca_state in ('CA','WA','GA') + or cs_sales_price > 500) + and cs_sold_date_sk = d_date_sk + and d_qoy = 1 and d_year = 2001 + group by ca_zip + order by ca_zip + limit 100; diff --git a/tools/tpcds-tools/queries/sf100/query16.sql b/tools/tpcds-tools/queries/sf100/query16.sql new file mode 100644 index 00000000000000..5eb8c7db42636e --- /dev/null +++ b/tools/tpcds-tools/queries/sf100/query16.sql @@ -0,0 +1,28 @@ +select + count(distinct cs_order_number) as "order count" + ,sum(cs_ext_ship_cost) as "total shipping cost" + ,sum(cs_net_profit) as "total net profit" +from + catalog_sales cs1 + ,date_dim + ,customer_address + ,call_center +where + d_date between '2002-4-01' and + (cast('2002-4-01' as date) + interval 60 day) +and cs1.cs_ship_date_sk = d_date_sk +and cs1.cs_ship_addr_sk = ca_address_sk +and ca_state = 'WV' +and cs1.cs_call_center_sk = cc_call_center_sk +and cc_county in ('Ziebach County','Luce County','Richland County','Daviess County', + 'Barrow County' +) +and exists (select * + from catalog_sales cs2 + where cs1.cs_order_number = cs2.cs_order_number + and cs1.cs_warehouse_sk <> cs2.cs_warehouse_sk) +and not exists(select * + from catalog_returns cr1 + where cs1.cs_order_number = cr1.cr_order_number) +order by count(distinct cs_order_number) +limit 100; diff --git a/tools/tpcds-tools/queries/sf100/query17.sql b/tools/tpcds-tools/queries/sf100/query17.sql new file mode 100644 index 00000000000000..02b9c4761c5bb3 --- /dev/null +++ b/tools/tpcds-tools/queries/sf100/query17.sql @@ -0,0 +1,42 @@ +select i_item_id + ,i_item_desc + ,s_state + ,count(ss_quantity) as store_sales_quantitycount + ,avg(ss_quantity) as store_sales_quantityave + ,stddev_samp(ss_quantity) as store_sales_quantitystdev + ,stddev_samp(ss_quantity)/avg(ss_quantity) as store_sales_quantitycov + ,count(sr_return_quantity) as store_returns_quantitycount + ,avg(sr_return_quantity) as store_returns_quantityave + ,stddev_samp(sr_return_quantity) as store_returns_quantitystdev + ,stddev_samp(sr_return_quantity)/avg(sr_return_quantity) as store_returns_quantitycov + ,count(cs_quantity) as catalog_sales_quantitycount ,avg(cs_quantity) as catalog_sales_quantityave + ,stddev_samp(cs_quantity) as catalog_sales_quantitystdev + ,stddev_samp(cs_quantity)/avg(cs_quantity) as catalog_sales_quantitycov + from store_sales + ,store_returns + ,catalog_sales + ,date_dim d1 + ,date_dim d2 + ,date_dim d3 + ,store + ,item + where d1.d_quarter_name = '2001Q1' + and d1.d_date_sk = ss_sold_date_sk + and i_item_sk = ss_item_sk + and s_store_sk = ss_store_sk + and ss_customer_sk = sr_customer_sk + and ss_item_sk = sr_item_sk + and ss_ticket_number = sr_ticket_number + and sr_returned_date_sk = d2.d_date_sk + and d2.d_quarter_name in ('2001Q1','2001Q2','2001Q3') + and sr_customer_sk = cs_bill_customer_sk + and sr_item_sk = cs_item_sk + and cs_sold_date_sk = d3.d_date_sk + and d3.d_quarter_name in ('2001Q1','2001Q2','2001Q3') + group by i_item_id + ,i_item_desc + ,s_state + order by i_item_id + ,i_item_desc + ,s_state +limit 100; diff --git a/tools/tpcds-tools/queries/sf100/query18.sql b/tools/tpcds-tools/queries/sf100/query18.sql new file mode 100644 index 00000000000000..a74eb6e1ee3b6d --- /dev/null +++ b/tools/tpcds-tools/queries/sf100/query18.sql @@ -0,0 +1,31 @@ +select i_item_id, + ca_country, + ca_state, + ca_county, + avg( cast(cs_quantity as decimal(12,2))) agg1, + avg( cast(cs_list_price as decimal(12,2))) agg2, + avg( cast(cs_coupon_amt as decimal(12,2))) agg3, + avg( cast(cs_sales_price as decimal(12,2))) agg4, + avg( cast(cs_net_profit as decimal(12,2))) agg5, + avg( cast(c_birth_year as decimal(12,2))) agg6, + avg( cast(cd1.cd_dep_count as decimal(12,2))) agg7 + from catalog_sales, customer_demographics cd1, + customer_demographics cd2, customer, customer_address, date_dim, item + where cs_sold_date_sk = d_date_sk and + cs_item_sk = i_item_sk and + cs_bill_cdemo_sk = cd1.cd_demo_sk and + cs_bill_customer_sk = c_customer_sk and + cd1.cd_gender = 'F' and + cd1.cd_education_status = 'Advanced Degree' and + c_current_cdemo_sk = cd2.cd_demo_sk and + c_current_addr_sk = ca_address_sk and + c_birth_month in (10,7,8,4,1,2) and + d_year = 1998 and + ca_state in ('WA','GA','NC' + ,'ME','WY','OK','IN') + group by rollup (i_item_id, ca_country, ca_state, ca_county) + order by ca_country, + ca_state, + ca_county, + i_item_id + limit 100; diff --git a/tools/tpcds-tools/queries/sf100/query19.sql b/tools/tpcds-tools/queries/sf100/query19.sql new file mode 100644 index 00000000000000..1c3fe7c2a6fe3f --- /dev/null +++ b/tools/tpcds-tools/queries/sf100/query19.sql @@ -0,0 +1,22 @@ +select i_brand_id brand_id, i_brand brand, i_manufact_id, i_manufact, + sum(ss_ext_sales_price) ext_price + from date_dim, store_sales, item,customer,customer_address,store + where d_date_sk = ss_sold_date_sk + and ss_item_sk = i_item_sk + and i_manager_id=2 + and d_moy=12 + and d_year=1999 + and ss_customer_sk = c_customer_sk + and c_current_addr_sk = ca_address_sk + and substr(ca_zip,1,5) <> substr(s_zip,1,5) + and ss_store_sk = s_store_sk + group by i_brand + ,i_brand_id + ,i_manufact_id + ,i_manufact + order by ext_price desc + ,i_brand + ,i_brand_id + ,i_manufact_id + ,i_manufact +limit 100 ; diff --git a/tools/tpcds-tools/queries/sf100/query2.sql b/tools/tpcds-tools/queries/sf100/query2.sql new file mode 100644 index 00000000000000..5dc50b1156c022 --- /dev/null +++ b/tools/tpcds-tools/queries/sf100/query2.sql @@ -0,0 +1,57 @@ +with wscs as + (select sold_date_sk + ,sales_price + from (select ws_sold_date_sk sold_date_sk + ,ws_ext_sales_price sales_price + from web_sales + union all + select cs_sold_date_sk sold_date_sk + ,cs_ext_sales_price sales_price + from catalog_sales) t), + wswscs as + (select d_week_seq, + sum(case when (d_day_name='Sunday') then sales_price else null end) sun_sales, + sum(case when (d_day_name='Monday') then sales_price else null end) mon_sales, + sum(case when (d_day_name='Tuesday') then sales_price else null end) tue_sales, + sum(case when (d_day_name='Wednesday') then sales_price else null end) wed_sales, + sum(case when (d_day_name='Thursday') then sales_price else null end) thu_sales, + sum(case when (d_day_name='Friday') then sales_price else null end) fri_sales, + sum(case when (d_day_name='Saturday') then sales_price else null end) sat_sales + from wscs + ,date_dim + where d_date_sk = sold_date_sk + group by d_week_seq) + select d_week_seq1 + ,round(sun_sales1/sun_sales2,2) + ,round(mon_sales1/mon_sales2,2) + ,round(tue_sales1/tue_sales2,2) + ,round(wed_sales1/wed_sales2,2) + ,round(thu_sales1/thu_sales2,2) + ,round(fri_sales1/fri_sales2,2) + ,round(sat_sales1/sat_sales2,2) + from + (select wswscs.d_week_seq d_week_seq1 + ,sun_sales sun_sales1 + ,mon_sales mon_sales1 + ,tue_sales tue_sales1 + ,wed_sales wed_sales1 + ,thu_sales thu_sales1 + ,fri_sales fri_sales1 + ,sat_sales sat_sales1 + from wswscs,date_dim + where date_dim.d_week_seq = wswscs.d_week_seq and + d_year = 1998) y, + (select wswscs.d_week_seq d_week_seq2 + ,sun_sales sun_sales2 + ,mon_sales mon_sales2 + ,tue_sales tue_sales2 + ,wed_sales wed_sales2 + ,thu_sales thu_sales2 + ,fri_sales fri_sales2 + ,sat_sales sat_sales2 + from wswscs + ,date_dim + where date_dim.d_week_seq = wswscs.d_week_seq and + d_year = 1998+1) z + where d_week_seq1=d_week_seq2-53 + order by d_week_seq1; diff --git a/tools/tpcds-tools/queries/sf100/query20.sql b/tools/tpcds-tools/queries/sf100/query20.sql new file mode 100644 index 00000000000000..87df997357f458 --- /dev/null +++ b/tools/tpcds-tools/queries/sf100/query20.sql @@ -0,0 +1,27 @@ +select i_item_id + ,i_item_desc + ,i_category + ,i_class + ,i_current_price + ,sum(cs_ext_sales_price) as itemrevenue + ,sum(cs_ext_sales_price)*100/sum(sum(cs_ext_sales_price)) over + (partition by i_class) as revenueratio + from catalog_sales + ,item + ,date_dim + where cs_item_sk = i_item_sk + and i_category in ('Shoes', 'Books', 'Women') + and cs_sold_date_sk = d_date_sk + and d_date between cast('2002-01-26' as date) + and (cast('2002-01-26' as date) + interval 30 day) + group by i_item_id + ,i_item_desc + ,i_category + ,i_class + ,i_current_price + order by i_category + ,i_class + ,i_item_id + ,i_item_desc + ,revenueratio +limit 100; diff --git a/tools/tpcds-tools/queries/sf100/query21.sql b/tools/tpcds-tools/queries/sf100/query21.sql new file mode 100644 index 00000000000000..02fbfc544a656e --- /dev/null +++ b/tools/tpcds-tools/queries/sf100/query21.sql @@ -0,0 +1,27 @@ +select * + from(select w_warehouse_name + ,i_item_id + ,sum(case when (cast(d_date as date) < cast ('2002-02-27' as date)) + then inv_quantity_on_hand + else 0 end) as inv_before + ,sum(case when (cast(d_date as date) >= cast ('2002-02-27' as date)) + then inv_quantity_on_hand + else 0 end) as inv_after + from inventory + ,warehouse + ,item + ,date_dim + where i_current_price between 0.99 and 1.49 + and i_item_sk = inv_item_sk + and inv_warehouse_sk = w_warehouse_sk + and inv_date_sk = d_date_sk + and d_date between (cast ('2002-02-27' as date) - interval 30 day) + and (cast ('2002-02-27' as date) + interval 30 day) + group by w_warehouse_name, i_item_id) x + where (case when inv_before > 0 + then inv_after / inv_before + else null + end) between 2.0/3.0 and 3.0/2.0 + order by w_warehouse_name + ,i_item_id + limit 100; diff --git a/tools/tpcds-tools/queries/sf100/query22.sql b/tools/tpcds-tools/queries/sf100/query22.sql new file mode 100644 index 00000000000000..bd0005f3e586b4 --- /dev/null +++ b/tools/tpcds-tools/queries/sf100/query22.sql @@ -0,0 +1,17 @@ +select i_product_name + ,i_brand + ,i_class + ,i_category + ,avg(inv_quantity_on_hand) qoh + from inventory + ,date_dim + ,item + where inv_date_sk=d_date_sk + and inv_item_sk=i_item_sk + and d_month_seq between 1188 and 1188 + 11 + group by rollup(i_product_name + ,i_brand + ,i_class + ,i_category) +order by qoh, i_product_name, i_brand, i_class, i_category +limit 100; diff --git a/tools/tpcds-tools/queries/sf100/query23.sql b/tools/tpcds-tools/queries/sf100/query23.sql new file mode 100644 index 00000000000000..c5d30837a28731 --- /dev/null +++ b/tools/tpcds-tools/queries/sf100/query23.sql @@ -0,0 +1,104 @@ +with frequent_ss_items as + (select substr(i_item_desc,1,30) itemdesc,i_item_sk item_sk,d_date solddate,count(*) cnt + from store_sales + ,date_dim + ,item + where ss_sold_date_sk = d_date_sk + and ss_item_sk = i_item_sk + and d_year in (2000,2000+1,2000+2,2000+3) + group by substr(i_item_desc,1,30),i_item_sk,d_date + having count(*) >4), + max_store_sales as + (select max(csales) tpcds_cmax + from (select c_customer_sk,sum(ss_quantity*ss_sales_price) csales + from store_sales + ,customer + ,date_dim + where ss_customer_sk = c_customer_sk + and ss_sold_date_sk = d_date_sk + and d_year in (2000,2000+1,2000+2,2000+3) + group by c_customer_sk) t), + best_ss_customer as + (select c_customer_sk,sum(ss_quantity*ss_sales_price) ssales + from store_sales + ,customer + where ss_customer_sk = c_customer_sk + group by c_customer_sk + having sum(ss_quantity*ss_sales_price) > (95/100.0) * (select + * +from + max_store_sales)) + select sum(sales) + from (select cs_quantity*cs_list_price sales + from catalog_sales + ,date_dim + where d_year = 2000 + and d_moy = 5 + and cs_sold_date_sk = d_date_sk + and cs_item_sk in (select item_sk from frequent_ss_items) + and cs_bill_customer_sk in (select c_customer_sk from best_ss_customer) + union all + select ws_quantity*ws_list_price sales + from web_sales + ,date_dim + where d_year = 2000 + and d_moy = 5 + and ws_sold_date_sk = d_date_sk + and ws_item_sk in (select item_sk from frequent_ss_items) + and ws_bill_customer_sk in (select c_customer_sk from best_ss_customer)) t2 + limit 100; +with frequent_ss_items as + (select substr(i_item_desc,1,30) itemdesc,i_item_sk item_sk,d_date solddate,count(*) cnt + from store_sales + ,date_dim + ,item + where ss_sold_date_sk = d_date_sk + and ss_item_sk = i_item_sk + and d_year in (2000,2000 + 1,2000 + 2,2000 + 3) + group by substr(i_item_desc,1,30),i_item_sk,d_date + having count(*) >4), + max_store_sales as + (select max(csales) tpcds_cmax + from (select c_customer_sk,sum(ss_quantity*ss_sales_price) csales + from store_sales + ,customer + ,date_dim + where ss_customer_sk = c_customer_sk + and ss_sold_date_sk = d_date_sk + and d_year in (2000,2000+1,2000+2,2000+3) + group by c_customer_sk) t), + best_ss_customer as + (select c_customer_sk,sum(ss_quantity*ss_sales_price) ssales + from store_sales + ,customer + where ss_customer_sk = c_customer_sk + group by c_customer_sk + having sum(ss_quantity*ss_sales_price) > (95/100.0) * (select + * + from max_store_sales)) + select c_last_name,c_first_name,sales + from (select c_last_name,c_first_name,sum(cs_quantity*cs_list_price) sales + from catalog_sales + ,customer + ,date_dim + where d_year = 2000 + and d_moy = 5 + and cs_sold_date_sk = d_date_sk + and cs_item_sk in (select item_sk from frequent_ss_items) + and cs_bill_customer_sk in (select c_customer_sk from best_ss_customer) + and cs_bill_customer_sk = c_customer_sk + group by c_last_name,c_first_name + union all + select c_last_name,c_first_name,sum(ws_quantity*ws_list_price) sales + from web_sales + ,customer + ,date_dim + where d_year = 2000 + and d_moy = 5 + and ws_sold_date_sk = d_date_sk + and ws_item_sk in (select item_sk from frequent_ss_items) + and ws_bill_customer_sk in (select c_customer_sk from best_ss_customer) + and ws_bill_customer_sk = c_customer_sk + group by c_last_name,c_first_name) t2 + order by c_last_name,c_first_name,sales + limit 100; diff --git a/tools/tpcds-tools/queries/sf100/query24.sql b/tools/tpcds-tools/queries/sf100/query24.sql new file mode 100644 index 00000000000000..27511a97a05c0c --- /dev/null +++ b/tools/tpcds-tools/queries/sf100/query24.sql @@ -0,0 +1,104 @@ +with ssales as +(select c_last_name + ,c_first_name + ,s_store_name + ,ca_state + ,s_state + ,i_color + ,i_current_price + ,i_manager_id + ,i_units + ,i_size + ,sum(ss_net_profit) netpaid +from store_sales + ,store_returns + ,store + ,item + ,customer + ,customer_address +where ss_ticket_number = sr_ticket_number + and ss_item_sk = sr_item_sk + and ss_customer_sk = c_customer_sk + and ss_item_sk = i_item_sk + and ss_store_sk = s_store_sk + and c_current_addr_sk = ca_address_sk + and c_birth_country <> upper(ca_country) + and s_zip = ca_zip +and s_market_id=8 +group by c_last_name + ,c_first_name + ,s_store_name + ,ca_state + ,s_state + ,i_color + ,i_current_price + ,i_manager_id + ,i_units + ,i_size) +select c_last_name + ,c_first_name + ,s_store_name + ,sum(netpaid) paid +from ssales +where i_color = 'beige' +group by c_last_name + ,c_first_name + ,s_store_name +having sum(netpaid) > (select 0.05*avg(netpaid) + from ssales) +order by c_last_name + ,c_first_name + ,s_store_name +; +with ssales as +(select c_last_name + ,c_first_name + ,s_store_name + ,ca_state + ,s_state + ,i_color + ,i_current_price + ,i_manager_id + ,i_units + ,i_size + ,sum(ss_net_profit) netpaid +from store_sales + ,store_returns + ,store + ,item + ,customer + ,customer_address +where ss_ticket_number = sr_ticket_number + and ss_item_sk = sr_item_sk + and ss_customer_sk = c_customer_sk + and ss_item_sk = i_item_sk + and ss_store_sk = s_store_sk + and c_current_addr_sk = ca_address_sk + and c_birth_country <> upper(ca_country) + and s_zip = ca_zip + and s_market_id = 8 +group by c_last_name + ,c_first_name + ,s_store_name + ,ca_state + ,s_state + ,i_color + ,i_current_price + ,i_manager_id + ,i_units + ,i_size) +select c_last_name + ,c_first_name + ,s_store_name + ,sum(netpaid) paid +from ssales +where i_color = 'blue' +group by c_last_name + ,c_first_name + ,s_store_name +having sum(netpaid) > (select 0.05*avg(netpaid) + from ssales) +order by c_last_name + ,c_first_name + ,s_store_name +; diff --git a/tools/tpcds-tools/queries/sf100/query25.sql b/tools/tpcds-tools/queries/sf100/query25.sql new file mode 100644 index 00000000000000..45071c93b7ad05 --- /dev/null +++ b/tools/tpcds-tools/queries/sf100/query25.sql @@ -0,0 +1,45 @@ +select + i_item_id + ,i_item_desc + ,s_store_id + ,s_store_name + ,sum(ss_net_profit) as store_sales_profit + ,sum(sr_net_loss) as store_returns_loss + ,sum(cs_net_profit) as catalog_sales_profit + from + store_sales + ,store_returns + ,catalog_sales + ,date_dim d1 + ,date_dim d2 + ,date_dim d3 + ,store + ,item + where + d1.d_moy = 4 + and d1.d_year = 2000 + and d1.d_date_sk = ss_sold_date_sk + and i_item_sk = ss_item_sk + and s_store_sk = ss_store_sk + and ss_customer_sk = sr_customer_sk + and ss_item_sk = sr_item_sk + and ss_ticket_number = sr_ticket_number + and sr_returned_date_sk = d2.d_date_sk + and d2.d_moy between 4 and 10 + and d2.d_year = 2000 + and sr_customer_sk = cs_bill_customer_sk + and sr_item_sk = cs_item_sk + and cs_sold_date_sk = d3.d_date_sk + and d3.d_moy between 4 and 10 + and d3.d_year = 2000 + group by + i_item_id + ,i_item_desc + ,s_store_id + ,s_store_name + order by + i_item_id + ,i_item_desc + ,s_store_id + ,s_store_name + limit 100; diff --git a/tools/tpcds-tools/queries/sf100/query26.sql b/tools/tpcds-tools/queries/sf100/query26.sql new file mode 100644 index 00000000000000..bb0e93efadcafd --- /dev/null +++ b/tools/tpcds-tools/queries/sf100/query26.sql @@ -0,0 +1,18 @@ +select i_item_id, + avg(cs_quantity) agg1, + avg(cs_list_price) agg2, + avg(cs_coupon_amt) agg3, + avg(cs_sales_price) agg4 + from catalog_sales, customer_demographics, date_dim, item, promotion + where cs_sold_date_sk = d_date_sk and + cs_item_sk = i_item_sk and + cs_bill_cdemo_sk = cd_demo_sk and + cs_promo_sk = p_promo_sk and + cd_gender = 'M' and + cd_marital_status = 'S' and + cd_education_status = 'Unknown' and + (p_channel_email = 'N' or p_channel_event = 'N') and + d_year = 2001 + group by i_item_id + order by i_item_id + limit 100; diff --git a/tools/tpcds-tools/queries/sf100/query27.sql b/tools/tpcds-tools/queries/sf100/query27.sql new file mode 100644 index 00000000000000..53188274c3bd7e --- /dev/null +++ b/tools/tpcds-tools/queries/sf100/query27.sql @@ -0,0 +1,20 @@ +select i_item_id, + s_state, grouping(s_state) g_state, + avg(ss_quantity) agg1, + avg(ss_list_price) agg2, + avg(ss_coupon_amt) agg3, + avg(ss_sales_price) agg4 + from store_sales, customer_demographics, date_dim, store, item + where ss_sold_date_sk = d_date_sk and + ss_item_sk = i_item_sk and + ss_store_sk = s_store_sk and + ss_cdemo_sk = cd_demo_sk and + cd_gender = 'F' and + cd_marital_status = 'D' and + cd_education_status = 'Secondary' and + d_year = 1999 and + s_state in ('MO','AL', 'MI', 'TN', 'LA', 'SC') + group by rollup (i_item_id, s_state) + order by i_item_id + ,s_state + limit 100; diff --git a/tools/tpcds-tools/queries/sf100/query28.sql b/tools/tpcds-tools/queries/sf100/query28.sql new file mode 100644 index 00000000000000..85373e1b97ee07 --- /dev/null +++ b/tools/tpcds-tools/queries/sf100/query28.sql @@ -0,0 +1,50 @@ +select * +from (select avg(ss_list_price) B1_LP + ,count(ss_list_price) B1_CNT + ,count(distinct ss_list_price) B1_CNTD + from store_sales + where ss_quantity between 0 and 5 + and (ss_list_price between 131 and 131+10 + or ss_coupon_amt between 16798 and 16798+1000 + or ss_wholesale_cost between 25 and 25+20)) B1, + (select avg(ss_list_price) B2_LP + ,count(ss_list_price) B2_CNT + ,count(distinct ss_list_price) B2_CNTD + from store_sales + where ss_quantity between 6 and 10 + and (ss_list_price between 145 and 145+10 + or ss_coupon_amt between 14792 and 14792+1000 + or ss_wholesale_cost between 46 and 46+20)) B2, + (select avg(ss_list_price) B3_LP + ,count(ss_list_price) B3_CNT + ,count(distinct ss_list_price) B3_CNTD + from store_sales + where ss_quantity between 11 and 15 + and (ss_list_price between 150 and 150+10 + or ss_coupon_amt between 6600 and 6600+1000 + or ss_wholesale_cost between 9 and 9+20)) B3, + (select avg(ss_list_price) B4_LP + ,count(ss_list_price) B4_CNT + ,count(distinct ss_list_price) B4_CNTD + from store_sales + where ss_quantity between 16 and 20 + and (ss_list_price between 91 and 91+10 + or ss_coupon_amt between 13493 and 13493+1000 + or ss_wholesale_cost between 36 and 36+20)) B4, + (select avg(ss_list_price) B5_LP + ,count(ss_list_price) B5_CNT + ,count(distinct ss_list_price) B5_CNTD + from store_sales + where ss_quantity between 21 and 25 + and (ss_list_price between 0 and 0+10 + or ss_coupon_amt between 7629 and 7629+1000 + or ss_wholesale_cost between 6 and 6+20)) B5, + (select avg(ss_list_price) B6_LP + ,count(ss_list_price) B6_CNT + ,count(distinct ss_list_price) B6_CNTD + from store_sales + where ss_quantity between 26 and 30 + and (ss_list_price between 89 and 89+10 + or ss_coupon_amt between 15257 and 15257+1000 + or ss_wholesale_cost between 31 and 31+20)) B6 +limit 100; diff --git a/tools/tpcds-tools/queries/sf100/query29.sql b/tools/tpcds-tools/queries/sf100/query29.sql new file mode 100644 index 00000000000000..b2d1ac7b3f030f --- /dev/null +++ b/tools/tpcds-tools/queries/sf100/query29.sql @@ -0,0 +1,44 @@ +select + i_item_id + ,i_item_desc + ,s_store_id + ,s_store_name + ,avg(ss_quantity) as store_sales_quantity + ,avg(sr_return_quantity) as store_returns_quantity + ,avg(cs_quantity) as catalog_sales_quantity + from + store_sales + ,store_returns + ,catalog_sales + ,date_dim d1 + ,date_dim d2 + ,date_dim d3 + ,store + ,item + where + d1.d_moy = 4 + and d1.d_year = 1999 + and d1.d_date_sk = ss_sold_date_sk + and i_item_sk = ss_item_sk + and s_store_sk = ss_store_sk + and ss_customer_sk = sr_customer_sk + and ss_item_sk = sr_item_sk + and ss_ticket_number = sr_ticket_number + and sr_returned_date_sk = d2.d_date_sk + and d2.d_moy between 4 and 4 + 3 + and d2.d_year = 1999 + and sr_customer_sk = cs_bill_customer_sk + and sr_item_sk = cs_item_sk + and cs_sold_date_sk = d3.d_date_sk + and d3.d_year in (1999,1999+1,1999+2) + group by + i_item_id + ,i_item_desc + ,s_store_id + ,s_store_name + order by + i_item_id + ,i_item_desc + ,s_store_id + ,s_store_name + limit 100; diff --git a/tools/tpcds-tools/queries/sf100/query3.sql b/tools/tpcds-tools/queries/sf100/query3.sql new file mode 100644 index 00000000000000..6f368b3a2b5280 --- /dev/null +++ b/tools/tpcds-tools/queries/sf100/query3.sql @@ -0,0 +1,18 @@ +select dt.d_year + ,item.i_brand_id brand_id + ,item.i_brand brand + ,sum(ss_sales_price) sum_agg + from date_dim dt + ,store_sales + ,item + where dt.d_date_sk = store_sales.ss_sold_date_sk + and store_sales.ss_item_sk = item.i_item_sk + and item.i_manufact_id = 816 + and dt.d_moy=11 + group by dt.d_year + ,item.i_brand + ,item.i_brand_id + order by dt.d_year + ,sum_agg desc + ,brand_id + limit 100; diff --git a/tools/tpcds-tools/queries/sf100/query30.sql b/tools/tpcds-tools/queries/sf100/query30.sql new file mode 100644 index 00000000000000..74de6b6a0f226e --- /dev/null +++ b/tools/tpcds-tools/queries/sf100/query30.sql @@ -0,0 +1,28 @@ +with customer_total_return as + (select wr_returning_customer_sk as ctr_customer_sk + ,ca_state as ctr_state, + sum(wr_return_amt) as ctr_total_return + from web_returns + ,date_dim + ,customer_address + where wr_returned_date_sk = d_date_sk + and d_year =2002 + and wr_returning_addr_sk = ca_address_sk + group by wr_returning_customer_sk + ,ca_state) + select c_customer_id,c_salutation,c_first_name,c_last_name,c_preferred_cust_flag + ,c_birth_day,c_birth_month,c_birth_year,c_birth_country,c_login,c_email_address + ,c_last_review_date_sk,ctr_total_return + from customer_total_return ctr1 + ,customer_address + ,customer + where ctr1.ctr_total_return > (select avg(ctr_total_return)*1.2 + from customer_total_return ctr2 + where ctr1.ctr_state = ctr2.ctr_state) + and ca_address_sk = c_current_addr_sk + and ca_state = 'IN' + and ctr1.ctr_customer_sk = c_customer_sk + order by c_customer_id,c_salutation,c_first_name,c_last_name,c_preferred_cust_flag + ,c_birth_day,c_birth_month,c_birth_year,c_birth_country,c_login,c_email_address + ,c_last_review_date_sk,ctr_total_return +limit 100; diff --git a/tools/tpcds-tools/queries/sf100/query31.sql b/tools/tpcds-tools/queries/sf100/query31.sql new file mode 100644 index 00000000000000..bc97fc67a4539f --- /dev/null +++ b/tools/tpcds-tools/queries/sf100/query31.sql @@ -0,0 +1,49 @@ +with ss as + (select ca_county,d_qoy, d_year,sum(ss_ext_sales_price) as store_sales + from store_sales,date_dim,customer_address + where ss_sold_date_sk = d_date_sk + and ss_addr_sk=ca_address_sk + group by ca_county,d_qoy, d_year), + ws as + (select ca_county,d_qoy, d_year,sum(ws_ext_sales_price) as web_sales + from web_sales,date_dim,customer_address + where ws_sold_date_sk = d_date_sk + and ws_bill_addr_sk=ca_address_sk + group by ca_county,d_qoy, d_year) + select + ss1.ca_county + ,ss1.d_year + ,ws2.web_sales/ws1.web_sales web_q1_q2_increase + ,ss2.store_sales/ss1.store_sales store_q1_q2_increase + ,ws3.web_sales/ws2.web_sales web_q2_q3_increase + ,ss3.store_sales/ss2.store_sales store_q2_q3_increase + from + ss ss1 + ,ss ss2 + ,ss ss3 + ,ws ws1 + ,ws ws2 + ,ws ws3 + where + ss1.d_qoy = 1 + and ss1.d_year = 2000 + and ss1.ca_county = ss2.ca_county + and ss2.d_qoy = 2 + and ss2.d_year = 2000 + and ss2.ca_county = ss3.ca_county + and ss3.d_qoy = 3 + and ss3.d_year = 2000 + and ss1.ca_county = ws1.ca_county + and ws1.d_qoy = 1 + and ws1.d_year = 2000 + and ws1.ca_county = ws2.ca_county + and ws2.d_qoy = 2 + and ws2.d_year = 2000 + and ws1.ca_county = ws3.ca_county + and ws3.d_qoy = 3 + and ws3.d_year =2000 + and case when ws1.web_sales > 0 then ws2.web_sales/ws1.web_sales else null end + > case when ss1.store_sales > 0 then ss2.store_sales/ss1.store_sales else null end + and case when ws2.web_sales > 0 then ws3.web_sales/ws2.web_sales else null end + > case when ss2.store_sales > 0 then ss3.store_sales/ss2.store_sales else null end + order by web_q1_q2_increase; diff --git a/tools/tpcds-tools/queries/sf100/query32.sql b/tools/tpcds-tools/queries/sf100/query32.sql new file mode 100644 index 00000000000000..7354a3559e4f18 --- /dev/null +++ b/tools/tpcds-tools/queries/sf100/query32.sql @@ -0,0 +1,25 @@ +select sum(cs_ext_discount_amt) as "excess discount amount" +from + catalog_sales + ,item + ,date_dim +where +i_manufact_id = 29 +and i_item_sk = cs_item_sk +and d_date between '1999-01-07' and + (cast('1999-01-07' as date) + interval 90 day) +and d_date_sk = cs_sold_date_sk +and cs_ext_discount_amt + > ( + select + 1.3 * avg(cs_ext_discount_amt) + from + catalog_sales + ,date_dim + where + cs_item_sk = i_item_sk + and d_date between '1999-01-07' and + (cast('1999-01-07' as date) + interval 90 day) + and d_date_sk = cs_sold_date_sk + ) +limit 100; diff --git a/tools/tpcds-tools/queries/sf100/query33.sql b/tools/tpcds-tools/queries/sf100/query33.sql new file mode 100644 index 00000000000000..6722dc4e41a482 --- /dev/null +++ b/tools/tpcds-tools/queries/sf100/query33.sql @@ -0,0 +1,72 @@ +with ss as ( + select + i_manufact_id,sum(ss_ext_sales_price) total_sales + from + store_sales, + date_dim, + customer_address, + item + where + i_manufact_id in (select + i_manufact_id +from + item +where i_category in ('Home')) + and ss_item_sk = i_item_sk + and ss_sold_date_sk = d_date_sk + and d_year = 2002 + and d_moy = 1 + and ss_addr_sk = ca_address_sk + and ca_gmt_offset = -5 + group by i_manufact_id), + cs as ( + select + i_manufact_id,sum(cs_ext_sales_price) total_sales + from + catalog_sales, + date_dim, + customer_address, + item + where + i_manufact_id in (select + i_manufact_id +from + item +where i_category in ('Home')) + and cs_item_sk = i_item_sk + and cs_sold_date_sk = d_date_sk + and d_year = 2002 + and d_moy = 1 + and cs_bill_addr_sk = ca_address_sk + and ca_gmt_offset = -5 + group by i_manufact_id), + ws as ( + select + i_manufact_id,sum(ws_ext_sales_price) total_sales + from + web_sales, + date_dim, + customer_address, + item + where + i_manufact_id in (select + i_manufact_id +from + item +where i_category in ('Home')) + and ws_item_sk = i_item_sk + and ws_sold_date_sk = d_date_sk + and d_year = 2002 + and d_moy = 1 + and ws_bill_addr_sk = ca_address_sk + and ca_gmt_offset = -5 + group by i_manufact_id) + select i_manufact_id ,sum(total_sales) total_sales + from (select * from ss + union all + select * from cs + union all + select * from ws) tmp1 + group by i_manufact_id + order by total_sales +limit 100; diff --git a/tools/tpcds-tools/queries/sf100/query34.sql b/tools/tpcds-tools/queries/sf100/query34.sql new file mode 100644 index 00000000000000..3b38134d1e649f --- /dev/null +++ b/tools/tpcds-tools/queries/sf100/query34.sql @@ -0,0 +1,28 @@ +select c_last_name + ,c_first_name + ,c_salutation + ,c_preferred_cust_flag + ,ss_ticket_number + ,cnt from + (select ss_ticket_number + ,ss_customer_sk + ,count(*) cnt + from store_sales,date_dim,store,household_demographics + where store_sales.ss_sold_date_sk = date_dim.d_date_sk + and store_sales.ss_store_sk = store.s_store_sk + and store_sales.ss_hdemo_sk = household_demographics.hd_demo_sk + and (date_dim.d_dom between 1 and 3 or date_dim.d_dom between 25 and 28) + and (household_demographics.hd_buy_potential = '1001-5000' or + household_demographics.hd_buy_potential = '0-500') + and household_demographics.hd_vehicle_count > 0 + and (case when household_demographics.hd_vehicle_count > 0 + then household_demographics.hd_dep_count/ household_demographics.hd_vehicle_count + else null + end) > 1.2 + and date_dim.d_year in (1998,1998+1,1998+2) + and store.s_county in ('Ziebach County','Daviess County','Walker County','Richland County', + 'Barrow County','Franklin Parish','Williamson County','Luce County') + group by ss_ticket_number,ss_customer_sk) dn,customer + where ss_customer_sk = c_customer_sk + and cnt between 15 and 20 + order by c_last_name,c_first_name,c_salutation,c_preferred_cust_flag desc, ss_ticket_number; diff --git a/tools/tpcds-tools/queries/sf100/query35.sql b/tools/tpcds-tools/queries/sf100/query35.sql new file mode 100644 index 00000000000000..89c084c6a35041 --- /dev/null +++ b/tools/tpcds-tools/queries/sf100/query35.sql @@ -0,0 +1,55 @@ +select + ca_state, + cd_gender, + cd_marital_status, + cd_dep_count, + count(*) cnt1, + max(cd_dep_count), + sum(cd_dep_count), + max(cd_dep_count), + cd_dep_employed_count, + count(*) cnt2, + max(cd_dep_employed_count), + sum(cd_dep_employed_count), + max(cd_dep_employed_count), + cd_dep_college_count, + count(*) cnt3, + max(cd_dep_college_count), + sum(cd_dep_college_count), + max(cd_dep_college_count) + from + customer c,customer_address ca,customer_demographics + where + c.c_current_addr_sk = ca.ca_address_sk and + cd_demo_sk = c.c_current_cdemo_sk and + exists (select * + from store_sales,date_dim + where c.c_customer_sk = ss_customer_sk and + ss_sold_date_sk = d_date_sk and + d_year = 2001 and + d_qoy < 4) and + (exists (select * + from web_sales,date_dim + where c.c_customer_sk = ws_bill_customer_sk and + ws_sold_date_sk = d_date_sk and + d_year = 2001 and + d_qoy < 4) or + exists (select * + from catalog_sales,date_dim + where c.c_customer_sk = cs_ship_customer_sk and + cs_sold_date_sk = d_date_sk and + d_year = 2001 and + d_qoy < 4)) + group by ca_state, + cd_gender, + cd_marital_status, + cd_dep_count, + cd_dep_employed_count, + cd_dep_college_count + order by ca_state, + cd_gender, + cd_marital_status, + cd_dep_count, + cd_dep_employed_count, + cd_dep_college_count + limit 100; diff --git a/tools/tpcds-tools/queries/sf100/query36.sql b/tools/tpcds-tools/queries/sf100/query36.sql new file mode 100644 index 00000000000000..bdf702683bcde5 --- /dev/null +++ b/tools/tpcds-tools/queries/sf100/query36.sql @@ -0,0 +1,27 @@ +select + sum(ss_net_profit)/sum(ss_ext_sales_price) as gross_margin + ,i_category + ,i_class + ,grouping(i_category)+grouping(i_class) as lochierarchy + ,rank() over ( + partition by grouping(i_category)+grouping(i_class), + case when grouping(i_class) = 0 then i_category end + order by sum(ss_net_profit)/sum(ss_ext_sales_price) asc) as rank_within_parent + from + store_sales + ,date_dim d1 + ,item + ,store + where + d1.d_year = 2002 + and d1.d_date_sk = ss_sold_date_sk + and i_item_sk = ss_item_sk + and s_store_sk = ss_store_sk + and s_state in ('SD','TN','GA','SC', + 'MO','AL','MI','OH') + group by rollup(i_category,i_class) + order by + lochierarchy desc + ,case when lochierarchy = 0 then i_category end + ,rank_within_parent + limit 100; diff --git a/tools/tpcds-tools/queries/sf100/query37.sql b/tools/tpcds-tools/queries/sf100/query37.sql new file mode 100644 index 00000000000000..8e629d4a1af7bf --- /dev/null +++ b/tools/tpcds-tools/queries/sf100/query37.sql @@ -0,0 +1,14 @@ +select i_item_id + ,i_item_desc + ,i_current_price + from item, inventory, date_dim, catalog_sales + where i_current_price between 45 and 45 + 30 + and inv_item_sk = i_item_sk + and d_date_sk=inv_date_sk + and d_date between cast('1999-02-21' as date) and (cast('1999-02-21' as date) + interval 60 day) + and i_manufact_id in (856,707,1000,747) + and inv_quantity_on_hand between 100 and 500 + and cs_item_sk = i_item_sk + group by i_item_id,i_item_desc,i_current_price + order by i_item_id + limit 100; diff --git a/tools/tpcds-tools/queries/sf100/query38.sql b/tools/tpcds-tools/queries/sf100/query38.sql new file mode 100644 index 00000000000000..2eb3d5a5e2d5a8 --- /dev/null +++ b/tools/tpcds-tools/queries/sf100/query38.sql @@ -0,0 +1,20 @@ +select count(*) from ( + select distinct c_last_name, c_first_name, d_date + from store_sales, date_dim, customer + where store_sales.ss_sold_date_sk = date_dim.d_date_sk + and store_sales.ss_customer_sk = customer.c_customer_sk + and d_month_seq between 1183 and 1183 + 11 + intersect + select distinct c_last_name, c_first_name, d_date + from catalog_sales, date_dim, customer + where catalog_sales.cs_sold_date_sk = date_dim.d_date_sk + and catalog_sales.cs_bill_customer_sk = customer.c_customer_sk + and d_month_seq between 1183 and 1183 + 11 + intersect + select distinct c_last_name, c_first_name, d_date + from web_sales, date_dim, customer + where web_sales.ws_sold_date_sk = date_dim.d_date_sk + and web_sales.ws_bill_customer_sk = customer.c_customer_sk + and d_month_seq between 1183 and 1183 + 11 +) hot_cust +limit 100; diff --git a/tools/tpcds-tools/queries/sf100/query39.sql b/tools/tpcds-tools/queries/sf100/query39.sql new file mode 100644 index 00000000000000..0fc09ed47ec3f7 --- /dev/null +++ b/tools/tpcds-tools/queries/sf100/query39.sql @@ -0,0 +1,50 @@ +with inv as +(select w_warehouse_name,w_warehouse_sk,i_item_sk,d_moy + ,stdev,mean, case mean when 0 then null else stdev/mean end cov + from(select w_warehouse_name,w_warehouse_sk,i_item_sk,d_moy + ,stddev_samp(inv_quantity_on_hand) stdev,avg(inv_quantity_on_hand) mean + from inventory + ,item + ,warehouse + ,date_dim + where inv_item_sk = i_item_sk + and inv_warehouse_sk = w_warehouse_sk + and inv_date_sk = d_date_sk + and d_year =1998 + group by w_warehouse_name,w_warehouse_sk,i_item_sk,d_moy) foo + where case mean when 0 then 0 else stdev/mean end > 1) +select inv1.w_warehouse_sk,inv1.i_item_sk,inv1.d_moy,inv1.mean, inv1.cov + ,inv2.w_warehouse_sk,inv2.i_item_sk,inv2.d_moy,inv2.mean, inv2.cov +from inv inv1,inv inv2 +where inv1.i_item_sk = inv2.i_item_sk + and inv1.w_warehouse_sk = inv2.w_warehouse_sk + and inv1.d_moy=1 + and inv2.d_moy=1+1 +order by inv1.w_warehouse_sk,inv1.i_item_sk,inv1.d_moy,inv1.mean,inv1.cov + ,inv2.d_moy,inv2.mean, inv2.cov; +with inv as +(select w_warehouse_name,w_warehouse_sk,i_item_sk,d_moy + ,stdev,mean, case mean when 0 then null else stdev/mean end cov + from(select w_warehouse_name,w_warehouse_sk,i_item_sk,d_moy + ,stddev_samp(inv_quantity_on_hand) stdev,avg(inv_quantity_on_hand) mean + from inventory + ,item + ,warehouse + ,date_dim + where inv_item_sk = i_item_sk + and inv_warehouse_sk = w_warehouse_sk + and inv_date_sk = d_date_sk + and d_year =1998 + group by w_warehouse_name,w_warehouse_sk,i_item_sk,d_moy) foo + where case mean when 0 then 0 else stdev/mean end > 1) +select inv1.w_warehouse_sk,inv1.i_item_sk,inv1.d_moy,inv1.mean, inv1.cov + ,inv2.w_warehouse_sk,inv2.i_item_sk,inv2.d_moy,inv2.mean, inv2.cov +from inv inv1,inv inv2 +where inv1.i_item_sk = inv2.i_item_sk + and inv1.w_warehouse_sk = inv2.w_warehouse_sk + and inv1.d_moy=1 + and inv2.d_moy=1+1 + and inv1.cov > 1.5 +order by inv1.w_warehouse_sk,inv1.i_item_sk,inv1.d_moy,inv1.mean,inv1.cov + ,inv2.d_moy,inv2.mean, inv2.cov +; diff --git a/tools/tpcds-tools/queries/sf100/query4.sql b/tools/tpcds-tools/queries/sf100/query4.sql new file mode 100644 index 00000000000000..99d6806f73d77a --- /dev/null +++ b/tools/tpcds-tools/queries/sf100/query4.sql @@ -0,0 +1,113 @@ +with year_total as ( + select c_customer_id customer_id + ,c_first_name customer_first_name + ,c_last_name customer_last_name + ,c_preferred_cust_flag customer_preferred_cust_flag + ,c_birth_country customer_birth_country + ,c_login customer_login + ,c_email_address customer_email_address + ,d_year dyear + ,sum(((ss_ext_list_price-ss_ext_wholesale_cost-ss_ext_discount_amt)+ss_ext_sales_price)/2) year_total + ,'s' sale_type + from customer + ,store_sales + ,date_dim + where c_customer_sk = ss_customer_sk + and ss_sold_date_sk = d_date_sk + group by c_customer_id + ,c_first_name + ,c_last_name + ,c_preferred_cust_flag + ,c_birth_country + ,c_login + ,c_email_address + ,d_year + union all + select c_customer_id customer_id + ,c_first_name customer_first_name + ,c_last_name customer_last_name + ,c_preferred_cust_flag customer_preferred_cust_flag + ,c_birth_country customer_birth_country + ,c_login customer_login + ,c_email_address customer_email_address + ,d_year dyear + ,sum((((cs_ext_list_price-cs_ext_wholesale_cost-cs_ext_discount_amt)+cs_ext_sales_price)/2) ) year_total + ,'c' sale_type + from customer + ,catalog_sales + ,date_dim + where c_customer_sk = cs_bill_customer_sk + and cs_sold_date_sk = d_date_sk + group by c_customer_id + ,c_first_name + ,c_last_name + ,c_preferred_cust_flag + ,c_birth_country + ,c_login + ,c_email_address + ,d_year +union all + select c_customer_id customer_id + ,c_first_name customer_first_name + ,c_last_name customer_last_name + ,c_preferred_cust_flag customer_preferred_cust_flag + ,c_birth_country customer_birth_country + ,c_login customer_login + ,c_email_address customer_email_address + ,d_year dyear + ,sum((((ws_ext_list_price-ws_ext_wholesale_cost-ws_ext_discount_amt)+ws_ext_sales_price)/2) ) year_total + ,'w' sale_type + from customer + ,web_sales + ,date_dim + where c_customer_sk = ws_bill_customer_sk + and ws_sold_date_sk = d_date_sk + group by c_customer_id + ,c_first_name + ,c_last_name + ,c_preferred_cust_flag + ,c_birth_country + ,c_login + ,c_email_address + ,d_year + ) + select + t_s_secyear.customer_id + ,t_s_secyear.customer_first_name + ,t_s_secyear.customer_last_name + ,t_s_secyear.customer_birth_country + from year_total t_s_firstyear + ,year_total t_s_secyear + ,year_total t_c_firstyear + ,year_total t_c_secyear + ,year_total t_w_firstyear + ,year_total t_w_secyear + where t_s_secyear.customer_id = t_s_firstyear.customer_id + and t_s_firstyear.customer_id = t_c_secyear.customer_id + and t_s_firstyear.customer_id = t_c_firstyear.customer_id + and t_s_firstyear.customer_id = t_w_firstyear.customer_id + and t_s_firstyear.customer_id = t_w_secyear.customer_id + and t_s_firstyear.sale_type = 's' + and t_c_firstyear.sale_type = 'c' + and t_w_firstyear.sale_type = 'w' + and t_s_secyear.sale_type = 's' + and t_c_secyear.sale_type = 'c' + and t_w_secyear.sale_type = 'w' + and t_s_firstyear.dyear = 1999 + and t_s_secyear.dyear = 1999+1 + and t_c_firstyear.dyear = 1999 + and t_c_secyear.dyear = 1999+1 + and t_w_firstyear.dyear = 1999 + and t_w_secyear.dyear = 1999+1 + and t_s_firstyear.year_total > 0 + and t_c_firstyear.year_total > 0 + and t_w_firstyear.year_total > 0 + and case when t_c_firstyear.year_total > 0 then t_c_secyear.year_total / t_c_firstyear.year_total else null end + > case when t_s_firstyear.year_total > 0 then t_s_secyear.year_total / t_s_firstyear.year_total else null end + and case when t_c_firstyear.year_total > 0 then t_c_secyear.year_total / t_c_firstyear.year_total else null end + > case when t_w_firstyear.year_total > 0 then t_w_secyear.year_total / t_w_firstyear.year_total else null end + order by t_s_secyear.customer_id + ,t_s_secyear.customer_first_name + ,t_s_secyear.customer_last_name + ,t_s_secyear.customer_birth_country +limit 100; diff --git a/tools/tpcds-tools/queries/sf100/query40.sql b/tools/tpcds-tools/queries/sf100/query40.sql new file mode 100644 index 00000000000000..f58e9832bea7fd --- /dev/null +++ b/tools/tpcds-tools/queries/sf100/query40.sql @@ -0,0 +1,25 @@ +select + w_state + ,i_item_id + ,sum(case when (cast(d_date as date) < cast ('2001-04-02' as date)) + then cs_sales_price - coalesce(cr_refunded_cash,0) else 0 end) as sales_before + ,sum(case when (cast(d_date as date) >= cast ('2001-04-02' as date)) + then cs_sales_price - coalesce(cr_refunded_cash,0) else 0 end) as sales_after + from + catalog_sales left outer join catalog_returns on + (cs_order_number = cr_order_number + and cs_item_sk = cr_item_sk) + ,warehouse + ,item + ,date_dim + where + i_current_price between 0.99 and 1.49 + and i_item_sk = cs_item_sk + and cs_warehouse_sk = w_warehouse_sk + and cs_sold_date_sk = d_date_sk + and d_date between (cast ('2001-04-02' as date) - interval 30 day) + and (cast ('2001-04-02' as date) + interval 30 day) + group by + w_state,i_item_id + order by w_state,i_item_id +limit 100; diff --git a/tools/tpcds-tools/queries/sf100/query41.sql b/tools/tpcds-tools/queries/sf100/query41.sql new file mode 100644 index 00000000000000..9b18b7730458d1 --- /dev/null +++ b/tools/tpcds-tools/queries/sf100/query41.sql @@ -0,0 +1,49 @@ +select distinct(i_product_name) + from item i1 + where i_manufact_id between 748 and 748+40 + and (select count(*) as item_cnt + from item + where (i_manufact = i1.i_manufact and + ((i_category = 'Women' and + (i_color = 'gainsboro' or i_color = 'aquamarine') and + (i_units = 'Ounce' or i_units = 'Dozen') and + (i_size = 'medium' or i_size = 'economy') + ) or + (i_category = 'Women' and + (i_color = 'chiffon' or i_color = 'violet') and + (i_units = 'Ton' or i_units = 'Pound') and + (i_size = 'extra large' or i_size = 'small') + ) or + (i_category = 'Men' and + (i_color = 'chartreuse' or i_color = 'blue') and + (i_units = 'Each' or i_units = 'Oz') and + (i_size = 'N/A' or i_size = 'large') + ) or + (i_category = 'Men' and + (i_color = 'tan' or i_color = 'dodger') and + (i_units = 'Bunch' or i_units = 'Tsp') and + (i_size = 'medium' or i_size = 'economy') + ))) or + (i_manufact = i1.i_manufact and + ((i_category = 'Women' and + (i_color = 'blanched' or i_color = 'tomato') and + (i_units = 'Tbl' or i_units = 'Case') and + (i_size = 'medium' or i_size = 'economy') + ) or + (i_category = 'Women' and + (i_color = 'almond' or i_color = 'lime') and + (i_units = 'Box' or i_units = 'Dram') and + (i_size = 'extra large' or i_size = 'small') + ) or + (i_category = 'Men' and + (i_color = 'peru' or i_color = 'saddle') and + (i_units = 'Pallet' or i_units = 'Gram') and + (i_size = 'N/A' or i_size = 'large') + ) or + (i_category = 'Men' and + (i_color = 'indian' or i_color = 'spring') and + (i_units = 'Unknown' or i_units = 'Carton') and + (i_size = 'medium' or i_size = 'economy') + )))) > 0 + order by i_product_name + limit 100; diff --git a/tools/tpcds-tools/queries/sf100/query42.sql b/tools/tpcds-tools/queries/sf100/query42.sql new file mode 100644 index 00000000000000..feeae1f477cd2e --- /dev/null +++ b/tools/tpcds-tools/queries/sf100/query42.sql @@ -0,0 +1,19 @@ +select dt.d_year + ,item.i_category_id + ,item.i_category + ,sum(ss_ext_sales_price) + from date_dim dt + ,store_sales + ,item + where dt.d_date_sk = store_sales.ss_sold_date_sk + and store_sales.ss_item_sk = item.i_item_sk + and item.i_manager_id = 1 + and dt.d_moy=11 + and dt.d_year=2002 + group by dt.d_year + ,item.i_category_id + ,item.i_category + order by sum(ss_ext_sales_price) desc,dt.d_year + ,item.i_category_id + ,item.i_category +limit 100 ; diff --git a/tools/tpcds-tools/queries/sf100/query43.sql b/tools/tpcds-tools/queries/sf100/query43.sql new file mode 100644 index 00000000000000..b1caee29169466 --- /dev/null +++ b/tools/tpcds-tools/queries/sf100/query43.sql @@ -0,0 +1,16 @@ +select s_store_name, s_store_id, + sum(case when (d_day_name='Sunday') then ss_sales_price else null end) sun_sales, + sum(case when (d_day_name='Monday') then ss_sales_price else null end) mon_sales, + sum(case when (d_day_name='Tuesday') then ss_sales_price else null end) tue_sales, + sum(case when (d_day_name='Wednesday') then ss_sales_price else null end) wed_sales, + sum(case when (d_day_name='Thursday') then ss_sales_price else null end) thu_sales, + sum(case when (d_day_name='Friday') then ss_sales_price else null end) fri_sales, + sum(case when (d_day_name='Saturday') then ss_sales_price else null end) sat_sales + from date_dim, store_sales, store + where d_date_sk = ss_sold_date_sk and + s_store_sk = ss_store_sk and + s_gmt_offset = -5 and + d_year = 2000 + group by s_store_name, s_store_id + order by s_store_name, s_store_id,sun_sales,mon_sales,tue_sales,wed_sales,thu_sales,fri_sales,sat_sales + limit 100; diff --git a/tools/tpcds-tools/queries/sf100/query44.sql b/tools/tpcds-tools/queries/sf100/query44.sql new file mode 100644 index 00000000000000..9ea5a01c40c40a --- /dev/null +++ b/tools/tpcds-tools/queries/sf100/query44.sql @@ -0,0 +1,32 @@ +select asceding.rnk, i1.i_product_name best_performing, i2.i_product_name worst_performing +from(select * + from (select item_sk,rank() over (order by rank_col asc) rnk + from (select ss_item_sk item_sk,avg(ss_net_profit) rank_col + from store_sales ss1 + where ss_store_sk = 146 + group by ss_item_sk + having avg(ss_net_profit) > 0.9*(select avg(ss_net_profit) rank_col + from store_sales + where ss_store_sk = 146 + and ss_addr_sk is null + group by ss_store_sk))V1)V11 + where rnk < 11) asceding, + (select * + from (select item_sk,rank() over (order by rank_col desc) rnk + from (select ss_item_sk item_sk,avg(ss_net_profit) rank_col + from store_sales ss1 + where ss_store_sk = 146 + group by ss_item_sk + having avg(ss_net_profit) > 0.9*(select avg(ss_net_profit) rank_col + from store_sales + where ss_store_sk = 146 + and ss_addr_sk is null + group by ss_store_sk))V2)V21 + where rnk < 11) descending, +item i1, +item i2 +where asceding.rnk = descending.rnk + and i1.i_item_sk=asceding.item_sk + and i2.i_item_sk=descending.item_sk +order by asceding.rnk +limit 100; diff --git a/tools/tpcds-tools/queries/sf100/query45.sql b/tools/tpcds-tools/queries/sf100/query45.sql new file mode 100644 index 00000000000000..74b438bf6ad7d8 --- /dev/null +++ b/tools/tpcds-tools/queries/sf100/query45.sql @@ -0,0 +1,17 @@ +select ca_zip, ca_city, sum(ws_sales_price) + from web_sales, customer, customer_address, date_dim, item + where ws_bill_customer_sk = c_customer_sk + and c_current_addr_sk = ca_address_sk + and ws_item_sk = i_item_sk + and ( substr(ca_zip,1,5) in ('85669', '86197','88274','83405','86475', '85392', '85460', '80348', '81792') + or + i_item_id in (select i_item_id + from item + where i_item_sk in (2, 3, 5, 7, 11, 13, 17, 19, 23, 29) + ) + ) + and ws_sold_date_sk = d_date_sk + and d_qoy = 2 and d_year = 2000 + group by ca_zip, ca_city + order by ca_zip, ca_city + limit 100; diff --git a/tools/tpcds-tools/queries/sf100/query46.sql b/tools/tpcds-tools/queries/sf100/query46.sql new file mode 100644 index 00000000000000..0d68b5598bdf91 --- /dev/null +++ b/tools/tpcds-tools/queries/sf100/query46.sql @@ -0,0 +1,32 @@ +select c_last_name + ,c_first_name + ,ca_city + ,bought_city + ,ss_ticket_number + ,amt,profit + from + (select ss_ticket_number + ,ss_customer_sk + ,ca_city bought_city + ,sum(ss_coupon_amt) amt + ,sum(ss_net_profit) profit + from store_sales,date_dim,store,household_demographics,customer_address + where store_sales.ss_sold_date_sk = date_dim.d_date_sk + and store_sales.ss_store_sk = store.s_store_sk + and store_sales.ss_hdemo_sk = household_demographics.hd_demo_sk + and store_sales.ss_addr_sk = customer_address.ca_address_sk + and (household_demographics.hd_dep_count = 6 or + household_demographics.hd_vehicle_count= 0) + and date_dim.d_dow in (6,0) + and date_dim.d_year in (1999,1999+1,1999+2) + and store.s_city in ('Five Points','Centerville','Oak Grove','Fairview','Liberty') + group by ss_ticket_number,ss_customer_sk,ss_addr_sk,ca_city) dn,customer,customer_address current_addr + where ss_customer_sk = c_customer_sk + and customer.c_current_addr_sk = current_addr.ca_address_sk + and current_addr.ca_city <> bought_city + order by c_last_name + ,c_first_name + ,ca_city + ,bought_city + ,ss_ticket_number + limit 100; diff --git a/tools/tpcds-tools/queries/sf100/query47.sql b/tools/tpcds-tools/queries/sf100/query47.sql new file mode 100644 index 00000000000000..99ce15253b0b2c --- /dev/null +++ b/tools/tpcds-tools/queries/sf100/query47.sql @@ -0,0 +1,48 @@ +with v1 as( + select i_category, i_brand, + s_store_name, s_company_name, + d_year, d_moy, + sum(ss_sales_price) sum_sales, + avg(sum(ss_sales_price)) over + (partition by i_category, i_brand, + s_store_name, s_company_name, d_year) + avg_monthly_sales, + rank() over + (partition by i_category, i_brand, + s_store_name, s_company_name + order by d_year, d_moy) rn + from item, store_sales, date_dim, store + where ss_item_sk = i_item_sk and + ss_sold_date_sk = d_date_sk and + ss_store_sk = s_store_sk and + ( + d_year = 2001 or + ( d_year = 2001-1 and d_moy =12) or + ( d_year = 2001+1 and d_moy =1) + ) + group by i_category, i_brand, + s_store_name, s_company_name, + d_year, d_moy), + v2 as( + select v1.s_store_name + ,v1.d_year + ,v1.avg_monthly_sales + ,v1.sum_sales, v1_lag.sum_sales psum, v1_lead.sum_sales nsum + from v1, v1 v1_lag, v1 v1_lead + where v1.i_category = v1_lag.i_category and + v1.i_category = v1_lead.i_category and + v1.i_brand = v1_lag.i_brand and + v1.i_brand = v1_lead.i_brand and + v1.s_store_name = v1_lag.s_store_name and + v1.s_store_name = v1_lead.s_store_name and + v1.s_company_name = v1_lag.s_company_name and + v1.s_company_name = v1_lead.s_company_name and + v1.rn = v1_lag.rn + 1 and + v1.rn = v1_lead.rn - 1) + select * + from v2 + where d_year = 2001 and + avg_monthly_sales > 0 and + case when avg_monthly_sales > 0 then abs(sum_sales - avg_monthly_sales) / avg_monthly_sales else null end > 0.1 + order by sum_sales - avg_monthly_sales, nsum + limit 100; diff --git a/tools/tpcds-tools/queries/sf100/query48.sql b/tools/tpcds-tools/queries/sf100/query48.sql new file mode 100644 index 00000000000000..1bece14032d095 --- /dev/null +++ b/tools/tpcds-tools/queries/sf100/query48.sql @@ -0,0 +1,64 @@ +select sum (ss_quantity) + from store_sales, store, customer_demographics, customer_address, date_dim + where s_store_sk = ss_store_sk + and ss_sold_date_sk = d_date_sk and d_year = 1999 + and + ( + ( + cd_demo_sk = ss_cdemo_sk + and + cd_marital_status = 'U' + and + cd_education_status = 'Primary' + and + ss_sales_price between 100.00 and 150.00 + ) + or + ( + cd_demo_sk = ss_cdemo_sk + and + cd_marital_status = 'W' + and + cd_education_status = 'College' + and + ss_sales_price between 50.00 and 100.00 + ) + or + ( + cd_demo_sk = ss_cdemo_sk + and + cd_marital_status = 'D' + and + cd_education_status = '2 yr Degree' + and + ss_sales_price between 150.00 and 200.00 + ) + ) + and + ( + ( + ss_addr_sk = ca_address_sk + and + ca_country = 'United States' + and + ca_state in ('MD', 'MN', 'IA') + and ss_net_profit between 0 and 2000 + ) + or + (ss_addr_sk = ca_address_sk + and + ca_country = 'United States' + and + ca_state in ('VA', 'IL', 'TX') + and ss_net_profit between 150 and 3000 + ) + or + (ss_addr_sk = ca_address_sk + and + ca_country = 'United States' + and + ca_state in ('MI', 'WI', 'IN') + and ss_net_profit between 50 and 25000 + ) + ) +; diff --git a/tools/tpcds-tools/queries/sf100/query49.sql b/tools/tpcds-tools/queries/sf100/query49.sql new file mode 100644 index 00000000000000..55d573fc67f756 --- /dev/null +++ b/tools/tpcds-tools/queries/sf100/query49.sql @@ -0,0 +1,126 @@ +select channel, item, return_ratio, return_rank, currency_rank from + (select + 'web' as channel + ,web.item + ,web.return_ratio + ,web.return_rank + ,web.currency_rank + from ( + select + item + ,return_ratio + ,currency_ratio + ,rank() over (order by return_ratio) as return_rank + ,rank() over (order by currency_ratio) as currency_rank + from + ( select ws.ws_item_sk as item + ,(cast(sum(coalesce(wr.wr_return_quantity,0)) as decimal(15,4))/ + cast(sum(coalesce(ws.ws_quantity,0)) as decimal(15,4) )) as return_ratio + ,(cast(sum(coalesce(wr.wr_return_amt,0)) as decimal(15,4))/ + cast(sum(coalesce(ws.ws_net_paid,0)) as decimal(15,4) )) as currency_ratio + from + web_sales ws left outer join web_returns wr + on (ws.ws_order_number = wr.wr_order_number and + ws.ws_item_sk = wr.wr_item_sk) + ,date_dim + where + wr.wr_return_amt > 10000 + and ws.ws_net_profit > 1 + and ws.ws_net_paid > 0 + and ws.ws_quantity > 0 + and ws_sold_date_sk = d_date_sk + and d_year = 1999 + and d_moy = 12 + group by ws.ws_item_sk + ) in_web + ) web + where + ( + web.return_rank <= 10 + or + web.currency_rank <= 10 + ) + union + select + 'catalog' as channel + ,catalog.item + ,catalog.return_ratio + ,catalog.return_rank + ,catalog.currency_rank + from ( + select + item + ,return_ratio + ,currency_ratio + ,rank() over (order by return_ratio) as return_rank + ,rank() over (order by currency_ratio) as currency_rank + from + ( select + cs.cs_item_sk as item + ,(cast(sum(coalesce(cr.cr_return_quantity,0)) as decimal(15,4))/ + cast(sum(coalesce(cs.cs_quantity,0)) as decimal(15,4) )) as return_ratio + ,(cast(sum(coalesce(cr.cr_return_amount,0)) as decimal(15,4))/ + cast(sum(coalesce(cs.cs_net_paid,0)) as decimal(15,4) )) as currency_ratio + from + catalog_sales cs left outer join catalog_returns cr + on (cs.cs_order_number = cr.cr_order_number and + cs.cs_item_sk = cr.cr_item_sk) + ,date_dim + where + cr.cr_return_amount > 10000 + and cs.cs_net_profit > 1 + and cs.cs_net_paid > 0 + and cs.cs_quantity > 0 + and cs_sold_date_sk = d_date_sk + and d_year = 1999 + and d_moy = 12 + group by cs.cs_item_sk + ) in_cat + ) catalog + where + ( + catalog.return_rank <= 10 + or + catalog.currency_rank <=10 + ) + union + select + 'store' as channel + ,store.item + ,store.return_ratio + ,store.return_rank + ,store.currency_rank + from ( + select + item + ,return_ratio + ,currency_ratio + ,rank() over (order by return_ratio) as return_rank + ,rank() over (order by currency_ratio) as currency_rank + from + ( select sts.ss_item_sk as item + ,(cast(sum(coalesce(sr.sr_return_quantity,0)) as decimal(15,4))/cast(sum(coalesce(sts.ss_quantity,0)) as decimal(15,4) )) as return_ratio + ,(cast(sum(coalesce(sr.sr_return_amt,0)) as decimal(15,4))/cast(sum(coalesce(sts.ss_net_paid,0)) as decimal(15,4) )) as currency_ratio + from + store_sales sts left outer join store_returns sr + on (sts.ss_ticket_number = sr.sr_ticket_number and sts.ss_item_sk = sr.sr_item_sk) + ,date_dim + where + sr.sr_return_amt > 10000 + and sts.ss_net_profit > 1 + and sts.ss_net_paid > 0 + and sts.ss_quantity > 0 + and ss_sold_date_sk = d_date_sk + and d_year = 1999 + and d_moy = 12 + group by sts.ss_item_sk + ) in_store + ) store + where ( + store.return_rank <= 10 + or + store.currency_rank <= 10 + ) + ) + t order by 1,4,5,2 + limit 100; diff --git a/tools/tpcds-tools/queries/sf100/query5.sql b/tools/tpcds-tools/queries/sf100/query5.sql new file mode 100644 index 00000000000000..96c97b7c8a1636 --- /dev/null +++ b/tools/tpcds-tools/queries/sf100/query5.sql @@ -0,0 +1,125 @@ +with ssr as + (select s_store_id, + sum(sales_price) as sales, + sum(profit) as profit, + sum(return_amt) as returns, + sum(net_loss) as profit_loss + from + ( select ss_store_sk as store_sk, + ss_sold_date_sk as date_sk, + ss_ext_sales_price as sales_price, + ss_net_profit as profit, + cast(0 as decimal(7,2)) as return_amt, + cast(0 as decimal(7,2)) as net_loss + from store_sales + union all + select sr_store_sk as store_sk, + sr_returned_date_sk as date_sk, + cast(0 as decimal(7,2)) as sales_price, + cast(0 as decimal(7,2)) as profit, + sr_return_amt as return_amt, + sr_net_loss as net_loss + from store_returns + ) salesreturns, + date_dim, + store + where date_sk = d_date_sk + and d_date between cast('2000-08-19' as date) + and (cast('2000-08-19' as date) + interval 14 day) + and store_sk = s_store_sk + group by s_store_id) + , + csr as + (select cp_catalog_page_id, + sum(sales_price) as sales, + sum(profit) as profit, + sum(return_amt) as returns, + sum(net_loss) as profit_loss + from + ( select cs_catalog_page_sk as page_sk, + cs_sold_date_sk as date_sk, + cs_ext_sales_price as sales_price, + cs_net_profit as profit, + cast(0 as decimal(7,2)) as return_amt, + cast(0 as decimal(7,2)) as net_loss + from catalog_sales + union all + select cr_catalog_page_sk as page_sk, + cr_returned_date_sk as date_sk, + cast(0 as decimal(7,2)) as sales_price, + cast(0 as decimal(7,2)) as profit, + cr_return_amount as return_amt, + cr_net_loss as net_loss + from catalog_returns + ) salesreturns, + date_dim, + catalog_page + where date_sk = d_date_sk + and d_date between cast('2000-08-19' as date) + and (cast('2000-08-19' as date) + interval 14 day) + and page_sk = cp_catalog_page_sk + group by cp_catalog_page_id) + , + wsr as + (select web_site_id, + sum(sales_price) as sales, + sum(profit) as profit, + sum(return_amt) as returns, + sum(net_loss) as profit_loss + from + ( select ws_web_site_sk as wsr_web_site_sk, + ws_sold_date_sk as date_sk, + ws_ext_sales_price as sales_price, + ws_net_profit as profit, + cast(0 as decimal(7,2)) as return_amt, + cast(0 as decimal(7,2)) as net_loss + from web_sales + union all + select ws_web_site_sk as wsr_web_site_sk, + wr_returned_date_sk as date_sk, + cast(0 as decimal(7,2)) as sales_price, + cast(0 as decimal(7,2)) as profit, + wr_return_amt as return_amt, + wr_net_loss as net_loss + from web_returns left outer join web_sales on + ( wr_item_sk = ws_item_sk + and wr_order_number = ws_order_number) + ) salesreturns, + date_dim, + web_site + where date_sk = d_date_sk + and d_date between cast('2000-08-19' as date) + and (cast('2000-08-19' as date) + interval 14 day) + and wsr_web_site_sk = web_site_sk + group by web_site_id) + select channel + , id + , sum(sales) as sales + , sum(returns) as returns + , sum(profit) as profit + from + (select 'store channel' as channel + , concat('store', s_store_id) id + , sales + , returns + , (profit - profit_loss) as profit + from ssr + union all + select 'catalog channel' as channel + , concat('catalog_page', cp_catalog_page_id) id + , sales + , returns + , (profit - profit_loss) as profit + from csr + union all + select 'web channel' as channel + , concat('web_site', web_site_id) id + , sales + , returns + , (profit - profit_loss) as profit + from wsr + ) x + group by rollup (channel, id) + order by channel + ,id + limit 100; diff --git a/tools/tpcds-tools/queries/sf100/query50.sql b/tools/tpcds-tools/queries/sf100/query50.sql new file mode 100644 index 00000000000000..2a45d211cc3628 --- /dev/null +++ b/tools/tpcds-tools/queries/sf100/query50.sql @@ -0,0 +1,56 @@ +select + s_store_name + ,s_company_id + ,s_street_number + ,s_street_name + ,s_street_type + ,s_suite_number + ,s_city + ,s_county + ,s_state + ,s_zip + ,sum(case when (sr_returned_date_sk - ss_sold_date_sk <= 30 ) then 1 else 0 end) as "30 days" + ,sum(case when (sr_returned_date_sk - ss_sold_date_sk > 30) and + (sr_returned_date_sk - ss_sold_date_sk <= 60) then 1 else 0 end ) as "31-60 days" + ,sum(case when (sr_returned_date_sk - ss_sold_date_sk > 60) and + (sr_returned_date_sk - ss_sold_date_sk <= 90) then 1 else 0 end) as "61-90 days" + ,sum(case when (sr_returned_date_sk - ss_sold_date_sk > 90) and + (sr_returned_date_sk - ss_sold_date_sk <= 120) then 1 else 0 end) as "91-120 days" + ,sum(case when (sr_returned_date_sk - ss_sold_date_sk > 120) then 1 else 0 end) as ">120 days" +from + store_sales + ,store_returns + ,store + ,date_dim d1 + ,date_dim d2 +where + d2.d_year = 2001 +and d2.d_moy = 8 +and ss_ticket_number = sr_ticket_number +and ss_item_sk = sr_item_sk +and ss_sold_date_sk = d1.d_date_sk +and sr_returned_date_sk = d2.d_date_sk +and ss_customer_sk = sr_customer_sk +and ss_store_sk = s_store_sk +group by + s_store_name + ,s_company_id + ,s_street_number + ,s_street_name + ,s_street_type + ,s_suite_number + ,s_city + ,s_county + ,s_state + ,s_zip +order by s_store_name + ,s_company_id + ,s_street_number + ,s_street_name + ,s_street_type + ,s_suite_number + ,s_city + ,s_county + ,s_state + ,s_zip +limit 100; diff --git a/tools/tpcds-tools/queries/sf100/query51.sql b/tools/tpcds-tools/queries/sf100/query51.sql new file mode 100644 index 00000000000000..13ce18f18d3b5e --- /dev/null +++ b/tools/tpcds-tools/queries/sf100/query51.sql @@ -0,0 +1,42 @@ +WITH web_v1 as ( +select + ws_item_sk item_sk, d_date, + sum(sum(ws_sales_price)) + over (partition by ws_item_sk order by d_date rows between unbounded preceding and current row) cume_sales +from web_sales + ,date_dim +where ws_sold_date_sk=d_date_sk + and d_month_seq between 1216 and 1216+11 + and ws_item_sk is not NULL +group by ws_item_sk, d_date), +store_v1 as ( +select + ss_item_sk item_sk, d_date, + sum(sum(ss_sales_price)) + over (partition by ss_item_sk order by d_date rows between unbounded preceding and current row) cume_sales +from store_sales + ,date_dim +where ss_sold_date_sk=d_date_sk + and d_month_seq between 1216 and 1216+11 + and ss_item_sk is not NULL +group by ss_item_sk, d_date) + select * +from (select item_sk + ,d_date + ,web_sales + ,store_sales + ,max(web_sales) + over (partition by item_sk order by d_date rows between unbounded preceding and current row) web_cumulative + ,max(store_sales) + over (partition by item_sk order by d_date rows between unbounded preceding and current row) store_cumulative + from (select case when web.item_sk is not null then web.item_sk else store.item_sk end item_sk + ,case when web.d_date is not null then web.d_date else store.d_date end d_date + ,web.cume_sales web_sales + ,store.cume_sales store_sales + from web_v1 web full outer join store_v1 store on (web.item_sk = store.item_sk + and web.d_date = store.d_date) + )x )y +where web_cumulative > store_cumulative +order by item_sk + ,d_date +limit 100; diff --git a/tools/tpcds-tools/queries/sf100/query52.sql b/tools/tpcds-tools/queries/sf100/query52.sql new file mode 100644 index 00000000000000..897fe285fdcbf4 --- /dev/null +++ b/tools/tpcds-tools/queries/sf100/query52.sql @@ -0,0 +1,19 @@ +select dt.d_year + ,item.i_brand_id brand_id + ,item.i_brand brand + ,sum(ss_ext_sales_price) ext_price + from date_dim dt + ,store_sales + ,item + where dt.d_date_sk = store_sales.ss_sold_date_sk + and store_sales.ss_item_sk = item.i_item_sk + and item.i_manager_id = 1 + and dt.d_moy=12 + and dt.d_year=2002 + group by dt.d_year + ,item.i_brand + ,item.i_brand_id + order by dt.d_year + ,ext_price desc + ,brand_id +limit 100 ; diff --git a/tools/tpcds-tools/queries/sf100/query53.sql b/tools/tpcds-tools/queries/sf100/query53.sql new file mode 100644 index 00000000000000..38b9b22517b29d --- /dev/null +++ b/tools/tpcds-tools/queries/sf100/query53.sql @@ -0,0 +1,25 @@ +select * from +(select i_manufact_id, +sum(ss_sales_price) sum_sales, +avg(sum(ss_sales_price)) over (partition by i_manufact_id) avg_quarterly_sales +from item, store_sales, date_dim, store +where ss_item_sk = i_item_sk and +ss_sold_date_sk = d_date_sk and +ss_store_sk = s_store_sk and +d_month_seq in (1200,1200+1,1200+2,1200+3,1200+4,1200+5,1200+6,1200+7,1200+8,1200+9,1200+10,1200+11) and +((i_category in ('Books','Children','Electronics') and +i_class in ('personal','portable','reference','self-help') and +i_brand in ('scholaramalgamalg #14','scholaramalgamalg #7', + 'exportiunivamalg #9','scholaramalgamalg #9')) +or(i_category in ('Women','Music','Men') and +i_class in ('accessories','classical','fragrances','pants') and +i_brand in ('amalgimporto #1','edu packscholar #1','exportiimporto #1', + 'importoamalg #1'))) +group by i_manufact_id, d_qoy ) tmp1 +where case when avg_quarterly_sales > 0 + then abs (sum_sales - avg_quarterly_sales)/ avg_quarterly_sales + else null end > 0.1 +order by avg_quarterly_sales, + sum_sales, + i_manufact_id +limit 100; diff --git a/tools/tpcds-tools/queries/sf100/query54.sql b/tools/tpcds-tools/queries/sf100/query54.sql new file mode 100644 index 00000000000000..9064eb44be454a --- /dev/null +++ b/tools/tpcds-tools/queries/sf100/query54.sql @@ -0,0 +1,53 @@ +with my_customers as ( + select distinct c_customer_sk + , c_current_addr_sk + from + ( select cs_sold_date_sk sold_date_sk, + cs_bill_customer_sk customer_sk, + cs_item_sk item_sk + from catalog_sales + union all + select ws_sold_date_sk sold_date_sk, + ws_bill_customer_sk customer_sk, + ws_item_sk item_sk + from web_sales + ) cs_or_ws_sales, + item, + date_dim, + customer + where sold_date_sk = d_date_sk + and item_sk = i_item_sk + and i_category = 'Women' + and i_class = 'maternity' + and c_customer_sk = cs_or_ws_sales.customer_sk + and d_moy = 5 + and d_year = 1998 + ) + , my_revenue as ( + select c_customer_sk, + sum(ss_ext_sales_price) as revenue + from my_customers, + store_sales, + customer_address, + store, + date_dim + where c_current_addr_sk = ca_address_sk + and ca_county = s_county + and ca_state = s_state + and ss_sold_date_sk = d_date_sk + and c_customer_sk = ss_customer_sk + and d_month_seq between (select distinct d_month_seq+1 + from date_dim where d_year = 1998 and d_moy = 5) + and (select distinct d_month_seq+3 + from date_dim where d_year = 1998 and d_moy = 5) + group by c_customer_sk + ) + , segments as + (select cast((revenue/50) as int) as segment + from my_revenue + ) + select segment, count(*) as num_customers, segment*50 as segment_base + from segments + group by segment + order by segment, num_customers + limit 100; diff --git a/tools/tpcds-tools/queries/sf100/query55.sql b/tools/tpcds-tools/queries/sf100/query55.sql new file mode 100644 index 00000000000000..320cf9310f9118 --- /dev/null +++ b/tools/tpcds-tools/queries/sf100/query55.sql @@ -0,0 +1,11 @@ +select i_brand_id brand_id, i_brand brand, + sum(ss_ext_sales_price) ext_price + from date_dim, store_sales, item + where d_date_sk = ss_sold_date_sk + and ss_item_sk = i_item_sk + and i_manager_id=100 + and d_moy=12 + and d_year=2000 + group by i_brand, i_brand_id + order by ext_price desc, i_brand_id +limit 100 ; diff --git a/tools/tpcds-tools/queries/sf100/query56.sql b/tools/tpcds-tools/queries/sf100/query56.sql new file mode 100644 index 00000000000000..49d40b7e1b7e62 --- /dev/null +++ b/tools/tpcds-tools/queries/sf100/query56.sql @@ -0,0 +1,66 @@ +with ss as ( + select i_item_id,sum(ss_ext_sales_price) total_sales + from + store_sales, + date_dim, + customer_address, + item + where i_item_id in (select + i_item_id +from item +where i_color in ('powder','green','cyan')) + and ss_item_sk = i_item_sk + and ss_sold_date_sk = d_date_sk + and d_year = 2000 + and d_moy = 2 + and ss_addr_sk = ca_address_sk + and ca_gmt_offset = -6 + group by i_item_id), + cs as ( + select i_item_id,sum(cs_ext_sales_price) total_sales + from + catalog_sales, + date_dim, + customer_address, + item + where + i_item_id in (select + i_item_id +from item +where i_color in ('powder','green','cyan')) + and cs_item_sk = i_item_sk + and cs_sold_date_sk = d_date_sk + and d_year = 2000 + and d_moy = 2 + and cs_bill_addr_sk = ca_address_sk + and ca_gmt_offset = -6 + group by i_item_id), + ws as ( + select i_item_id,sum(ws_ext_sales_price) total_sales + from + web_sales, + date_dim, + customer_address, + item + where + i_item_id in (select + i_item_id +from item +where i_color in ('powder','green','cyan')) + and ws_item_sk = i_item_sk + and ws_sold_date_sk = d_date_sk + and d_year = 2000 + and d_moy = 2 + and ws_bill_addr_sk = ca_address_sk + and ca_gmt_offset = -6 + group by i_item_id) + select i_item_id ,sum(total_sales) total_sales + from (select * from ss + union all + select * from cs + union all + select * from ws) tmp1 + group by i_item_id + order by total_sales, + i_item_id + limit 100; diff --git a/tools/tpcds-tools/queries/sf100/query57.sql b/tools/tpcds-tools/queries/sf100/query57.sql new file mode 100644 index 00000000000000..9c283ad9dcaa2a --- /dev/null +++ b/tools/tpcds-tools/queries/sf100/query57.sql @@ -0,0 +1,45 @@ +with v1 as( + select i_category, i_brand, + cc_name, + d_year, d_moy, + sum(cs_sales_price) sum_sales, + avg(sum(cs_sales_price)) over + (partition by i_category, i_brand, + cc_name, d_year) + avg_monthly_sales, + rank() over + (partition by i_category, i_brand, + cc_name + order by d_year, d_moy) rn + from item, catalog_sales, date_dim, call_center + where cs_item_sk = i_item_sk and + cs_sold_date_sk = d_date_sk and + cc_call_center_sk= cs_call_center_sk and + ( + d_year = 1999 or + ( d_year = 1999-1 and d_moy =12) or + ( d_year = 1999+1 and d_moy =1) + ) + group by i_category, i_brand, + cc_name , d_year, d_moy), + v2 as( + select v1.i_brand + ,v1.d_year + ,v1.avg_monthly_sales + ,v1.sum_sales, v1_lag.sum_sales psum, v1_lead.sum_sales nsum + from v1, v1 v1_lag, v1 v1_lead + where v1.i_category = v1_lag.i_category and + v1.i_category = v1_lead.i_category and + v1.i_brand = v1_lag.i_brand and + v1.i_brand = v1_lead.i_brand and + v1. cc_name = v1_lag. cc_name and + v1. cc_name = v1_lead. cc_name and + v1.rn = v1_lag.rn + 1 and + v1.rn = v1_lead.rn - 1) + select * + from v2 + where d_year = 1999 and + avg_monthly_sales > 0 and + case when avg_monthly_sales > 0 then abs(sum_sales - avg_monthly_sales) / avg_monthly_sales else null end > 0.1 + order by sum_sales - avg_monthly_sales, nsum + limit 100; diff --git a/tools/tpcds-tools/queries/sf100/query58.sql b/tools/tpcds-tools/queries/sf100/query58.sql new file mode 100644 index 00000000000000..c56f31b018097e --- /dev/null +++ b/tools/tpcds-tools/queries/sf100/query58.sql @@ -0,0 +1,62 @@ +with ss_items as + (select i_item_id item_id + ,sum(ss_ext_sales_price) ss_item_rev + from store_sales + ,item + ,date_dim + where ss_item_sk = i_item_sk + and d_date in (select d_date + from date_dim + where d_week_seq = (select d_week_seq + from date_dim + where d_date = '2001-03-24')) + and ss_sold_date_sk = d_date_sk + group by i_item_id), + cs_items as + (select i_item_id item_id + ,sum(cs_ext_sales_price) cs_item_rev + from catalog_sales + ,item + ,date_dim + where cs_item_sk = i_item_sk + and d_date in (select d_date + from date_dim + where d_week_seq = (select d_week_seq + from date_dim + where d_date = '2001-03-24')) + and cs_sold_date_sk = d_date_sk + group by i_item_id), + ws_items as + (select i_item_id item_id + ,sum(ws_ext_sales_price) ws_item_rev + from web_sales + ,item + ,date_dim + where ws_item_sk = i_item_sk + and d_date in (select d_date + from date_dim + where d_week_seq =(select d_week_seq + from date_dim + where d_date = '2001-03-24')) + and ws_sold_date_sk = d_date_sk + group by i_item_id) + select ss_items.item_id + ,ss_item_rev + ,ss_item_rev/((ss_item_rev+cs_item_rev+ws_item_rev)/3) * 100 ss_dev + ,cs_item_rev + ,cs_item_rev/((ss_item_rev+cs_item_rev+ws_item_rev)/3) * 100 cs_dev + ,ws_item_rev + ,ws_item_rev/((ss_item_rev+cs_item_rev+ws_item_rev)/3) * 100 ws_dev + ,(ss_item_rev+cs_item_rev+ws_item_rev)/3 average + from ss_items,cs_items,ws_items + where ss_items.item_id=cs_items.item_id + and ss_items.item_id=ws_items.item_id + and ss_item_rev between 0.9 * cs_item_rev and 1.1 * cs_item_rev + and ss_item_rev between 0.9 * ws_item_rev and 1.1 * ws_item_rev + and cs_item_rev between 0.9 * ss_item_rev and 1.1 * ss_item_rev + and cs_item_rev between 0.9 * ws_item_rev and 1.1 * ws_item_rev + and ws_item_rev between 0.9 * ss_item_rev and 1.1 * ss_item_rev + and ws_item_rev between 0.9 * cs_item_rev and 1.1 * cs_item_rev + order by item_id + ,ss_item_rev + limit 100; diff --git a/tools/tpcds-tools/queries/sf100/query59.sql b/tools/tpcds-tools/queries/sf100/query59.sql new file mode 100644 index 00000000000000..58ce6fb19011a6 --- /dev/null +++ b/tools/tpcds-tools/queries/sf100/query59.sql @@ -0,0 +1,41 @@ +with wss as + (select d_week_seq, + ss_store_sk, + sum(case when (d_day_name='Sunday') then ss_sales_price else null end) sun_sales, + sum(case when (d_day_name='Monday') then ss_sales_price else null end) mon_sales, + sum(case when (d_day_name='Tuesday') then ss_sales_price else null end) tue_sales, + sum(case when (d_day_name='Wednesday') then ss_sales_price else null end) wed_sales, + sum(case when (d_day_name='Thursday') then ss_sales_price else null end) thu_sales, + sum(case when (d_day_name='Friday') then ss_sales_price else null end) fri_sales, + sum(case when (d_day_name='Saturday') then ss_sales_price else null end) sat_sales + from store_sales,date_dim + where d_date_sk = ss_sold_date_sk + group by d_week_seq,ss_store_sk + ) + select s_store_name1,s_store_id1,d_week_seq1 + ,sun_sales1/sun_sales2,mon_sales1/mon_sales2 + ,tue_sales1/tue_sales2,wed_sales1/wed_sales2,thu_sales1/thu_sales2 + ,fri_sales1/fri_sales2,sat_sales1/sat_sales2 + from + (select s_store_name s_store_name1,wss.d_week_seq d_week_seq1 + ,s_store_id s_store_id1,sun_sales sun_sales1 + ,mon_sales mon_sales1,tue_sales tue_sales1 + ,wed_sales wed_sales1,thu_sales thu_sales1 + ,fri_sales fri_sales1,sat_sales sat_sales1 + from wss,store,date_dim d + where d.d_week_seq = wss.d_week_seq and + ss_store_sk = s_store_sk and + d_month_seq between 1196 and 1196 + 11) y, + (select s_store_name s_store_name2,wss.d_week_seq d_week_seq2 + ,s_store_id s_store_id2,sun_sales sun_sales2 + ,mon_sales mon_sales2,tue_sales tue_sales2 + ,wed_sales wed_sales2,thu_sales thu_sales2 + ,fri_sales fri_sales2,sat_sales sat_sales2 + from wss,store,date_dim d + where d.d_week_seq = wss.d_week_seq and + ss_store_sk = s_store_sk and + d_month_seq between 1196+ 12 and 1196 + 23) x + where s_store_id1=s_store_id2 + and d_week_seq1=d_week_seq2-52 + order by s_store_name1,s_store_id1,d_week_seq1 +limit 100; diff --git a/tools/tpcds-tools/queries/sf100/query6.sql b/tools/tpcds-tools/queries/sf100/query6.sql new file mode 100644 index 00000000000000..00decd2cdc48a5 --- /dev/null +++ b/tools/tpcds-tools/queries/sf100/query6.sql @@ -0,0 +1,23 @@ +select a.ca_state state, count(*) cnt + from customer_address a + ,customer c + ,store_sales s + ,date_dim d + ,item i + where a.ca_address_sk = c.c_current_addr_sk + and c.c_customer_sk = s.ss_customer_sk + and s.ss_sold_date_sk = d.d_date_sk + and s.ss_item_sk = i.i_item_sk + and d.d_month_seq = + (select distinct (d_month_seq) + from date_dim + where d_year = 2002 + and d_moy = 3 ) + and i.i_current_price > 1.2 * + (select avg(j.i_current_price) + from item j + where j.i_category = i.i_category) + group by a.ca_state + having count(*) >= 10 + order by cnt, a.ca_state + limit 100; diff --git a/tools/tpcds-tools/queries/sf100/query60.sql b/tools/tpcds-tools/queries/sf100/query60.sql new file mode 100644 index 00000000000000..aa8b46bbb9b8d0 --- /dev/null +++ b/tools/tpcds-tools/queries/sf100/query60.sql @@ -0,0 +1,75 @@ +with ss as ( + select + i_item_id,sum(ss_ext_sales_price) total_sales + from + store_sales, + date_dim, + customer_address, + item + where + i_item_id in (select + i_item_id +from + item +where i_category in ('Children')) + and ss_item_sk = i_item_sk + and ss_sold_date_sk = d_date_sk + and d_year = 2000 + and d_moy = 8 + and ss_addr_sk = ca_address_sk + and ca_gmt_offset = -7 + group by i_item_id), + cs as ( + select + i_item_id,sum(cs_ext_sales_price) total_sales + from + catalog_sales, + date_dim, + customer_address, + item + where + i_item_id in (select + i_item_id +from + item +where i_category in ('Children')) + and cs_item_sk = i_item_sk + and cs_sold_date_sk = d_date_sk + and d_year = 2000 + and d_moy = 8 + and cs_bill_addr_sk = ca_address_sk + and ca_gmt_offset = -7 + group by i_item_id), + ws as ( + select + i_item_id,sum(ws_ext_sales_price) total_sales + from + web_sales, + date_dim, + customer_address, + item + where + i_item_id in (select + i_item_id +from + item +where i_category in ('Children')) + and ws_item_sk = i_item_sk + and ws_sold_date_sk = d_date_sk + and d_year = 2000 + and d_moy = 8 + and ws_bill_addr_sk = ca_address_sk + and ca_gmt_offset = -7 + group by i_item_id) + select + i_item_id +,sum(total_sales) total_sales + from (select * from ss + union all + select * from cs + union all + select * from ws) tmp1 + group by i_item_id + order by i_item_id + ,total_sales + limit 100; diff --git a/tools/tpcds-tools/queries/sf100/query61.sql b/tools/tpcds-tools/queries/sf100/query61.sql new file mode 100644 index 00000000000000..520dbcf847df80 --- /dev/null +++ b/tools/tpcds-tools/queries/sf100/query61.sql @@ -0,0 +1,41 @@ +select promotions,total,cast(promotions as decimal(15,4))/cast(total as decimal(15,4))*100 +from + (select sum(ss_ext_sales_price) promotions + from store_sales + ,store + ,promotion + ,date_dim + ,customer + ,customer_address + ,item + where ss_sold_date_sk = d_date_sk + and ss_store_sk = s_store_sk + and ss_promo_sk = p_promo_sk + and ss_customer_sk= c_customer_sk + and ca_address_sk = c_current_addr_sk + and ss_item_sk = i_item_sk + and ca_gmt_offset = -7 + and i_category = 'Jewelry' + and (p_channel_dmail = 'Y' or p_channel_email = 'Y' or p_channel_tv = 'Y') + and s_gmt_offset = -7 + and d_year = 1999 + and d_moy = 11) promotional_sales, + (select sum(ss_ext_sales_price) total + from store_sales + ,store + ,date_dim + ,customer + ,customer_address + ,item + where ss_sold_date_sk = d_date_sk + and ss_store_sk = s_store_sk + and ss_customer_sk= c_customer_sk + and ca_address_sk = c_current_addr_sk + and ss_item_sk = i_item_sk + and ca_gmt_offset = -7 + and i_category = 'Jewelry' + and s_gmt_offset = -7 + and d_year = 1999 + and d_moy = 11) all_sales +order by promotions, total +limit 100; diff --git a/tools/tpcds-tools/queries/sf100/query62.sql b/tools/tpcds-tools/queries/sf100/query62.sql new file mode 100644 index 00000000000000..fbb8aebcc260d8 --- /dev/null +++ b/tools/tpcds-tools/queries/sf100/query62.sql @@ -0,0 +1,32 @@ +select + substr(w_warehouse_name,1,20) + ,sm_type + ,web_name + ,sum(case when (ws_ship_date_sk - ws_sold_date_sk <= 30 ) then 1 else 0 end) as "30 days" + ,sum(case when (ws_ship_date_sk - ws_sold_date_sk > 30) and + (ws_ship_date_sk - ws_sold_date_sk <= 60) then 1 else 0 end ) as "31-60 days" + ,sum(case when (ws_ship_date_sk - ws_sold_date_sk > 60) and + (ws_ship_date_sk - ws_sold_date_sk <= 90) then 1 else 0 end) as "61-90 days" + ,sum(case when (ws_ship_date_sk - ws_sold_date_sk > 90) and + (ws_ship_date_sk - ws_sold_date_sk <= 120) then 1 else 0 end) as "91-120 days" + ,sum(case when (ws_ship_date_sk - ws_sold_date_sk > 120) then 1 else 0 end) as ">120 days" +from + web_sales + ,warehouse + ,ship_mode + ,web_site + ,date_dim +where + d_month_seq between 1194 and 1194 + 11 +and ws_ship_date_sk = d_date_sk +and ws_warehouse_sk = w_warehouse_sk +and ws_ship_mode_sk = sm_ship_mode_sk +and ws_web_site_sk = web_site_sk +group by + substr(w_warehouse_name,1,20) + ,sm_type + ,web_name +order by substr(w_warehouse_name,1,20) + ,sm_type + ,web_name +limit 100; diff --git a/tools/tpcds-tools/queries/sf100/query63.sql b/tools/tpcds-tools/queries/sf100/query63.sql new file mode 100644 index 00000000000000..6f3dc6d0167a1c --- /dev/null +++ b/tools/tpcds-tools/queries/sf100/query63.sql @@ -0,0 +1,26 @@ +select * +from (select i_manager_id + ,sum(ss_sales_price) sum_sales + ,avg(sum(ss_sales_price)) over (partition by i_manager_id) avg_monthly_sales + from item + ,store_sales + ,date_dim + ,store + where ss_item_sk = i_item_sk + and ss_sold_date_sk = d_date_sk + and ss_store_sk = s_store_sk + and d_month_seq in (1181,1181+1,1181+2,1181+3,1181+4,1181+5,1181+6,1181+7,1181+8,1181+9,1181+10,1181+11) + and (( i_category in ('Books','Children','Electronics') + and i_class in ('personal','portable','reference','self-help') + and i_brand in ('scholaramalgamalg #14','scholaramalgamalg #7', + 'exportiunivamalg #9','scholaramalgamalg #9')) + or( i_category in ('Women','Music','Men') + and i_class in ('accessories','classical','fragrances','pants') + and i_brand in ('amalgimporto #1','edu packscholar #1','exportiimporto #1', + 'importoamalg #1'))) +group by i_manager_id, d_moy) tmp1 +where case when avg_monthly_sales > 0 then abs (sum_sales - avg_monthly_sales) / avg_monthly_sales else null end > 0.1 +order by i_manager_id + ,avg_monthly_sales + ,sum_sales +limit 100; diff --git a/tools/tpcds-tools/queries/sf100/query64.sql b/tools/tpcds-tools/queries/sf100/query64.sql new file mode 100644 index 00000000000000..0c15c60feffb92 --- /dev/null +++ b/tools/tpcds-tools/queries/sf100/query64.sql @@ -0,0 +1,118 @@ +with cs_ui as + (select cs_item_sk + ,sum(cs_ext_list_price) as sale,sum(cr_refunded_cash+cr_reversed_charge+cr_store_credit) as refund + from catalog_sales + ,catalog_returns + where cs_item_sk = cr_item_sk + and cs_order_number = cr_order_number + group by cs_item_sk + having sum(cs_ext_list_price)>2*sum(cr_refunded_cash+cr_reversed_charge+cr_store_credit)), +cross_sales as + (select i_product_name product_name + ,i_item_sk item_sk + ,s_store_name store_name + ,s_zip store_zip + ,ad1.ca_street_number b_street_number + ,ad1.ca_street_name b_street_name + ,ad1.ca_city b_city + ,ad1.ca_zip b_zip + ,ad2.ca_street_number c_street_number + ,ad2.ca_street_name c_street_name + ,ad2.ca_city c_city + ,ad2.ca_zip c_zip + ,d1.d_year as syear + ,d2.d_year as fsyear + ,d3.d_year s2year + ,count(*) cnt + ,sum(ss_wholesale_cost) s1 + ,sum(ss_list_price) s2 + ,sum(ss_coupon_amt) s3 + FROM store_sales + ,store_returns + ,cs_ui + ,date_dim d1 + ,date_dim d2 + ,date_dim d3 + ,store + ,customer + ,customer_demographics cd1 + ,customer_demographics cd2 + ,promotion + ,household_demographics hd1 + ,household_demographics hd2 + ,customer_address ad1 + ,customer_address ad2 + ,income_band ib1 + ,income_band ib2 + ,item + WHERE ss_store_sk = s_store_sk AND + ss_sold_date_sk = d1.d_date_sk AND + ss_customer_sk = c_customer_sk AND + ss_cdemo_sk= cd1.cd_demo_sk AND + ss_hdemo_sk = hd1.hd_demo_sk AND + ss_addr_sk = ad1.ca_address_sk and + ss_item_sk = i_item_sk and + ss_item_sk = sr_item_sk and + ss_ticket_number = sr_ticket_number and + ss_item_sk = cs_ui.cs_item_sk and + c_current_cdemo_sk = cd2.cd_demo_sk AND + c_current_hdemo_sk = hd2.hd_demo_sk AND + c_current_addr_sk = ad2.ca_address_sk and + c_first_sales_date_sk = d2.d_date_sk and + c_first_shipto_date_sk = d3.d_date_sk and + ss_promo_sk = p_promo_sk and + hd1.hd_income_band_sk = ib1.ib_income_band_sk and + hd2.hd_income_band_sk = ib2.ib_income_band_sk and + cd1.cd_marital_status <> cd2.cd_marital_status and + i_color in ('blanched','medium','brown','chocolate','burlywood','drab') and + i_current_price between 23 and 23 + 10 and + i_current_price between 23 + 1 and 23 + 15 +group by i_product_name + ,i_item_sk + ,s_store_name + ,s_zip + ,ad1.ca_street_number + ,ad1.ca_street_name + ,ad1.ca_city + ,ad1.ca_zip + ,ad2.ca_street_number + ,ad2.ca_street_name + ,ad2.ca_city + ,ad2.ca_zip + ,d1.d_year + ,d2.d_year + ,d3.d_year +) +select cs1.product_name + ,cs1.store_name + ,cs1.store_zip + ,cs1.b_street_number + ,cs1.b_street_name + ,cs1.b_city + ,cs1.b_zip + ,cs1.c_street_number + ,cs1.c_street_name + ,cs1.c_city + ,cs1.c_zip + ,cs1.syear + ,cs1.cnt + ,cs1.s1 as s11 + ,cs1.s2 as s21 + ,cs1.s3 as s31 + ,cs2.s1 as s12 + ,cs2.s2 as s22 + ,cs2.s3 as s32 + ,cs2.syear + ,cs2.cnt +from cross_sales cs1,cross_sales cs2 +where cs1.item_sk=cs2.item_sk and + cs1.syear = 2001 and + cs2.syear = 2001 + 1 and + cs2.cnt <= cs1.cnt and + cs1.store_name = cs2.store_name and + cs1.store_zip = cs2.store_zip +order by cs1.product_name + ,cs1.store_name + ,cs2.cnt + ,cs1.s1 + ,cs2.s1; diff --git a/tools/tpcds-tools/queries/sf100/query65.sql b/tools/tpcds-tools/queries/sf100/query65.sql new file mode 100644 index 00000000000000..3e81cad0efb068 --- /dev/null +++ b/tools/tpcds-tools/queries/sf100/query65.sql @@ -0,0 +1,26 @@ +select + s_store_name, + i_item_desc, + sc.revenue, + i_current_price, + i_wholesale_cost, + i_brand + from store, item, + (select ss_store_sk, avg(revenue) as ave + from + (select ss_store_sk, ss_item_sk, + sum(ss_sales_price) as revenue + from store_sales, date_dim + where ss_sold_date_sk = d_date_sk and d_month_seq between 1221 and 1221+11 + group by ss_store_sk, ss_item_sk) sa + group by ss_store_sk) sb, + (select ss_store_sk, ss_item_sk, sum(ss_sales_price) as revenue + from store_sales, date_dim + where ss_sold_date_sk = d_date_sk and d_month_seq between 1221 and 1221+11 + group by ss_store_sk, ss_item_sk) sc + where sb.ss_store_sk = sc.ss_store_sk and + sc.revenue <= 0.1 * sb.ave and + s_store_sk = sc.ss_store_sk and + i_item_sk = sc.ss_item_sk + order by s_store_name, i_item_desc +limit 100; diff --git a/tools/tpcds-tools/queries/sf100/query66.sql b/tools/tpcds-tools/queries/sf100/query66.sql new file mode 100644 index 00000000000000..04f65a4908ee9c --- /dev/null +++ b/tools/tpcds-tools/queries/sf100/query66.sql @@ -0,0 +1,217 @@ +select + w_warehouse_name + ,w_warehouse_sq_ft + ,w_city + ,w_county + ,w_state + ,w_country + ,ship_carriers + ,year + ,sum(jan_sales) as jan_sales + ,sum(feb_sales) as feb_sales + ,sum(mar_sales) as mar_sales + ,sum(apr_sales) as apr_sales + ,sum(may_sales) as may_sales + ,sum(jun_sales) as jun_sales + ,sum(jul_sales) as jul_sales + ,sum(aug_sales) as aug_sales + ,sum(sep_sales) as sep_sales + ,sum(oct_sales) as oct_sales + ,sum(nov_sales) as nov_sales + ,sum(dec_sales) as dec_sales + ,sum(jan_sales/w_warehouse_sq_ft) as jan_sales_per_sq_foot + ,sum(feb_sales/w_warehouse_sq_ft) as feb_sales_per_sq_foot + ,sum(mar_sales/w_warehouse_sq_ft) as mar_sales_per_sq_foot + ,sum(apr_sales/w_warehouse_sq_ft) as apr_sales_per_sq_foot + ,sum(may_sales/w_warehouse_sq_ft) as may_sales_per_sq_foot + ,sum(jun_sales/w_warehouse_sq_ft) as jun_sales_per_sq_foot + ,sum(jul_sales/w_warehouse_sq_ft) as jul_sales_per_sq_foot + ,sum(aug_sales/w_warehouse_sq_ft) as aug_sales_per_sq_foot + ,sum(sep_sales/w_warehouse_sq_ft) as sep_sales_per_sq_foot + ,sum(oct_sales/w_warehouse_sq_ft) as oct_sales_per_sq_foot + ,sum(nov_sales/w_warehouse_sq_ft) as nov_sales_per_sq_foot + ,sum(dec_sales/w_warehouse_sq_ft) as dec_sales_per_sq_foot + ,sum(jan_net) as jan_net + ,sum(feb_net) as feb_net + ,sum(mar_net) as mar_net + ,sum(apr_net) as apr_net + ,sum(may_net) as may_net + ,sum(jun_net) as jun_net + ,sum(jul_net) as jul_net + ,sum(aug_net) as aug_net + ,sum(sep_net) as sep_net + ,sum(oct_net) as oct_net + ,sum(nov_net) as nov_net + ,sum(dec_net) as dec_net + from ( + select + w_warehouse_name + ,w_warehouse_sq_ft + ,w_city + ,w_county + ,w_state + ,w_country + ,concat(concat('GREAT EASTERN ', ','), ' LATVIAN') as ship_carriers + ,d_year as year + ,sum(case when d_moy = 1 + then ws_ext_sales_price* ws_quantity else 0 end) as jan_sales + ,sum(case when d_moy = 2 + then ws_ext_sales_price* ws_quantity else 0 end) as feb_sales + ,sum(case when d_moy = 3 + then ws_ext_sales_price* ws_quantity else 0 end) as mar_sales + ,sum(case when d_moy = 4 + then ws_ext_sales_price* ws_quantity else 0 end) as apr_sales + ,sum(case when d_moy = 5 + then ws_ext_sales_price* ws_quantity else 0 end) as may_sales + ,sum(case when d_moy = 6 + then ws_ext_sales_price* ws_quantity else 0 end) as jun_sales + ,sum(case when d_moy = 7 + then ws_ext_sales_price* ws_quantity else 0 end) as jul_sales + ,sum(case when d_moy = 8 + then ws_ext_sales_price* ws_quantity else 0 end) as aug_sales + ,sum(case when d_moy = 9 + then ws_ext_sales_price* ws_quantity else 0 end) as sep_sales + ,sum(case when d_moy = 10 + then ws_ext_sales_price* ws_quantity else 0 end) as oct_sales + ,sum(case when d_moy = 11 + then ws_ext_sales_price* ws_quantity else 0 end) as nov_sales + ,sum(case when d_moy = 12 + then ws_ext_sales_price* ws_quantity else 0 end) as dec_sales + ,sum(case when d_moy = 1 + then ws_net_paid_inc_ship_tax * ws_quantity else 0 end) as jan_net + ,sum(case when d_moy = 2 + then ws_net_paid_inc_ship_tax * ws_quantity else 0 end) as feb_net + ,sum(case when d_moy = 3 + then ws_net_paid_inc_ship_tax * ws_quantity else 0 end) as mar_net + ,sum(case when d_moy = 4 + then ws_net_paid_inc_ship_tax * ws_quantity else 0 end) as apr_net + ,sum(case when d_moy = 5 + then ws_net_paid_inc_ship_tax * ws_quantity else 0 end) as may_net + ,sum(case when d_moy = 6 + then ws_net_paid_inc_ship_tax * ws_quantity else 0 end) as jun_net + ,sum(case when d_moy = 7 + then ws_net_paid_inc_ship_tax * ws_quantity else 0 end) as jul_net + ,sum(case when d_moy = 8 + then ws_net_paid_inc_ship_tax * ws_quantity else 0 end) as aug_net + ,sum(case when d_moy = 9 + then ws_net_paid_inc_ship_tax * ws_quantity else 0 end) as sep_net + ,sum(case when d_moy = 10 + then ws_net_paid_inc_ship_tax * ws_quantity else 0 end) as oct_net + ,sum(case when d_moy = 11 + then ws_net_paid_inc_ship_tax * ws_quantity else 0 end) as nov_net + ,sum(case when d_moy = 12 + then ws_net_paid_inc_ship_tax * ws_quantity else 0 end) as dec_net + from + web_sales + ,warehouse + ,date_dim + ,time_dim + ,ship_mode + where + ws_warehouse_sk = w_warehouse_sk + and ws_sold_date_sk = d_date_sk + and ws_sold_time_sk = t_time_sk + and ws_ship_mode_sk = sm_ship_mode_sk + and d_year = 1998 + and t_time between 48821 and 48821+28800 + and sm_carrier in ('GREAT EASTERN','LATVIAN') + group by + w_warehouse_name + ,w_warehouse_sq_ft + ,w_city + ,w_county + ,w_state + ,w_country + ,d_year + union all + select + w_warehouse_name + ,w_warehouse_sq_ft + ,w_city + ,w_county + ,w_state + ,w_country + ,concat(concat('GREAT EASTERN ', ','), ' LATVIAN') as ship_carriers + ,d_year as year + ,sum(case when d_moy = 1 + then cs_ext_list_price* cs_quantity else 0 end) as jan_sales + ,sum(case when d_moy = 2 + then cs_ext_list_price* cs_quantity else 0 end) as feb_sales + ,sum(case when d_moy = 3 + then cs_ext_list_price* cs_quantity else 0 end) as mar_sales + ,sum(case when d_moy = 4 + then cs_ext_list_price* cs_quantity else 0 end) as apr_sales + ,sum(case when d_moy = 5 + then cs_ext_list_price* cs_quantity else 0 end) as may_sales + ,sum(case when d_moy = 6 + then cs_ext_list_price* cs_quantity else 0 end) as jun_sales + ,sum(case when d_moy = 7 + then cs_ext_list_price* cs_quantity else 0 end) as jul_sales + ,sum(case when d_moy = 8 + then cs_ext_list_price* cs_quantity else 0 end) as aug_sales + ,sum(case when d_moy = 9 + then cs_ext_list_price* cs_quantity else 0 end) as sep_sales + ,sum(case when d_moy = 10 + then cs_ext_list_price* cs_quantity else 0 end) as oct_sales + ,sum(case when d_moy = 11 + then cs_ext_list_price* cs_quantity else 0 end) as nov_sales + ,sum(case when d_moy = 12 + then cs_ext_list_price* cs_quantity else 0 end) as dec_sales + ,sum(case when d_moy = 1 + then cs_net_paid_inc_ship_tax * cs_quantity else 0 end) as jan_net + ,sum(case when d_moy = 2 + then cs_net_paid_inc_ship_tax * cs_quantity else 0 end) as feb_net + ,sum(case when d_moy = 3 + then cs_net_paid_inc_ship_tax * cs_quantity else 0 end) as mar_net + ,sum(case when d_moy = 4 + then cs_net_paid_inc_ship_tax * cs_quantity else 0 end) as apr_net + ,sum(case when d_moy = 5 + then cs_net_paid_inc_ship_tax * cs_quantity else 0 end) as may_net + ,sum(case when d_moy = 6 + then cs_net_paid_inc_ship_tax * cs_quantity else 0 end) as jun_net + ,sum(case when d_moy = 7 + then cs_net_paid_inc_ship_tax * cs_quantity else 0 end) as jul_net + ,sum(case when d_moy = 8 + then cs_net_paid_inc_ship_tax * cs_quantity else 0 end) as aug_net + ,sum(case when d_moy = 9 + then cs_net_paid_inc_ship_tax * cs_quantity else 0 end) as sep_net + ,sum(case when d_moy = 10 + then cs_net_paid_inc_ship_tax * cs_quantity else 0 end) as oct_net + ,sum(case when d_moy = 11 + then cs_net_paid_inc_ship_tax * cs_quantity else 0 end) as nov_net + ,sum(case when d_moy = 12 + then cs_net_paid_inc_ship_tax * cs_quantity else 0 end) as dec_net + from + catalog_sales + ,warehouse + ,date_dim + ,time_dim + ,ship_mode + where + cs_warehouse_sk = w_warehouse_sk + and cs_sold_date_sk = d_date_sk + and cs_sold_time_sk = t_time_sk + and cs_ship_mode_sk = sm_ship_mode_sk + and d_year = 1998 + and t_time between 48821 AND 48821+28800 + and sm_carrier in ('GREAT EASTERN','LATVIAN') + group by + w_warehouse_name + ,w_warehouse_sq_ft + ,w_city + ,w_county + ,w_state + ,w_country + ,d_year + ) x + group by + w_warehouse_name + ,w_warehouse_sq_ft + ,w_city + ,w_county + ,w_state + ,w_country + ,ship_carriers + ,year + order by w_warehouse_name + limit 100; diff --git a/tools/tpcds-tools/queries/sf100/query67.sql b/tools/tpcds-tools/queries/sf100/query67.sql new file mode 100644 index 00000000000000..fe4578c15dedca --- /dev/null +++ b/tools/tpcds-tools/queries/sf100/query67.sql @@ -0,0 +1,41 @@ +select * +from (select i_category + ,i_class + ,i_brand + ,i_product_name + ,d_year + ,d_qoy + ,d_moy + ,s_store_id + ,sumsales + ,rank() over (partition by i_category order by sumsales desc) rk + from (select i_category + ,i_class + ,i_brand + ,i_product_name + ,d_year + ,d_qoy + ,d_moy + ,s_store_id + ,sum(coalesce(ss_sales_price*ss_quantity,0)) sumsales + from store_sales + ,date_dim + ,store + ,item + where ss_sold_date_sk=d_date_sk + and ss_item_sk=i_item_sk + and ss_store_sk = s_store_sk + and d_month_seq between 1206 and 1206+11 + group by rollup(i_category, i_class, i_brand, i_product_name, d_year, d_qoy, d_moy,s_store_id))dw1) dw2 +where rk <= 100 +order by i_category + ,i_class + ,i_brand + ,i_product_name + ,d_year + ,d_qoy + ,d_moy + ,s_store_id + ,sumsales + ,rk +limit 100; diff --git a/tools/tpcds-tools/queries/sf100/query68.sql b/tools/tpcds-tools/queries/sf100/query68.sql new file mode 100644 index 00000000000000..4ee3b292400346 --- /dev/null +++ b/tools/tpcds-tools/queries/sf100/query68.sql @@ -0,0 +1,39 @@ +select c_last_name + ,c_first_name + ,ca_city + ,bought_city + ,ss_ticket_number + ,extended_price + ,extended_tax + ,list_price + from (select ss_ticket_number + ,ss_customer_sk + ,ca_city bought_city + ,sum(ss_ext_sales_price) extended_price + ,sum(ss_ext_list_price) list_price + ,sum(ss_ext_tax) extended_tax + from store_sales + ,date_dim + ,store + ,household_demographics + ,customer_address + where store_sales.ss_sold_date_sk = date_dim.d_date_sk + and store_sales.ss_store_sk = store.s_store_sk + and store_sales.ss_hdemo_sk = household_demographics.hd_demo_sk + and store_sales.ss_addr_sk = customer_address.ca_address_sk + and date_dim.d_dom between 1 and 2 + and (household_demographics.hd_dep_count = 8 or + household_demographics.hd_vehicle_count= -1) + and date_dim.d_year in (1998,1998+1,1998+2) + and store.s_city in ('Pleasant Hill','Five Points') + group by ss_ticket_number + ,ss_customer_sk + ,ss_addr_sk,ca_city) dn + ,customer + ,customer_address current_addr + where ss_customer_sk = c_customer_sk + and customer.c_current_addr_sk = current_addr.ca_address_sk + and current_addr.ca_city <> bought_city + order by c_last_name + ,ss_ticket_number + limit 100; diff --git a/tools/tpcds-tools/queries/sf100/query69.sql b/tools/tpcds-tools/queries/sf100/query69.sql new file mode 100644 index 00000000000000..7760c58361d103 --- /dev/null +++ b/tools/tpcds-tools/queries/sf100/query69.sql @@ -0,0 +1,44 @@ +select + cd_gender, + cd_marital_status, + cd_education_status, + count(*) cnt1, + cd_purchase_estimate, + count(*) cnt2, + cd_credit_rating, + count(*) cnt3 + from + customer c,customer_address ca,customer_demographics + where + c.c_current_addr_sk = ca.ca_address_sk and + ca_state in ('TX','VA','MI') and + cd_demo_sk = c.c_current_cdemo_sk and + exists (select * + from store_sales,date_dim + where c.c_customer_sk = ss_customer_sk and + ss_sold_date_sk = d_date_sk and + d_year = 2000 and + d_moy between 1 and 1+2) and + (not exists (select * + from web_sales,date_dim + where c.c_customer_sk = ws_bill_customer_sk and + ws_sold_date_sk = d_date_sk and + d_year = 2000 and + d_moy between 1 and 1+2) and + not exists (select * + from catalog_sales,date_dim + where c.c_customer_sk = cs_ship_customer_sk and + cs_sold_date_sk = d_date_sk and + d_year = 2000 and + d_moy between 1 and 1+2)) + group by cd_gender, + cd_marital_status, + cd_education_status, + cd_purchase_estimate, + cd_credit_rating + order by cd_gender, + cd_marital_status, + cd_education_status, + cd_purchase_estimate, + cd_credit_rating + limit 100; diff --git a/tools/tpcds-tools/queries/sf100/query7.sql b/tools/tpcds-tools/queries/sf100/query7.sql new file mode 100644 index 00000000000000..c4b33b79d18b8a --- /dev/null +++ b/tools/tpcds-tools/queries/sf100/query7.sql @@ -0,0 +1,18 @@ +select i_item_id, + avg(ss_quantity) agg1, + avg(ss_list_price) agg2, + avg(ss_coupon_amt) agg3, + avg(ss_sales_price) agg4 + from store_sales, customer_demographics, date_dim, item, promotion + where ss_sold_date_sk = d_date_sk and + ss_item_sk = i_item_sk and + ss_cdemo_sk = cd_demo_sk and + ss_promo_sk = p_promo_sk and + cd_gender = 'F' and + cd_marital_status = 'W' and + cd_education_status = 'College' and + (p_channel_email = 'N' or p_channel_event = 'N') and + d_year = 2001 + group by i_item_id + order by i_item_id + limit 100; diff --git a/tools/tpcds-tools/queries/sf100/query70.sql b/tools/tpcds-tools/queries/sf100/query70.sql new file mode 100644 index 00000000000000..fc7599ce8bb40d --- /dev/null +++ b/tools/tpcds-tools/queries/sf100/query70.sql @@ -0,0 +1,35 @@ +select + sum(ss_net_profit) as total_sum + ,s_state + ,s_county + ,grouping(s_state)+grouping(s_county) as lochierarchy + ,rank() over ( + partition by grouping(s_state)+grouping(s_county), + case when grouping(s_county) = 0 then s_state end + order by sum(ss_net_profit) desc) as rank_within_parent + from + store_sales + ,date_dim d1 + ,store + where + d1.d_month_seq between 1213 and 1213+11 + and d1.d_date_sk = ss_sold_date_sk + and s_store_sk = ss_store_sk + and s_state in + ( select s_state + from (select s_state as s_state, + rank() over ( partition by s_state order by sum(ss_net_profit) desc) as ranking + from store_sales, store, date_dim + where d_month_seq between 1213 and 1213+11 + and d_date_sk = ss_sold_date_sk + and s_store_sk = ss_store_sk + group by s_state + ) tmp1 + where ranking <= 5 + ) + group by rollup(s_state,s_county) + order by + lochierarchy desc + ,case when lochierarchy = 0 then s_state end + ,rank_within_parent + limit 100; diff --git a/tools/tpcds-tools/queries/sf100/query71.sql b/tools/tpcds-tools/queries/sf100/query71.sql new file mode 100644 index 00000000000000..71a40ce2b55450 --- /dev/null +++ b/tools/tpcds-tools/queries/sf100/query71.sql @@ -0,0 +1,37 @@ +select i_brand_id brand_id, i_brand brand,t_hour,t_minute, + sum(ext_price) ext_price + from item, (select ws_ext_sales_price as ext_price, + ws_sold_date_sk as sold_date_sk, + ws_item_sk as sold_item_sk, + ws_sold_time_sk as time_sk + from web_sales,date_dim + where d_date_sk = ws_sold_date_sk + and d_moy=12 + and d_year=1998 + union all + select cs_ext_sales_price as ext_price, + cs_sold_date_sk as sold_date_sk, + cs_item_sk as sold_item_sk, + cs_sold_time_sk as time_sk + from catalog_sales,date_dim + where d_date_sk = cs_sold_date_sk + and d_moy=12 + and d_year=1998 + union all + select ss_ext_sales_price as ext_price, + ss_sold_date_sk as sold_date_sk, + ss_item_sk as sold_item_sk, + ss_sold_time_sk as time_sk + from store_sales,date_dim + where d_date_sk = ss_sold_date_sk + and d_moy=12 + and d_year=1998 + ) tmp,time_dim + where + sold_item_sk = i_item_sk + and i_manager_id=1 + and time_sk = t_time_sk + and (t_meal_time = 'breakfast' or t_meal_time = 'dinner') + group by i_brand, i_brand_id,t_hour,t_minute + order by ext_price desc, i_brand_id + ; diff --git a/tools/tpcds-tools/queries/sf100/query72.sql b/tools/tpcds-tools/queries/sf100/query72.sql new file mode 100644 index 00000000000000..29cec192623a30 --- /dev/null +++ b/tools/tpcds-tools/queries/sf100/query72.sql @@ -0,0 +1,28 @@ +set max_join_number_bushy_tree=10; +set memo_max_group_expression_size=15000; +select i_item_desc + ,w_warehouse_name + ,d1.d_week_seq + ,sum(case when p_promo_sk is null then 1 else 0 end) no_promo + ,sum(case when p_promo_sk is not null then 1 else 0 end) promo + ,count(*) total_cnt +from catalog_sales +join inventory on (cs_item_sk = inv_item_sk) +join warehouse on (w_warehouse_sk=inv_warehouse_sk) +join item on (i_item_sk = cs_item_sk) +join customer_demographics on (cs_bill_cdemo_sk = cd_demo_sk) +join household_demographics on (cs_bill_hdemo_sk = hd_demo_sk) +join date_dim d1 on (cs_sold_date_sk = d1.d_date_sk) +join date_dim d2 on (inv_date_sk = d2.d_date_sk) +join date_dim d3 on (cs_ship_date_sk = d3.d_date_sk) +left outer join promotion on (cs_promo_sk=p_promo_sk) +left outer join catalog_returns on (cr_item_sk = cs_item_sk and cr_order_number = cs_order_number) +where d1.d_week_seq = d2.d_week_seq + and inv_quantity_on_hand < cs_quantity + and (d3.d_date > (d1.d_date + INTERVAL '5' DAY)) + and hd_buy_potential = '501-1000' + and d1.d_year = 2002 + and cd_marital_status = 'W' +group by i_item_desc,w_warehouse_name,d1.d_week_seq +order by total_cnt desc, i_item_desc, w_warehouse_name, d_week_seq +limit 100; diff --git a/tools/tpcds-tools/queries/sf100/query73.sql b/tools/tpcds-tools/queries/sf100/query73.sql new file mode 100644 index 00000000000000..783c17f101b381 --- /dev/null +++ b/tools/tpcds-tools/queries/sf100/query73.sql @@ -0,0 +1,25 @@ +select c_last_name + ,c_first_name + ,c_salutation + ,c_preferred_cust_flag + ,ss_ticket_number + ,cnt from + (select ss_ticket_number + ,ss_customer_sk + ,count(*) cnt + from store_sales,date_dim,store,household_demographics + where store_sales.ss_sold_date_sk = date_dim.d_date_sk + and store_sales.ss_store_sk = store.s_store_sk + and store_sales.ss_hdemo_sk = household_demographics.hd_demo_sk + and date_dim.d_dom between 1 and 2 + and (household_demographics.hd_buy_potential = '501-1000' or + household_demographics.hd_buy_potential = 'Unknown') + and household_demographics.hd_vehicle_count > 0 + and case when household_demographics.hd_vehicle_count > 0 then + household_demographics.hd_dep_count/ household_demographics.hd_vehicle_count else null end > 1 + and date_dim.d_year in (2000,2000+1,2000+2) + and store.s_county in ('Fairfield County','Walker County','Daviess County','Barrow County') + group by ss_ticket_number,ss_customer_sk) dj,customer + where ss_customer_sk = c_customer_sk + and cnt between 1 and 5 + order by cnt desc, c_last_name asc; diff --git a/tools/tpcds-tools/queries/sf100/query74.sql b/tools/tpcds-tools/queries/sf100/query74.sql new file mode 100644 index 00000000000000..09d8c1f0a4f784 --- /dev/null +++ b/tools/tpcds-tools/queries/sf100/query74.sql @@ -0,0 +1,58 @@ +with year_total as ( + select c_customer_id customer_id + ,c_first_name customer_first_name + ,c_last_name customer_last_name + ,d_year as year + ,stddev_samp(ss_net_paid) year_total + ,'s' sale_type + from customer + ,store_sales + ,date_dim + where c_customer_sk = ss_customer_sk + and ss_sold_date_sk = d_date_sk + and d_year in (1999,1999+1) + group by c_customer_id + ,c_first_name + ,c_last_name + ,d_year + union all + select c_customer_id customer_id + ,c_first_name customer_first_name + ,c_last_name customer_last_name + ,d_year as year + ,stddev_samp(ws_net_paid) year_total + ,'w' sale_type + from customer + ,web_sales + ,date_dim + where c_customer_sk = ws_bill_customer_sk + and ws_sold_date_sk = d_date_sk + and d_year in (1999,1999+1) + group by c_customer_id + ,c_first_name + ,c_last_name + ,d_year + ) + select + t_s_secyear.customer_id, t_s_secyear.customer_first_name, t_s_secyear.customer_last_name + from year_total t_s_firstyear + ,year_total t_s_secyear + ,year_total t_w_firstyear + ,year_total t_w_secyear + where t_s_secyear.customer_id = t_s_firstyear.customer_id + and t_s_firstyear.customer_id = t_w_secyear.customer_id + and t_s_firstyear.customer_id = t_w_firstyear.customer_id + and t_s_firstyear.sale_type = 's' + and t_w_firstyear.sale_type = 'w' + and t_s_secyear.sale_type = 's' + and t_w_secyear.sale_type = 'w' + and t_s_firstyear.year = 1999 + and t_s_secyear.year = 1999+1 + and t_w_firstyear.year = 1999 + and t_w_secyear.year = 1999+1 + and t_s_firstyear.year_total > 0 + and t_w_firstyear.year_total > 0 + and case when t_w_firstyear.year_total > 0 then t_w_secyear.year_total / t_w_firstyear.year_total else null end + > case when t_s_firstyear.year_total > 0 then t_s_secyear.year_total / t_s_firstyear.year_total else null end + order by 2,1,3 +limit 100; diff --git a/tools/tpcds-tools/queries/sf100/query75.sql b/tools/tpcds-tools/queries/sf100/query75.sql new file mode 100644 index 00000000000000..80b628e6eb5ff0 --- /dev/null +++ b/tools/tpcds-tools/queries/sf100/query75.sql @@ -0,0 +1,67 @@ +WITH all_sales AS ( + SELECT d_year + ,i_brand_id + ,i_class_id + ,i_category_id + ,i_manufact_id + ,SUM(sales_cnt) AS sales_cnt + ,SUM(sales_amt) AS sales_amt + FROM (SELECT d_year + ,i_brand_id + ,i_class_id + ,i_category_id + ,i_manufact_id + ,cs_quantity - COALESCE(cr_return_quantity,0) AS sales_cnt + ,cs_ext_sales_price - COALESCE(cr_return_amount,0.0) AS sales_amt + FROM catalog_sales JOIN item ON i_item_sk=cs_item_sk + JOIN date_dim ON d_date_sk=cs_sold_date_sk + LEFT JOIN catalog_returns ON (cs_order_number=cr_order_number + AND cs_item_sk=cr_item_sk) + WHERE i_category='Home' + UNION + SELECT d_year + ,i_brand_id + ,i_class_id + ,i_category_id + ,i_manufact_id + ,ss_quantity - COALESCE(sr_return_quantity,0) AS sales_cnt + ,ss_ext_sales_price - COALESCE(sr_return_amt,0.0) AS sales_amt + FROM store_sales JOIN item ON i_item_sk=ss_item_sk + JOIN date_dim ON d_date_sk=ss_sold_date_sk + LEFT JOIN store_returns ON (ss_ticket_number=sr_ticket_number + AND ss_item_sk=sr_item_sk) + WHERE i_category='Home' + UNION + SELECT d_year + ,i_brand_id + ,i_class_id + ,i_category_id + ,i_manufact_id + ,ws_quantity - COALESCE(wr_return_quantity,0) AS sales_cnt + ,ws_ext_sales_price - COALESCE(wr_return_amt,0.0) AS sales_amt + FROM web_sales JOIN item ON i_item_sk=ws_item_sk + JOIN date_dim ON d_date_sk=ws_sold_date_sk + LEFT JOIN web_returns ON (ws_order_number=wr_order_number + AND ws_item_sk=wr_item_sk) + WHERE i_category='Home') sales_detail + GROUP BY d_year, i_brand_id, i_class_id, i_category_id, i_manufact_id) + SELECT prev_yr.d_year AS prev_year + ,curr_yr.d_year AS year + ,curr_yr.i_brand_id + ,curr_yr.i_class_id + ,curr_yr.i_category_id + ,curr_yr.i_manufact_id + ,prev_yr.sales_cnt AS prev_yr_cnt + ,curr_yr.sales_cnt AS curr_yr_cnt + ,curr_yr.sales_cnt-prev_yr.sales_cnt AS sales_cnt_diff + ,curr_yr.sales_amt-prev_yr.sales_amt AS sales_amt_diff + FROM all_sales curr_yr, all_sales prev_yr + WHERE curr_yr.i_brand_id=prev_yr.i_brand_id + AND curr_yr.i_class_id=prev_yr.i_class_id + AND curr_yr.i_category_id=prev_yr.i_category_id + AND curr_yr.i_manufact_id=prev_yr.i_manufact_id + AND curr_yr.d_year=1999 + AND prev_yr.d_year=1999-1 + AND CAST(curr_yr.sales_cnt AS DECIMAL(17,2))/CAST(prev_yr.sales_cnt AS DECIMAL(17,2))<0.9 + ORDER BY sales_cnt_diff,sales_amt_diff + limit 100; diff --git a/tools/tpcds-tools/queries/sf100/query76.sql b/tools/tpcds-tools/queries/sf100/query76.sql new file mode 100644 index 00000000000000..0ad959b6baba39 --- /dev/null +++ b/tools/tpcds-tools/queries/sf100/query76.sql @@ -0,0 +1,21 @@ +select channel, col_name, d_year, d_qoy, i_category, COUNT(*) sales_cnt, SUM(ext_sales_price) sales_amt FROM ( + SELECT 'store' as channel, 'ss_hdemo_sk' col_name, d_year, d_qoy, i_category, ss_ext_sales_price ext_sales_price + FROM store_sales, item, date_dim + WHERE ss_hdemo_sk IS NULL + AND ss_sold_date_sk=d_date_sk + AND ss_item_sk=i_item_sk + UNION ALL + SELECT 'web' as channel, 'ws_bill_addr_sk' col_name, d_year, d_qoy, i_category, ws_ext_sales_price ext_sales_price + FROM web_sales, item, date_dim + WHERE ws_bill_addr_sk IS NULL + AND ws_sold_date_sk=d_date_sk + AND ws_item_sk=i_item_sk + UNION ALL + SELECT 'catalog' as channel, 'cs_warehouse_sk' col_name, d_year, d_qoy, i_category, cs_ext_sales_price ext_sales_price + FROM catalog_sales, item, date_dim + WHERE cs_warehouse_sk IS NULL + AND cs_sold_date_sk=d_date_sk + AND cs_item_sk=i_item_sk) foo +GROUP BY channel, col_name, d_year, d_qoy, i_category +ORDER BY channel, col_name, d_year, d_qoy, i_category +limit 100; diff --git a/tools/tpcds-tools/queries/sf100/query77.sql b/tools/tpcds-tools/queries/sf100/query77.sql new file mode 100644 index 00000000000000..b1e7536ea7f19a --- /dev/null +++ b/tools/tpcds-tools/queries/sf100/query77.sql @@ -0,0 +1,105 @@ +with ss as + (select s_store_sk, + sum(ss_ext_sales_price) as sales, + sum(ss_net_profit) as profit + from store_sales, + date_dim, + store + where ss_sold_date_sk = d_date_sk + and d_date between cast('1998-08-05' as date) + and (cast('1998-08-05' as date) + interval 30 day) + and ss_store_sk = s_store_sk + group by s_store_sk) + , + sr as + (select s_store_sk, + sum(sr_return_amt) as returns, + sum(sr_net_loss) as profit_loss + from store_returns, + date_dim, + store + where sr_returned_date_sk = d_date_sk + and d_date between cast('1998-08-05' as date) + and (cast('1998-08-05' as date) + interval 30 day) + and sr_store_sk = s_store_sk + group by s_store_sk), + cs as + (select cs_call_center_sk, + sum(cs_ext_sales_price) as sales, + sum(cs_net_profit) as profit + from catalog_sales, + date_dim + where cs_sold_date_sk = d_date_sk + and d_date between cast('1998-08-05' as date) + and (cast('1998-08-05' as date) + interval 30 day) + group by cs_call_center_sk + ), + cr as + (select cr_call_center_sk, + sum(cr_return_amount) as returns, + sum(cr_net_loss) as profit_loss + from catalog_returns, + date_dim + where cr_returned_date_sk = d_date_sk + and d_date between cast('1998-08-05' as date) + and (cast('1998-08-05' as date) + interval 30 day) + group by cr_call_center_sk + ), + ws as + ( select wp_web_page_sk, + sum(ws_ext_sales_price) as sales, + sum(ws_net_profit) as profit + from web_sales, + date_dim, + web_page + where ws_sold_date_sk = d_date_sk + and d_date between cast('1998-08-05' as date) + and (cast('1998-08-05' as date) + interval 30 day) + and ws_web_page_sk = wp_web_page_sk + group by wp_web_page_sk), + wr as + (select wp_web_page_sk, + sum(wr_return_amt) as returns, + sum(wr_net_loss) as profit_loss + from web_returns, + date_dim, + web_page + where wr_returned_date_sk = d_date_sk + and d_date between cast('1998-08-05' as date) + and (cast('1998-08-05' as date) + interval 30 day) + and wr_web_page_sk = wp_web_page_sk + group by wp_web_page_sk) + select channel + , id + , sum(sales) as sales + , sum(returns) as returns + , sum(profit) as profit + from + (select 'store channel' as channel + , ss.s_store_sk as id + , sales + , coalesce(returns, 0) as returns + , (profit - coalesce(profit_loss,0)) as profit + from ss left join sr + on ss.s_store_sk = sr.s_store_sk + union all + select 'catalog channel' as channel + , cs_call_center_sk as id + , sales + , returns + , (profit - profit_loss) as profit + from cs + , cr + union all + select 'web channel' as channel + , ws.wp_web_page_sk as id + , sales + , coalesce(returns, 0) returns + , (profit - coalesce(profit_loss,0)) as profit + from ws left join wr + on ws.wp_web_page_sk = wr.wp_web_page_sk + ) x + group by rollup (channel, id) + order by channel + ,id + limit 100; diff --git a/tools/tpcds-tools/queries/sf100/query78.sql b/tools/tpcds-tools/queries/sf100/query78.sql new file mode 100644 index 00000000000000..182f13c726efe9 --- /dev/null +++ b/tools/tpcds-tools/queries/sf100/query78.sql @@ -0,0 +1,55 @@ +with ws as + (select d_year AS ws_sold_year, ws_item_sk, + ws_bill_customer_sk ws_customer_sk, + sum(ws_quantity) ws_qty, + sum(ws_wholesale_cost) ws_wc, + sum(ws_sales_price) ws_sp + from web_sales + left join web_returns on wr_order_number=ws_order_number and ws_item_sk=wr_item_sk + join date_dim on ws_sold_date_sk = d_date_sk + where wr_order_number is null + group by d_year, ws_item_sk, ws_bill_customer_sk + ), +cs as + (select d_year AS cs_sold_year, cs_item_sk, + cs_bill_customer_sk cs_customer_sk, + sum(cs_quantity) cs_qty, + sum(cs_wholesale_cost) cs_wc, + sum(cs_sales_price) cs_sp + from catalog_sales + left join catalog_returns on cr_order_number=cs_order_number and cs_item_sk=cr_item_sk + join date_dim on cs_sold_date_sk = d_date_sk + where cr_order_number is null + group by d_year, cs_item_sk, cs_bill_customer_sk + ), +ss as + (select d_year AS ss_sold_year, ss_item_sk, + ss_customer_sk, + sum(ss_quantity) ss_qty, + sum(ss_wholesale_cost) ss_wc, + sum(ss_sales_price) ss_sp + from store_sales + left join store_returns on sr_ticket_number=ss_ticket_number and ss_item_sk=sr_item_sk + join date_dim on ss_sold_date_sk = d_date_sk + where sr_ticket_number is null + group by d_year, ss_item_sk, ss_customer_sk + ) + select +ss_item_sk, +round(ss_qty/(coalesce(ws_qty,0)+coalesce(cs_qty,0)),2) ratio, +ss_qty store_qty, ss_wc store_wholesale_cost, ss_sp store_sales_price, +coalesce(ws_qty,0)+coalesce(cs_qty,0) other_chan_qty, +coalesce(ws_wc,0)+coalesce(cs_wc,0) other_chan_wholesale_cost, +coalesce(ws_sp,0)+coalesce(cs_sp,0) other_chan_sales_price +from ss +left join ws on (ws_sold_year=ss_sold_year and ws_item_sk=ss_item_sk and ws_customer_sk=ss_customer_sk) +left join cs on (cs_sold_year=ss_sold_year and cs_item_sk=ss_item_sk and cs_customer_sk=ss_customer_sk) +where (coalesce(ws_qty,0)>0 or coalesce(cs_qty, 0)>0) and ss_sold_year=2000 +order by + ss_item_sk, + ss_qty desc, ss_wc desc, ss_sp desc, + other_chan_qty, + other_chan_wholesale_cost, + other_chan_sales_price, + ratio +limit 100; diff --git a/tools/tpcds-tools/queries/sf100/query79.sql b/tools/tpcds-tools/queries/sf100/query79.sql new file mode 100644 index 00000000000000..12e74acdc8a42e --- /dev/null +++ b/tools/tpcds-tools/queries/sf100/query79.sql @@ -0,0 +1,20 @@ +select + c_last_name,c_first_name,substr(s_city,1,30),ss_ticket_number,amt,profit + from + (select ss_ticket_number + ,ss_customer_sk + ,store.s_city + ,sum(ss_coupon_amt) amt + ,sum(ss_net_profit) profit + from store_sales,date_dim,store,household_demographics + where store_sales.ss_sold_date_sk = date_dim.d_date_sk + and store_sales.ss_store_sk = store.s_store_sk + and store_sales.ss_hdemo_sk = household_demographics.hd_demo_sk + and (household_demographics.hd_dep_count = 5 or household_demographics.hd_vehicle_count > 4) + and date_dim.d_dow = 1 + and date_dim.d_year in (1998,1998+1,1998+2) + and store.s_number_employees between 200 and 295 + group by ss_ticket_number,ss_customer_sk,ss_addr_sk,store.s_city) ms,customer + where ss_customer_sk = c_customer_sk + order by c_last_name,c_first_name,substr(s_city,1,30), profit +limit 100; diff --git a/tools/tpcds-tools/queries/sf100/query8.sql b/tools/tpcds-tools/queries/sf100/query8.sql new file mode 100644 index 00000000000000..8909d5ba1d8b17 --- /dev/null +++ b/tools/tpcds-tools/queries/sf100/query8.sql @@ -0,0 +1,105 @@ +select s_store_name + ,sum(ss_net_profit) + from store_sales + ,date_dim + ,store, + (select ca_zip + from ( + SELECT substr(ca_zip,1,5) ca_zip + FROM customer_address + WHERE substr(ca_zip,1,5) IN ( + '47602','16704','35863','28577','83910','36201', + '58412','48162','28055','41419','80332', + '38607','77817','24891','16226','18410', + '21231','59345','13918','51089','20317', + '17167','54585','67881','78366','47770', + '18360','51717','73108','14440','21800', + '89338','45859','65501','34948','25973', + '73219','25333','17291','10374','18829', + '60736','82620','41351','52094','19326', + '25214','54207','40936','21814','79077', + '25178','75742','77454','30621','89193', + '27369','41232','48567','83041','71948', + '37119','68341','14073','16891','62878', + '49130','19833','24286','27700','40979', + '50412','81504','94835','84844','71954', + '39503','57649','18434','24987','12350', + '86379','27413','44529','98569','16515', + '27287','24255','21094','16005','56436', + '91110','68293','56455','54558','10298', + '83647','32754','27052','51766','19444', + '13869','45645','94791','57631','20712', + '37788','41807','46507','21727','71836', + '81070','50632','88086','63991','20244', + '31655','51782','29818','63792','68605', + '94898','36430','57025','20601','82080', + '33869','22728','35834','29086','92645', + '98584','98072','11652','78093','57553', + '43830','71144','53565','18700','90209', + '71256','38353','54364','28571','96560', + '57839','56355','50679','45266','84680', + '34306','34972','48530','30106','15371', + '92380','84247','92292','68852','13338', + '34594','82602','70073','98069','85066', + '47289','11686','98862','26217','47529', + '63294','51793','35926','24227','14196', + '24594','32489','99060','49472','43432', + '49211','14312','88137','47369','56877', + '20534','81755','15794','12318','21060', + '73134','41255','63073','81003','73873', + '66057','51184','51195','45676','92696', + '70450','90669','98338','25264','38919', + '59226','58581','60298','17895','19489', + '52301','80846','95464','68770','51634', + '19988','18367','18421','11618','67975', + '25494','41352','95430','15734','62585', + '97173','33773','10425','75675','53535', + '17879','41967','12197','67998','79658', + '59130','72592','14851','43933','68101', + '50636','25717','71286','24660','58058', + '72991','95042','15543','33122','69280', + '11912','59386','27642','65177','17672', + '33467','64592','36335','54010','18767', + '63193','42361','49254','33113','33159', + '36479','59080','11855','81963','31016', + '49140','29392','41836','32958','53163', + '13844','73146','23952','65148','93498', + '14530','46131','58454','13376','13378', + '83986','12320','17193','59852','46081', + '98533','52389','13086','68843','31013', + '13261','60560','13443','45533','83583', + '11489','58218','19753','22911','25115', + '86709','27156','32669','13123','51933', + '39214','41331','66943','14155','69998', + '49101','70070','35076','14242','73021', + '59494','15782','29752','37914','74686', + '83086','34473','15751','81084','49230', + '91894','60624','17819','28810','63180', + '56224','39459','55233','75752','43639', + '55349','86057','62361','50788','31830', + '58062','18218','85761','60083','45484', + '21204','90229','70041','41162','35390', + '16364','39500','68908','26689','52868', + '81335','40146','11340','61527','61794', + '71997','30415','59004','29450','58117', + '69952','33562','83833','27385','61860', + '96435','48333','23065','32961','84919', + '61997','99132','22815','56600','68730', + '48017','95694','32919','88217','27116', + '28239','58032','18884','16791','21343', + '97462','18569','75660','15475') + intersect + select ca_zip + from (SELECT substr(ca_zip,1,5) ca_zip,count(*) cnt + FROM customer_address, customer + WHERE ca_address_sk = c_current_addr_sk and + c_preferred_cust_flag='Y' + group by ca_zip + having count(*) > 10)A1)A2) V1 + where ss_store_sk = s_store_sk + and ss_sold_date_sk = d_date_sk + and d_qoy = 2 and d_year = 1998 + and (substr(s_zip,1,2) = substr(V1.ca_zip,1,2)) + group by s_store_name + order by s_store_name + limit 100; diff --git a/tools/tpcds-tools/queries/sf100/query80.sql b/tools/tpcds-tools/queries/sf100/query80.sql new file mode 100644 index 00000000000000..5b67630e1b435a --- /dev/null +++ b/tools/tpcds-tools/queries/sf100/query80.sql @@ -0,0 +1,93 @@ +with ssr as + (select s_store_id as store_id, + sum(ss_ext_sales_price) as sales, + sum(coalesce(sr_return_amt, 0)) as returns, + sum(ss_net_profit - coalesce(sr_net_loss, 0)) as profit + from store_sales left outer join store_returns on + (ss_item_sk = sr_item_sk and ss_ticket_number = sr_ticket_number), + date_dim, + store, + item, + promotion + where ss_sold_date_sk = d_date_sk + and d_date between cast('1998-08-28' as date) + and (cast('1998-08-28' as date) + interval 30 day) + and ss_store_sk = s_store_sk + and ss_item_sk = i_item_sk + and i_current_price > 50 + and ss_promo_sk = p_promo_sk + and p_channel_tv = 'N' + group by s_store_id) + , + csr as + (select cp_catalog_page_id as catalog_page_id, + sum(cs_ext_sales_price) as sales, + sum(coalesce(cr_return_amount, 0)) as returns, + sum(cs_net_profit - coalesce(cr_net_loss, 0)) as profit + from catalog_sales left outer join catalog_returns on + (cs_item_sk = cr_item_sk and cs_order_number = cr_order_number), + date_dim, + catalog_page, + item, + promotion + where cs_sold_date_sk = d_date_sk + and d_date between cast('1998-08-28' as date) + and (cast('1998-08-28' as date) + interval 30 day) + and cs_catalog_page_sk = cp_catalog_page_sk + and cs_item_sk = i_item_sk + and i_current_price > 50 + and cs_promo_sk = p_promo_sk + and p_channel_tv = 'N' +group by cp_catalog_page_id) + , + wsr as + (select web_site_id, + sum(ws_ext_sales_price) as sales, + sum(coalesce(wr_return_amt, 0)) as returns, + sum(ws_net_profit - coalesce(wr_net_loss, 0)) as profit + from web_sales left outer join web_returns on + (ws_item_sk = wr_item_sk and ws_order_number = wr_order_number), + date_dim, + web_site, + item, + promotion + where ws_sold_date_sk = d_date_sk + and d_date between cast('1998-08-28' as date) + and (cast('1998-08-28' as date) + interval 30 day) + and ws_web_site_sk = web_site_sk + and ws_item_sk = i_item_sk + and i_current_price > 50 + and ws_promo_sk = p_promo_sk + and p_channel_tv = 'N' +group by web_site_id) + select channel + , id + , sum(sales) as sales + , sum(returns) as returns + , sum(profit) as profit + from + (select 'store channel' as channel + , concat('store', store_id) as id + , sales + , returns + , profit + from ssr + union all + select 'catalog channel' as channel + , concat('catalog_page', catalog_page_id) as id + , sales + , returns + , profit + from csr + union all + select 'web channel' as channel + , concat('web_site', web_site_id) as id + , sales + , returns + , profit + from wsr + ) x + group by rollup (channel, id) + order by channel + ,id + limit 100; diff --git a/tools/tpcds-tools/queries/sf100/query81.sql b/tools/tpcds-tools/queries/sf100/query81.sql new file mode 100644 index 00000000000000..07f55190d3b8b0 --- /dev/null +++ b/tools/tpcds-tools/queries/sf100/query81.sql @@ -0,0 +1,28 @@ +with customer_total_return as + (select cr_returning_customer_sk as ctr_customer_sk + ,ca_state as ctr_state, + sum(cr_return_amt_inc_tax) as ctr_total_return + from catalog_returns + ,date_dim + ,customer_address + where cr_returned_date_sk = d_date_sk + and d_year =2002 + and cr_returning_addr_sk = ca_address_sk + group by cr_returning_customer_sk + ,ca_state ) + select c_customer_id,c_salutation,c_first_name,c_last_name,ca_street_number,ca_street_name + ,ca_street_type,ca_suite_number,ca_city,ca_county,ca_state,ca_zip,ca_country,ca_gmt_offset + ,ca_location_type,ctr_total_return + from customer_total_return ctr1 + ,customer_address + ,customer + where ctr1.ctr_total_return > (select avg(ctr_total_return)*1.2 + from customer_total_return ctr2 + where ctr1.ctr_state = ctr2.ctr_state) + and ca_address_sk = c_current_addr_sk + and ca_state = 'CA' + and ctr1.ctr_customer_sk = c_customer_sk + order by c_customer_id,c_salutation,c_first_name,c_last_name,ca_street_number,ca_street_name + ,ca_street_type,ca_suite_number,ca_city,ca_county,ca_state,ca_zip,ca_country,ca_gmt_offset + ,ca_location_type,ctr_total_return + limit 100; diff --git a/tools/tpcds-tools/queries/sf100/query82.sql b/tools/tpcds-tools/queries/sf100/query82.sql new file mode 100644 index 00000000000000..c85f28cae07852 --- /dev/null +++ b/tools/tpcds-tools/queries/sf100/query82.sql @@ -0,0 +1,14 @@ +select i_item_id + ,i_item_desc + ,i_current_price + from item, inventory, date_dim, store_sales + where i_current_price between 17 and 17+30 + and inv_item_sk = i_item_sk + and d_date_sk=inv_date_sk + and d_date between cast('1999-07-09' as date) and (cast('1999-07-09' as date) + interval 60 day) + and i_manufact_id in (639,169,138,339) + and inv_quantity_on_hand between 100 and 500 + and ss_item_sk = i_item_sk + group by i_item_id,i_item_desc,i_current_price + order by i_item_id + limit 100; diff --git a/tools/tpcds-tools/queries/sf100/query83.sql b/tools/tpcds-tools/queries/sf100/query83.sql new file mode 100644 index 00000000000000..aaec4bae693e9a --- /dev/null +++ b/tools/tpcds-tools/queries/sf100/query83.sql @@ -0,0 +1,64 @@ +with sr_items as + (select i_item_id item_id, + sum(sr_return_quantity) sr_item_qty + from store_returns, + item, + date_dim + where sr_item_sk = i_item_sk + and d_date in + (select d_date + from date_dim + where d_week_seq in + (select d_week_seq + from date_dim + where d_date in ('2001-06-06','2001-09-02','2001-11-11'))) + and sr_returned_date_sk = d_date_sk + group by i_item_id), + cr_items as + (select i_item_id item_id, + sum(cr_return_quantity) cr_item_qty + from catalog_returns, + item, + date_dim + where cr_item_sk = i_item_sk + and d_date in + (select d_date + from date_dim + where d_week_seq in + (select d_week_seq + from date_dim + where d_date in ('2001-06-06','2001-09-02','2001-11-11'))) + and cr_returned_date_sk = d_date_sk + group by i_item_id), + wr_items as + (select i_item_id item_id, + sum(wr_return_quantity) wr_item_qty + from web_returns, + item, + date_dim + where wr_item_sk = i_item_sk + and d_date in + (select d_date + from date_dim + where d_week_seq in + (select d_week_seq + from date_dim + where d_date in ('2001-06-06','2001-09-02','2001-11-11'))) + and wr_returned_date_sk = d_date_sk + group by i_item_id) + select sr_items.item_id + ,sr_item_qty + ,sr_item_qty/(sr_item_qty+cr_item_qty+wr_item_qty)/3.0 * 100 sr_dev + ,cr_item_qty + ,cr_item_qty/(sr_item_qty+cr_item_qty+wr_item_qty)/3.0 * 100 cr_dev + ,wr_item_qty + ,wr_item_qty/(sr_item_qty+cr_item_qty+wr_item_qty)/3.0 * 100 wr_dev + ,(sr_item_qty+cr_item_qty+wr_item_qty)/3.0 average + from sr_items + ,cr_items + ,wr_items + where sr_items.item_id=cr_items.item_id + and sr_items.item_id=wr_items.item_id + order by sr_items.item_id + ,sr_item_qty + limit 100; diff --git a/tools/tpcds-tools/queries/sf100/query84.sql b/tools/tpcds-tools/queries/sf100/query84.sql new file mode 100644 index 00000000000000..b81572b0b81d0f --- /dev/null +++ b/tools/tpcds-tools/queries/sf100/query84.sql @@ -0,0 +1,18 @@ +select c_customer_id as customer_id + , concat(concat(coalesce(c_last_name,''), ','), coalesce(c_first_name,'')) as customername + from customer + ,customer_address + ,customer_demographics + ,household_demographics + ,income_band + ,store_returns + where ca_city = 'Oakwood' + and c_current_addr_sk = ca_address_sk + and ib_lower_bound >= 5806 + and ib_upper_bound <= 5806 + 50000 + and ib_income_band_sk = hd_income_band_sk + and cd_demo_sk = c_current_cdemo_sk + and hd_demo_sk = c_current_hdemo_sk + and sr_cdemo_sk = cd_demo_sk + order by c_customer_id + limit 100; diff --git a/tools/tpcds-tools/queries/sf100/query85.sql b/tools/tpcds-tools/queries/sf100/query85.sql new file mode 100644 index 00000000000000..36569f1c3243c8 --- /dev/null +++ b/tools/tpcds-tools/queries/sf100/query85.sql @@ -0,0 +1,81 @@ +select substr(r_reason_desc,1,20) + ,avg(ws_quantity) + ,avg(wr_refunded_cash) + ,avg(wr_fee) + from web_sales, web_returns, web_page, customer_demographics cd1, + customer_demographics cd2, customer_address, date_dim, reason + where ws_web_page_sk = wp_web_page_sk + and ws_item_sk = wr_item_sk + and ws_order_number = wr_order_number + and ws_sold_date_sk = d_date_sk and d_year = 2000 + and cd1.cd_demo_sk = wr_refunded_cdemo_sk + and cd2.cd_demo_sk = wr_returning_cdemo_sk + and ca_address_sk = wr_refunded_addr_sk + and r_reason_sk = wr_reason_sk + and + ( + ( + cd1.cd_marital_status = 'M' + and + cd1.cd_marital_status = cd2.cd_marital_status + and + cd1.cd_education_status = '4 yr Degree' + and + cd1.cd_education_status = cd2.cd_education_status + and + ws_sales_price between 100.00 and 150.00 + ) + or + ( + cd1.cd_marital_status = 'S' + and + cd1.cd_marital_status = cd2.cd_marital_status + and + cd1.cd_education_status = 'Secondary' + and + cd1.cd_education_status = cd2.cd_education_status + and + ws_sales_price between 50.00 and 100.00 + ) + or + ( + cd1.cd_marital_status = 'W' + and + cd1.cd_marital_status = cd2.cd_marital_status + and + cd1.cd_education_status = 'Advanced Degree' + and + cd1.cd_education_status = cd2.cd_education_status + and + ws_sales_price between 150.00 and 200.00 + ) + ) + and + ( + ( + ca_country = 'United States' + and + ca_state in ('FL', 'TX', 'DE') + and ws_net_profit between 100 and 200 + ) + or + ( + ca_country = 'United States' + and + ca_state in ('IN', 'ND', 'ID') + and ws_net_profit between 150 and 300 + ) + or + ( + ca_country = 'United States' + and + ca_state in ('MT', 'IL', 'OH') + and ws_net_profit between 50 and 250 + ) + ) +group by r_reason_desc +order by substr(r_reason_desc,1,20) + ,avg(ws_quantity) + ,avg(wr_refunded_cash) + ,avg(wr_fee) +limit 100; diff --git a/tools/tpcds-tools/queries/sf100/query86.sql b/tools/tpcds-tools/queries/sf100/query86.sql new file mode 100644 index 00000000000000..8d60daa01134c5 --- /dev/null +++ b/tools/tpcds-tools/queries/sf100/query86.sql @@ -0,0 +1,23 @@ +select + sum(ws_net_paid) as total_sum + ,i_category + ,i_class + ,grouping(i_category)+grouping(i_class) as lochierarchy + ,rank() over ( + partition by grouping(i_category)+grouping(i_class), + case when grouping(i_class) = 0 then i_category end + order by sum(ws_net_paid) desc) as rank_within_parent + from + web_sales + ,date_dim d1 + ,item + where + d1.d_month_seq between 1224 and 1224+11 + and d1.d_date_sk = ws_sold_date_sk + and i_item_sk = ws_item_sk + group by rollup(i_category,i_class) + order by + lochierarchy desc, + case when lochierarchy = 0 then i_category end, + rank_within_parent + limit 100; diff --git a/tools/tpcds-tools/queries/sf100/query87.sql b/tools/tpcds-tools/queries/sf100/query87.sql new file mode 100644 index 00000000000000..ae93763fb81c9a --- /dev/null +++ b/tools/tpcds-tools/queries/sf100/query87.sql @@ -0,0 +1,20 @@ +select count(*) +from ((select distinct c_last_name, c_first_name, d_date + from store_sales, date_dim, customer + where store_sales.ss_sold_date_sk = date_dim.d_date_sk + and store_sales.ss_customer_sk = customer.c_customer_sk + and d_month_seq between 1184 and 1184+11) + except + (select distinct c_last_name, c_first_name, d_date + from catalog_sales, date_dim, customer + where catalog_sales.cs_sold_date_sk = date_dim.d_date_sk + and catalog_sales.cs_bill_customer_sk = customer.c_customer_sk + and d_month_seq between 1184 and 1184+11) + except + (select distinct c_last_name, c_first_name, d_date + from web_sales, date_dim, customer + where web_sales.ws_sold_date_sk = date_dim.d_date_sk + and web_sales.ws_bill_customer_sk = customer.c_customer_sk + and d_month_seq between 1184 and 1184+11) +) cool_cust +; diff --git a/tools/tpcds-tools/queries/sf100/query88.sql b/tools/tpcds-tools/queries/sf100/query88.sql new file mode 100644 index 00000000000000..24a1981668b1f3 --- /dev/null +++ b/tools/tpcds-tools/queries/sf100/query88.sql @@ -0,0 +1,91 @@ +select * +from + (select count(*) h8_30_to_9 + from store_sales, household_demographics , time_dim, store + where ss_sold_time_sk = time_dim.t_time_sk + and ss_hdemo_sk = household_demographics.hd_demo_sk + and ss_store_sk = s_store_sk + and time_dim.t_hour = 8 + and time_dim.t_minute >= 30 + and ((household_demographics.hd_dep_count = -1 and household_demographics.hd_vehicle_count<=-1+2) or + (household_demographics.hd_dep_count = 4 and household_demographics.hd_vehicle_count<=4+2) or + (household_demographics.hd_dep_count = 3 and household_demographics.hd_vehicle_count<=3+2)) + and store.s_store_name = 'ese') s1, + (select count(*) h9_to_9_30 + from store_sales, household_demographics , time_dim, store + where ss_sold_time_sk = time_dim.t_time_sk + and ss_hdemo_sk = household_demographics.hd_demo_sk + and ss_store_sk = s_store_sk + and time_dim.t_hour = 9 + and time_dim.t_minute < 30 + and ((household_demographics.hd_dep_count = -1 and household_demographics.hd_vehicle_count<=-1+2) or + (household_demographics.hd_dep_count = 4 and household_demographics.hd_vehicle_count<=4+2) or + (household_demographics.hd_dep_count = 3 and household_demographics.hd_vehicle_count<=3+2)) + and store.s_store_name = 'ese') s2, + (select count(*) h9_30_to_10 + from store_sales, household_demographics , time_dim, store + where ss_sold_time_sk = time_dim.t_time_sk + and ss_hdemo_sk = household_demographics.hd_demo_sk + and ss_store_sk = s_store_sk + and time_dim.t_hour = 9 + and time_dim.t_minute >= 30 + and ((household_demographics.hd_dep_count = -1 and household_demographics.hd_vehicle_count<=-1+2) or + (household_demographics.hd_dep_count = 4 and household_demographics.hd_vehicle_count<=4+2) or + (household_demographics.hd_dep_count = 3 and household_demographics.hd_vehicle_count<=3+2)) + and store.s_store_name = 'ese') s3, + (select count(*) h10_to_10_30 + from store_sales, household_demographics , time_dim, store + where ss_sold_time_sk = time_dim.t_time_sk + and ss_hdemo_sk = household_demographics.hd_demo_sk + and ss_store_sk = s_store_sk + and time_dim.t_hour = 10 + and time_dim.t_minute < 30 + and ((household_demographics.hd_dep_count = -1 and household_demographics.hd_vehicle_count<=-1+2) or + (household_demographics.hd_dep_count = 4 and household_demographics.hd_vehicle_count<=4+2) or + (household_demographics.hd_dep_count = 3 and household_demographics.hd_vehicle_count<=3+2)) + and store.s_store_name = 'ese') s4, + (select count(*) h10_30_to_11 + from store_sales, household_demographics , time_dim, store + where ss_sold_time_sk = time_dim.t_time_sk + and ss_hdemo_sk = household_demographics.hd_demo_sk + and ss_store_sk = s_store_sk + and time_dim.t_hour = 10 + and time_dim.t_minute >= 30 + and ((household_demographics.hd_dep_count = -1 and household_demographics.hd_vehicle_count<=-1+2) or + (household_demographics.hd_dep_count = 4 and household_demographics.hd_vehicle_count<=4+2) or + (household_demographics.hd_dep_count = 3 and household_demographics.hd_vehicle_count<=3+2)) + and store.s_store_name = 'ese') s5, + (select count(*) h11_to_11_30 + from store_sales, household_demographics , time_dim, store + where ss_sold_time_sk = time_dim.t_time_sk + and ss_hdemo_sk = household_demographics.hd_demo_sk + and ss_store_sk = s_store_sk + and time_dim.t_hour = 11 + and time_dim.t_minute < 30 + and ((household_demographics.hd_dep_count = -1 and household_demographics.hd_vehicle_count<=-1+2) or + (household_demographics.hd_dep_count = 4 and household_demographics.hd_vehicle_count<=4+2) or + (household_demographics.hd_dep_count = 3 and household_demographics.hd_vehicle_count<=3+2)) + and store.s_store_name = 'ese') s6, + (select count(*) h11_30_to_12 + from store_sales, household_demographics , time_dim, store + where ss_sold_time_sk = time_dim.t_time_sk + and ss_hdemo_sk = household_demographics.hd_demo_sk + and ss_store_sk = s_store_sk + and time_dim.t_hour = 11 + and time_dim.t_minute >= 30 + and ((household_demographics.hd_dep_count = -1 and household_demographics.hd_vehicle_count<=-1+2) or + (household_demographics.hd_dep_count = 4 and household_demographics.hd_vehicle_count<=4+2) or + (household_demographics.hd_dep_count = 3 and household_demographics.hd_vehicle_count<=3+2)) + and store.s_store_name = 'ese') s7, + (select count(*) h12_to_12_30 + from store_sales, household_demographics , time_dim, store + where ss_sold_time_sk = time_dim.t_time_sk + and ss_hdemo_sk = household_demographics.hd_demo_sk + and ss_store_sk = s_store_sk + and time_dim.t_hour = 12 + and time_dim.t_minute < 30 + and ((household_demographics.hd_dep_count = -1 and household_demographics.hd_vehicle_count<=-1+2) or + (household_demographics.hd_dep_count = 4 and household_demographics.hd_vehicle_count<=4+2) or + (household_demographics.hd_dep_count = 3 and household_demographics.hd_vehicle_count<=3+2)) + and store.s_store_name = 'ese') s8 +; diff --git a/tools/tpcds-tools/queries/sf100/query89.sql b/tools/tpcds-tools/queries/sf100/query89.sql new file mode 100644 index 00000000000000..f36384519541b8 --- /dev/null +++ b/tools/tpcds-tools/queries/sf100/query89.sql @@ -0,0 +1,25 @@ +select * +from( +select i_category, i_class, i_brand, + s_store_name, s_company_name, + d_moy, + sum(ss_sales_price) sum_sales, + avg(sum(ss_sales_price)) over + (partition by i_category, i_brand, s_store_name, s_company_name) + avg_monthly_sales +from item, store_sales, date_dim, store +where ss_item_sk = i_item_sk and + ss_sold_date_sk = d_date_sk and + ss_store_sk = s_store_sk and + d_year in (1999) and + ((i_category in ('Jewelry','Shoes','Electronics') and + i_class in ('semi-precious','athletic','portable') + ) + or (i_category in ('Men','Music','Women') and + i_class in ('accessories','rock','maternity') + )) +group by i_category, i_class, i_brand, + s_store_name, s_company_name, d_moy) tmp1 +where case when (avg_monthly_sales <> 0) then (abs(sum_sales - avg_monthly_sales) / avg_monthly_sales) else null end > 0.1 +order by sum_sales - avg_monthly_sales, s_store_name +limit 100; diff --git a/tools/tpcds-tools/queries/sf100/query9.sql b/tools/tpcds-tools/queries/sf100/query9.sql new file mode 100644 index 00000000000000..2819f87aec7282 --- /dev/null +++ b/tools/tpcds-tools/queries/sf100/query9.sql @@ -0,0 +1,48 @@ +select case when (select count(*) + from store_sales + where ss_quantity between 1 and 20) > 2972190 + then (select avg(ss_ext_sales_price) + from store_sales + where ss_quantity between 1 and 20) + else (select avg(ss_net_profit) + from store_sales + where ss_quantity between 1 and 20) end bucket1 , + case when (select count(*) + from store_sales + where ss_quantity between 21 and 40) > 4505785 + then (select avg(ss_ext_sales_price) + from store_sales + where ss_quantity between 21 and 40) + else (select avg(ss_net_profit) + from store_sales + where ss_quantity between 21 and 40) end bucket2, + case when (select count(*) + from store_sales + where ss_quantity between 41 and 60) > 1575726 + then (select avg(ss_ext_sales_price) + from store_sales + where ss_quantity between 41 and 60) + else (select avg(ss_net_profit) + from store_sales + where ss_quantity between 41 and 60) end bucket3, + case when (select count(*) + from store_sales + where ss_quantity between 61 and 80) > 3188917 + then (select avg(ss_ext_sales_price) + from store_sales + where ss_quantity between 61 and 80) + else (select avg(ss_net_profit) + from store_sales + where ss_quantity between 61 and 80) end bucket4, + case when (select count(*) + from store_sales + where ss_quantity between 81 and 100) > 3525216 + then (select avg(ss_ext_sales_price) + from store_sales + where ss_quantity between 81 and 100) + else (select avg(ss_net_profit) + from store_sales + where ss_quantity between 81 and 100) end bucket5 +from reason +where r_reason_sk = 1 +; diff --git a/tools/tpcds-tools/queries/sf100/query90.sql b/tools/tpcds-tools/queries/sf100/query90.sql new file mode 100644 index 00000000000000..dc13cd42b70345 --- /dev/null +++ b/tools/tpcds-tools/queries/sf100/query90.sql @@ -0,0 +1,19 @@ +select cast(amc as decimal(15,4))/cast(pmc as decimal(15,4)) am_pm_ratio + from ( select count(*) amc + from web_sales, household_demographics , time_dim, web_page + where ws_sold_time_sk = time_dim.t_time_sk + and ws_ship_hdemo_sk = household_demographics.hd_demo_sk + and ws_web_page_sk = web_page.wp_web_page_sk + and time_dim.t_hour between 10 and 10+1 + and household_demographics.hd_dep_count = 2 + and web_page.wp_char_count between 5000 and 5200) at, + ( select count(*) pmc + from web_sales, household_demographics , time_dim, web_page + where ws_sold_time_sk = time_dim.t_time_sk + and ws_ship_hdemo_sk = household_demographics.hd_demo_sk + and ws_web_page_sk = web_page.wp_web_page_sk + and time_dim.t_hour between 16 and 16+1 + and household_demographics.hd_dep_count = 2 + and web_page.wp_char_count between 5000 and 5200) pt + order by am_pm_ratio + limit 100; diff --git a/tools/tpcds-tools/queries/sf100/query91.sql b/tools/tpcds-tools/queries/sf100/query91.sql new file mode 100644 index 00000000000000..ef4be4683deabe --- /dev/null +++ b/tools/tpcds-tools/queries/sf100/query91.sql @@ -0,0 +1,28 @@ +select + cc_call_center_id Call_Center, + cc_name Call_Center_Name, + cc_manager Manager, + sum(cr_net_loss) Returns_Loss +from + call_center, + catalog_returns, + date_dim, + customer, + customer_address, + customer_demographics, + household_demographics +where + cr_call_center_sk = cc_call_center_sk +and cr_returned_date_sk = d_date_sk +and cr_returning_customer_sk= c_customer_sk +and cd_demo_sk = c_current_cdemo_sk +and hd_demo_sk = c_current_hdemo_sk +and ca_address_sk = c_current_addr_sk +and d_year = 2001 +and d_moy = 11 +and ( (cd_marital_status = 'M' and cd_education_status = 'Unknown') + or(cd_marital_status = 'W' and cd_education_status = 'Advanced Degree')) +and hd_buy_potential like '1001-5000%' +and ca_gmt_offset = -6 +group by cc_call_center_id,cc_name,cc_manager,cd_marital_status,cd_education_status +order by sum(cr_net_loss) desc; diff --git a/tools/tpcds-tools/queries/sf100/query92.sql b/tools/tpcds-tools/queries/sf100/query92.sql new file mode 100644 index 00000000000000..633ac476c3dde2 --- /dev/null +++ b/tools/tpcds-tools/queries/sf100/query92.sql @@ -0,0 +1,27 @@ +select + sum(ws_ext_discount_amt) as "Excess Discount Amount" +from + web_sales + ,item + ,date_dim +where +i_manufact_id = 320 +and i_item_sk = ws_item_sk +and d_date between '2002-02-26' and + (cast('2002-02-26' as date) + interval 90 day) +and d_date_sk = ws_sold_date_sk +and ws_ext_discount_amt + > ( + SELECT + 1.3 * avg(ws_ext_discount_amt) + FROM + web_sales + ,date_dim + WHERE + ws_item_sk = i_item_sk + and d_date between '2002-02-26' and + (cast('2002-02-26' as date) + interval 90 day) + and d_date_sk = ws_sold_date_sk + ) +order by sum(ws_ext_discount_amt) +limit 100; diff --git a/tools/tpcds-tools/queries/sf100/query93.sql b/tools/tpcds-tools/queries/sf100/query93.sql new file mode 100644 index 00000000000000..6049e60cb39f25 --- /dev/null +++ b/tools/tpcds-tools/queries/sf100/query93.sql @@ -0,0 +1,15 @@ +select ss_customer_sk + ,sum(act_sales) sumsales + from (select ss_item_sk + ,ss_ticket_number + ,ss_customer_sk + ,case when sr_return_quantity is not null then (ss_quantity-sr_return_quantity)*ss_sales_price + else (ss_quantity*ss_sales_price) end act_sales + from store_sales left outer join store_returns on (sr_item_sk = ss_item_sk + and sr_ticket_number = ss_ticket_number) + ,reason + where sr_reason_sk = r_reason_sk + and r_reason_desc = 'duplicate purchase') t + group by ss_customer_sk + order by sumsales, ss_customer_sk +limit 100; diff --git a/tools/tpcds-tools/queries/sf100/query94.sql b/tools/tpcds-tools/queries/sf100/query94.sql new file mode 100644 index 00000000000000..dc1fc0b636d54a --- /dev/null +++ b/tools/tpcds-tools/queries/sf100/query94.sql @@ -0,0 +1,26 @@ +select + count(distinct ws_order_number) as "order count" + ,sum(ws_ext_ship_cost) as "total shipping cost" + ,sum(ws_net_profit) as "total net profit" +from + web_sales ws1 + ,date_dim + ,customer_address + ,web_site +where + d_date between '2000-2-01' and + (cast('2000-2-01' as date) + interval 60 day) +and ws1.ws_ship_date_sk = d_date_sk +and ws1.ws_ship_addr_sk = ca_address_sk +and ca_state = 'OK' +and ws1.ws_web_site_sk = web_site_sk +and web_company_name = 'pri' +and exists (select * + from web_sales ws2 + where ws1.ws_order_number = ws2.ws_order_number + and ws1.ws_warehouse_sk <> ws2.ws_warehouse_sk) +and not exists(select * + from web_returns wr1 + where ws1.ws_order_number = wr1.wr_order_number) +order by count(distinct ws_order_number) +limit 100; diff --git a/tools/tpcds-tools/queries/sf100/query95.sql b/tools/tpcds-tools/queries/sf100/query95.sql new file mode 100644 index 00000000000000..bd119a63bc0eb3 --- /dev/null +++ b/tools/tpcds-tools/queries/sf100/query95.sql @@ -0,0 +1,29 @@ +with ws_wh as +(select ws1.ws_order_number,ws1.ws_warehouse_sk wh1,ws2.ws_warehouse_sk wh2 + from web_sales ws1,web_sales ws2 + where ws1.ws_order_number = ws2.ws_order_number + and ws1.ws_warehouse_sk <> ws2.ws_warehouse_sk) + select + count(distinct ws_order_number) as "order count" + ,sum(ws_ext_ship_cost) as "total shipping cost" + ,sum(ws_net_profit) as "total net profit" +from + web_sales ws1 + ,date_dim + ,customer_address + ,web_site +where + d_date between '1999-2-01' and + (cast('1999-2-01' as date) + interval 60 day) +and ws1.ws_ship_date_sk = d_date_sk +and ws1.ws_ship_addr_sk = ca_address_sk +and ca_state = 'NC' +and ws1.ws_web_site_sk = web_site_sk +and web_company_name = 'pri' +and ws1.ws_order_number in (select ws_order_number + from ws_wh) +and ws1.ws_order_number in (select wr_order_number + from web_returns,ws_wh + where wr_order_number = ws_wh.ws_order_number) +order by count(distinct ws_order_number) +limit 100; diff --git a/tools/tpcds-tools/queries/sf100/query96.sql b/tools/tpcds-tools/queries/sf100/query96.sql new file mode 100644 index 00000000000000..14c273f2a00fb1 --- /dev/null +++ b/tools/tpcds-tools/queries/sf100/query96.sql @@ -0,0 +1,13 @@ +select count(*) +from store_sales + ,household_demographics + ,time_dim, store +where ss_sold_time_sk = time_dim.t_time_sk + and ss_hdemo_sk = household_demographics.hd_demo_sk + and ss_store_sk = s_store_sk + and time_dim.t_hour = 8 + and time_dim.t_minute >= 30 + and household_demographics.hd_dep_count = 3 + and store.s_store_name = 'ese' +order by count(*) +limit 100; diff --git a/tools/tpcds-tools/queries/sf100/query97.sql b/tools/tpcds-tools/queries/sf100/query97.sql new file mode 100644 index 00000000000000..8e16ed04fc721b --- /dev/null +++ b/tools/tpcds-tools/queries/sf100/query97.sql @@ -0,0 +1,22 @@ +with ssci as ( +select ss_customer_sk customer_sk + ,ss_item_sk item_sk +from store_sales,date_dim +where ss_sold_date_sk = d_date_sk + and d_month_seq between 1214 and 1214 + 11 +group by ss_customer_sk + ,ss_item_sk), +csci as( + select cs_bill_customer_sk customer_sk + ,cs_item_sk item_sk +from catalog_sales,date_dim +where cs_sold_date_sk = d_date_sk + and d_month_seq between 1214 and 1214 + 11 +group by cs_bill_customer_sk + ,cs_item_sk) + select sum(case when ssci.customer_sk is not null and csci.customer_sk is null then 1 else 0 end) store_only + ,sum(case when ssci.customer_sk is null and csci.customer_sk is not null then 1 else 0 end) catalog_only + ,sum(case when ssci.customer_sk is not null and csci.customer_sk is not null then 1 else 0 end) store_and_catalog +from ssci full outer join csci on (ssci.customer_sk=csci.customer_sk + and ssci.item_sk = csci.item_sk) +limit 100; diff --git a/tools/tpcds-tools/queries/sf100/query98.sql b/tools/tpcds-tools/queries/sf100/query98.sql new file mode 100644 index 00000000000000..e015d32ee9668d --- /dev/null +++ b/tools/tpcds-tools/queries/sf100/query98.sql @@ -0,0 +1,30 @@ +select i_item_id + ,i_item_desc + ,i_category + ,i_class + ,i_current_price + ,sum(ss_ext_sales_price) as itemrevenue + ,sum(ss_ext_sales_price)*100/sum(sum(ss_ext_sales_price)) over + (partition by i_class) as revenueratio +from + store_sales + ,item + ,date_dim +where + ss_item_sk = i_item_sk + and i_category in ('Sports', 'Music', 'Shoes') + and ss_sold_date_sk = d_date_sk + and d_date between cast('2002-05-20' as date) + and (cast('2002-05-20' as date) + interval 30 day) +group by + i_item_id + ,i_item_desc + ,i_category + ,i_class + ,i_current_price +order by + i_category + ,i_class + ,i_item_id + ,i_item_desc + ,revenueratio; diff --git a/tools/tpcds-tools/queries/sf100/query99.sql b/tools/tpcds-tools/queries/sf100/query99.sql new file mode 100644 index 00000000000000..563c22dd618f40 --- /dev/null +++ b/tools/tpcds-tools/queries/sf100/query99.sql @@ -0,0 +1,32 @@ +select + substr(w_warehouse_name,1,20) + ,sm_type + ,cc_name + ,sum(case when (cs_ship_date_sk - cs_sold_date_sk <= 30 ) then 1 else 0 end) as "30 days" + ,sum(case when (cs_ship_date_sk - cs_sold_date_sk > 30) and + (cs_ship_date_sk - cs_sold_date_sk <= 60) then 1 else 0 end ) as "31-60 days" + ,sum(case when (cs_ship_date_sk - cs_sold_date_sk > 60) and + (cs_ship_date_sk - cs_sold_date_sk <= 90) then 1 else 0 end) as "61-90 days" + ,sum(case when (cs_ship_date_sk - cs_sold_date_sk > 90) and + (cs_ship_date_sk - cs_sold_date_sk <= 120) then 1 else 0 end) as "91-120 days" + ,sum(case when (cs_ship_date_sk - cs_sold_date_sk > 120) then 1 else 0 end) as ">120 days" +from + catalog_sales + ,warehouse + ,ship_mode + ,call_center + ,date_dim +where + d_month_seq between 1224 and 1224 + 11 +and cs_ship_date_sk = d_date_sk +and cs_warehouse_sk = w_warehouse_sk +and cs_ship_mode_sk = sm_ship_mode_sk +and cs_call_center_sk = cc_call_center_sk +group by + substr(w_warehouse_name,1,20) + ,sm_type + ,cc_name +order by substr(w_warehouse_name,1,20) + ,sm_type + ,cc_name +limit 100;