[fix](nereids) runtimefilter not generated after postprocessor (#23948)
fix bug: rf not generated
This commit is contained in:
@ -60,6 +60,8 @@ public class PlanPostProcessors {
|
||||
Builder<PlanPostProcessor> builder = ImmutableList.builder();
|
||||
builder.add(new PushdownFilterThroughProject());
|
||||
builder.add(new MergeProjectPostProcessor());
|
||||
builder.add(new RecomputeLogicalPropertiesProcessor());
|
||||
// after generate rf, DO NOT replace PLAN NODE
|
||||
builder.add(new FragmentProcessor());
|
||||
if (!cascadesContext.getConnectContext().getSessionVariable().getRuntimeFilterMode()
|
||||
.toUpperCase().equals(TRuntimeFilterMode.OFF.name())) {
|
||||
@ -69,7 +71,6 @@ public class PlanPostProcessors {
|
||||
}
|
||||
}
|
||||
builder.add(new Validator());
|
||||
builder.add(new RecomputeLogicalPropertiesProcessor());
|
||||
builder.add(new TopNScanOpt());
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
@ -55,10 +55,10 @@ testDirectories = ""
|
||||
excludeGroups = ""
|
||||
// this suites will not be executed
|
||||
|
||||
excludeSuites = "test_ddl,test_analyze,test_leading,test_stream_load_move_memtable,ds_rf95,test_profile,test_broker_load,test_spark_load,test_refresh_mtmv,test_bitmap_filter,test_export_parquet,test_doris_jdbc_catalog,nereids_delete_mow_partial_update"
|
||||
excludeSuites = "test_ddl,test_analyze,test_leading,test_stream_load_move_memtable,ds_rf95ds_rf16,ds_rf94,test_profile,test_broker_load,test_spark_load,test_refresh_mtmv,test_bitmap_filter,test_export_parquet,test_doris_jdbc_catalog,nereids_delete_mow_partial_update"
|
||||
|
||||
// this directories will not be executed
|
||||
excludeDirectories = "workload_manager_p1,nereids_tpch_shape_sf1000_p0,nereids_tpcds_shape_sf100_p0"
|
||||
excludeDirectories = "workload_manager_p1"
|
||||
|
||||
customConf1 = "test_custom_conf_value"
|
||||
|
||||
|
||||
@ -35,7 +35,7 @@ suite("ds_rf{--}") {
|
||||
{query}
|
||||
'''
|
||||
String plan = sql "${stmt}"
|
||||
println plan
|
||||
log.info(plan)
|
||||
def getRuntimeFilters = { plantree ->
|
||||
{
|
||||
def lst = []
|
||||
|
||||
@ -32,32 +32,32 @@ suite("ds_rf1") {
|
||||
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;
|
||||
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
|
||||
log.info(plan)
|
||||
def getRuntimeFilters = { plantree ->
|
||||
{
|
||||
def lst = []
|
||||
|
||||
@ -32,66 +32,66 @@ suite("ds_rf10") {
|
||||
sql 'set enable_pipeline_engine=true'
|
||||
String stmt = '''
|
||||
explain physical plan
|
||||
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;
|
||||
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;
|
||||
|
||||
'''
|
||||
String plan = sql "${stmt}"
|
||||
println plan
|
||||
log.info(plan)
|
||||
def getRuntimeFilters = { plantree ->
|
||||
{
|
||||
def lst = []
|
||||
|
||||
@ -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}"
|
||||
log.info(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))
|
||||
}
|
||||
|
||||
@ -32,41 +32,41 @@ suite("ds_rf12") {
|
||||
sql 'set enable_pipeline_engine=true'
|
||||
String stmt = '''
|
||||
explain physical plan
|
||||
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;
|
||||
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;
|
||||
|
||||
'''
|
||||
String plan = sql "${stmt}"
|
||||
println plan
|
||||
log.info(plan)
|
||||
def getRuntimeFilters = { plantree ->
|
||||
{
|
||||
def lst = []
|
||||
|
||||
@ -32,59 +32,59 @@ suite("ds_rf13") {
|
||||
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)
|
||||
,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
|
||||
))
|
||||
;
|
||||
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
|
||||
))
|
||||
;
|
||||
|
||||
'''
|
||||
String plan = sql "${stmt}"
|
||||
println plan
|
||||
log.info(plan)
|
||||
def getRuntimeFilters = { plantree ->
|
||||
{
|
||||
def lst = []
|
||||
|
||||
@ -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_rf14") {
|
||||
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_rf14") {
|
||||
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 cross_items as
|
||||
(select i_item_sk ss_item_sk
|
||||
from item,
|
||||
@ -133,26 +133,26 @@ suite("ds_rf14") {
|
||||
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;
|
||||
|
||||
'''
|
||||
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.14"
|
||||
// File file = new File(outFile)
|
||||
// file.write(getRuntimeFilters(plan))
|
||||
|
||||
assertEquals("RF6[class_id->[i_class_id],RF7[category_id->[i_category_id],RF8[brand_id->[i_brand_id],RF1[i_item_sk->[ss_item_sk],RF0[d_date_sk->[ss_sold_date_sk],RF3[i_item_sk->[cs_item_sk],RF2[d_date_sk->[cs_sold_date_sk],RF5[i_item_sk->[ws_item_sk],RF4[d_date_sk->[ws_sold_date_sk],RF9[d_date_sk->[ss_sold_date_sk],RF10[d_date_sk->[cs_sold_date_sk],RF11[d_date_sk->[ws_sold_date_sk],RF14[ss_item_sk->[ss_item_sk],RF13[i_item_sk->[ss_item_sk],RF12[d_date_sk->[ss_sold_date_sk],RF17[cs_item_sk->[ss_item_sk],RF16[i_item_sk->[cs_item_sk],RF15[d_date_sk->[cs_sold_date_sk],RF20[ws_item_sk->[ss_item_sk],RF19[i_item_sk->[ws_item_sk],RF18[d_date_sk->[ws_sold_date_sk]", getRuntimeFilters(plan))
|
||||
}
|
||||
|
||||
'''
|
||||
String plan = sql "${stmt}"
|
||||
log.info(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.14"
|
||||
// File file = new File(outFile)
|
||||
// file.write(getRuntimeFilters(plan))
|
||||
|
||||
assertEquals("RF6[class_id->[i_class_id],RF7[category_id->[i_category_id],RF8[brand_id->[i_brand_id],RF1[i_item_sk->[ss_item_sk],RF0[d_date_sk->[ss_sold_date_sk],RF3[i_item_sk->[cs_item_sk],RF2[d_date_sk->[cs_sold_date_sk],RF5[i_item_sk->[ws_item_sk],RF4[d_date_sk->[ws_sold_date_sk],RF9[d_date_sk->[ss_sold_date_sk],RF10[d_date_sk->[cs_sold_date_sk],RF11[d_date_sk->[ws_sold_date_sk],RF14[ss_item_sk->[ss_item_sk],RF13[i_item_sk->[ss_item_sk],RF12[d_date_sk->[ss_sold_date_sk],RF17[cs_item_sk->[ss_item_sk],RF16[i_item_sk->[cs_item_sk],RF15[d_date_sk->[cs_sold_date_sk],RF20[ws_item_sk->[ss_item_sk],RF19[i_item_sk->[ws_item_sk],RF18[d_date_sk->[ws_sold_date_sk]", getRuntimeFilters(plan))
|
||||
}
|
||||
|
||||
@ -32,27 +32,27 @@ suite("ds_rf15") {
|
||||
sql 'set enable_pipeline_engine=true'
|
||||
String stmt = '''
|
||||
explain physical plan
|
||||
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;
|
||||
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;
|
||||
|
||||
'''
|
||||
String plan = sql "${stmt}"
|
||||
println plan
|
||||
log.info(plan)
|
||||
def getRuntimeFilters = { plantree ->
|
||||
{
|
||||
def lst = []
|
||||
|
||||
@ -32,38 +32,38 @@ suite("ds_rf16") {
|
||||
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"
|
||||
,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;
|
||||
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;
|
||||
|
||||
'''
|
||||
String plan = sql "${stmt}"
|
||||
println plan
|
||||
log.info(plan)
|
||||
def getRuntimeFilters = { plantree ->
|
||||
{
|
||||
def lst = []
|
||||
|
||||
@ -32,52 +32,52 @@ suite("ds_rf17") {
|
||||
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;
|
||||
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
|
||||
log.info(plan)
|
||||
def getRuntimeFilters = { plantree ->
|
||||
{
|
||||
def lst = []
|
||||
|
||||
@ -32,41 +32,41 @@ suite("ds_rf18") {
|
||||
sql 'set enable_pipeline_engine=true'
|
||||
String stmt = '''
|
||||
explain physical plan
|
||||
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;
|
||||
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;
|
||||
|
||||
'''
|
||||
String plan = sql "${stmt}"
|
||||
println plan
|
||||
log.info(plan)
|
||||
def getRuntimeFilters = { plantree ->
|
||||
{
|
||||
def lst = []
|
||||
|
||||
@ -32,32 +32,32 @@ suite("ds_rf19") {
|
||||
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
|
||||
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 ;
|
||||
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 ;
|
||||
|
||||
'''
|
||||
String plan = sql "${stmt}"
|
||||
println plan
|
||||
log.info(plan)
|
||||
def getRuntimeFilters = { plantree ->
|
||||
{
|
||||
def lst = []
|
||||
|
||||
@ -92,7 +92,7 @@ suite("ds_rf2") {
|
||||
|
||||
'''
|
||||
String plan = sql "${stmt}"
|
||||
println plan
|
||||
log.info(plan)
|
||||
def getRuntimeFilters = { plantree ->
|
||||
{
|
||||
def lst = []
|
||||
|
||||
@ -32,37 +32,37 @@ suite("ds_rf20") {
|
||||
sql 'set enable_pipeline_engine=true'
|
||||
String stmt = '''
|
||||
explain physical plan
|
||||
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;
|
||||
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;
|
||||
|
||||
'''
|
||||
String plan = sql "${stmt}"
|
||||
println plan
|
||||
log.info(plan)
|
||||
def getRuntimeFilters = { plantree ->
|
||||
{
|
||||
def lst = []
|
||||
|
||||
@ -32,37 +32,37 @@ suite("ds_rf21") {
|
||||
sql 'set enable_pipeline_engine=true'
|
||||
String stmt = '''
|
||||
explain physical plan
|
||||
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;
|
||||
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;
|
||||
|
||||
'''
|
||||
String plan = sql "${stmt}"
|
||||
println plan
|
||||
log.info(plan)
|
||||
def getRuntimeFilters = { plantree ->
|
||||
{
|
||||
def lst = []
|
||||
|
||||
@ -32,27 +32,27 @@ suite("ds_rf22") {
|
||||
sql 'set enable_pipeline_engine=true'
|
||||
String stmt = '''
|
||||
explain physical plan
|
||||
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;
|
||||
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;
|
||||
|
||||
'''
|
||||
String plan = sql "${stmt}"
|
||||
println plan
|
||||
log.info(plan)
|
||||
def getRuntimeFilters = { plantree ->
|
||||
{
|
||||
def lst = []
|
||||
|
||||
@ -32,59 +32,59 @@ suite("ds_rf23") {
|
||||
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
|
||||
,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 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;
|
||||
|
||||
'''
|
||||
String plan = sql "${stmt}"
|
||||
println plan
|
||||
log.info(plan)
|
||||
def getRuntimeFilters = { plantree ->
|
||||
{
|
||||
def lst = []
|
||||
|
||||
@ -32,62 +32,62 @@ suite("ds_rf24") {
|
||||
sql 'set enable_pipeline_engine=true'
|
||||
String stmt = '''
|
||||
explain physical plan
|
||||
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 = '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
|
||||
;
|
||||
|
||||
'''
|
||||
String plan = sql "${stmt}"
|
||||
println plan
|
||||
log.info(plan)
|
||||
def getRuntimeFilters = { plantree ->
|
||||
{
|
||||
def lst = []
|
||||
|
||||
@ -32,55 +32,55 @@ suite("ds_rf25") {
|
||||
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;
|
||||
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
|
||||
log.info(plan)
|
||||
def getRuntimeFilters = { plantree ->
|
||||
{
|
||||
def lst = []
|
||||
|
||||
@ -32,28 +32,28 @@ suite("ds_rf26") {
|
||||
sql 'set enable_pipeline_engine=true'
|
||||
String stmt = '''
|
||||
explain physical plan
|
||||
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;
|
||||
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;
|
||||
|
||||
'''
|
||||
String plan = sql "${stmt}"
|
||||
println plan
|
||||
log.info(plan)
|
||||
def getRuntimeFilters = { plantree ->
|
||||
{
|
||||
def lst = []
|
||||
|
||||
@ -32,30 +32,30 @@ suite("ds_rf27") {
|
||||
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,
|
||||
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;
|
||||
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;
|
||||
|
||||
'''
|
||||
String plan = sql "${stmt}"
|
||||
println plan
|
||||
log.info(plan)
|
||||
def getRuntimeFilters = { plantree ->
|
||||
{
|
||||
def lst = []
|
||||
|
||||
@ -32,60 +32,60 @@ suite("ds_rf28") {
|
||||
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
|
||||
,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;
|
||||
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;
|
||||
|
||||
'''
|
||||
String plan = sql "${stmt}"
|
||||
println plan
|
||||
log.info(plan)
|
||||
def getRuntimeFilters = { plantree ->
|
||||
{
|
||||
def lst = []
|
||||
|
||||
@ -32,54 +32,54 @@ suite("ds_rf29") {
|
||||
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;
|
||||
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
|
||||
log.info(plan)
|
||||
def getRuntimeFilters = { plantree ->
|
||||
{
|
||||
def lst = []
|
||||
|
||||
@ -32,28 +32,28 @@ suite("ds_rf3") {
|
||||
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
|
||||
,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;
|
||||
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;
|
||||
|
||||
'''
|
||||
String plan = sql "${stmt}"
|
||||
println plan
|
||||
log.info(plan)
|
||||
def getRuntimeFilters = { plantree ->
|
||||
{
|
||||
def lst = []
|
||||
|
||||
@ -32,38 +32,38 @@ suite("ds_rf30") {
|
||||
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,
|
||||
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;
|
||||
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;
|
||||
|
||||
'''
|
||||
String plan = sql "${stmt}"
|
||||
println plan
|
||||
log.info(plan)
|
||||
def getRuntimeFilters = { plantree ->
|
||||
{
|
||||
def lst = []
|
||||
|
||||
@ -32,59 +32,59 @@ suite("ds_rf31") {
|
||||
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
|
||||
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;
|
||||
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;
|
||||
|
||||
'''
|
||||
String plan = sql "${stmt}"
|
||||
println plan
|
||||
log.info(plan)
|
||||
def getRuntimeFilters = { plantree ->
|
||||
{
|
||||
def lst = []
|
||||
|
||||
@ -32,35 +32,35 @@ suite("ds_rf32") {
|
||||
sql 'set enable_pipeline_engine=true'
|
||||
String stmt = '''
|
||||
explain physical plan
|
||||
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;
|
||||
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;
|
||||
|
||||
'''
|
||||
String plan = sql "${stmt}"
|
||||
println plan
|
||||
log.info(plan)
|
||||
def getRuntimeFilters = { plantree ->
|
||||
{
|
||||
def lst = []
|
||||
|
||||
@ -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_rf33") {
|
||||
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_rf33") {
|
||||
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
|
||||
i_manufact_id,sum(ss_ext_sales_price) total_sales
|
||||
@ -104,26 +104,26 @@ where i_category in ('Home'))
|
||||
group by i_manufact_id
|
||||
order by total_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.33"
|
||||
// File file = new File(outFile)
|
||||
// file.write(getRuntimeFilters(plan))
|
||||
|
||||
assertEquals("RF3[i_item_sk->[ss_item_sk],RF2[ca_address_sk->[ss_addr_sk],RF1[d_date_sk->[ss_sold_date_sk],RF0[i_manufact_id->[i_manufact_id],RF7[i_item_sk->[cs_item_sk],RF6[ca_address_sk->[cs_bill_addr_sk],RF5[d_date_sk->[cs_sold_date_sk],RF4[i_manufact_id->[i_manufact_id],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))
|
||||
}
|
||||
|
||||
'''
|
||||
String plan = sql "${stmt}"
|
||||
log.info(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.33"
|
||||
// File file = new File(outFile)
|
||||
// file.write(getRuntimeFilters(plan))
|
||||
|
||||
assertEquals("RF3[i_item_sk->[ss_item_sk],RF2[ca_address_sk->[ss_addr_sk],RF1[d_date_sk->[ss_sold_date_sk],RF0[i_manufact_id->[i_manufact_id],RF7[i_item_sk->[cs_item_sk],RF6[ca_address_sk->[cs_bill_addr_sk],RF5[d_date_sk->[cs_sold_date_sk],RF4[i_manufact_id->[i_manufact_id],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))
|
||||
}
|
||||
|
||||
@ -32,38 +32,38 @@ suite("ds_rf34") {
|
||||
sql 'set enable_pipeline_engine=true'
|
||||
String stmt = '''
|
||||
explain physical plan
|
||||
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;
|
||||
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;
|
||||
|
||||
'''
|
||||
String plan = sql "${stmt}"
|
||||
println plan
|
||||
log.info(plan)
|
||||
def getRuntimeFilters = { plantree ->
|
||||
{
|
||||
def lst = []
|
||||
|
||||
@ -32,65 +32,65 @@ suite("ds_rf35") {
|
||||
sql 'set enable_pipeline_engine=true'
|
||||
String stmt = '''
|
||||
explain physical plan
|
||||
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;
|
||||
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;
|
||||
|
||||
'''
|
||||
String plan = sql "${stmt}"
|
||||
println plan
|
||||
log.info(plan)
|
||||
def getRuntimeFilters = { plantree ->
|
||||
{
|
||||
def lst = []
|
||||
|
||||
@ -32,37 +32,37 @@ suite("ds_rf36") {
|
||||
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
|
||||
,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;
|
||||
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;
|
||||
|
||||
'''
|
||||
String plan = sql "${stmt}"
|
||||
println plan
|
||||
log.info(plan)
|
||||
def getRuntimeFilters = { plantree ->
|
||||
{
|
||||
def lst = []
|
||||
|
||||
@ -32,24 +32,24 @@ suite("ds_rf37") {
|
||||
sql 'set enable_pipeline_engine=true'
|
||||
String stmt = '''
|
||||
explain physical plan
|
||||
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;
|
||||
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;
|
||||
|
||||
'''
|
||||
String plan = sql "${stmt}"
|
||||
println plan
|
||||
log.info(plan)
|
||||
def getRuntimeFilters = { plantree ->
|
||||
{
|
||||
def lst = []
|
||||
|
||||
@ -32,30 +32,30 @@ suite("ds_rf38") {
|
||||
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
|
||||
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;
|
||||
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;
|
||||
|
||||
'''
|
||||
String plan = sql "${stmt}"
|
||||
println plan
|
||||
log.info(plan)
|
||||
def getRuntimeFilters = { plantree ->
|
||||
{
|
||||
def lst = []
|
||||
|
||||
@ -32,34 +32,34 @@ suite("ds_rf39") {
|
||||
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
|
||||
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
|
||||
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
|
||||
log.info(plan)
|
||||
def getRuntimeFilters = { plantree ->
|
||||
{
|
||||
def lst = []
|
||||
|
||||
@ -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_rf4") {
|
||||
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_rf4") {
|
||||
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
|
||||
@ -145,26 +145,26 @@ union all
|
||||
,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.4"
|
||||
// File file = new File(outFile)
|
||||
// file.write(getRuntimeFilters(plan))
|
||||
|
||||
assertEquals("RF1[d_date_sk->[ss_sold_date_sk],RF0[c_customer_sk->[ss_customer_sk],RF3[d_date_sk->[cs_sold_date_sk],RF2[c_customer_sk->[cs_bill_customer_sk],RF5[d_date_sk->[ws_sold_date_sk],RF4[c_customer_sk->[ws_bill_customer_sk]", getRuntimeFilters(plan))
|
||||
}
|
||||
|
||||
'''
|
||||
String plan = sql "${stmt}"
|
||||
log.info(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.4"
|
||||
// File file = new File(outFile)
|
||||
// file.write(getRuntimeFilters(plan))
|
||||
|
||||
assertEquals("RF1[d_date_sk->[ss_sold_date_sk],RF0[c_customer_sk->[ss_customer_sk],RF3[d_date_sk->[cs_sold_date_sk],RF2[c_customer_sk->[cs_bill_customer_sk],RF5[d_date_sk->[ws_sold_date_sk],RF4[c_customer_sk->[ws_bill_customer_sk]", getRuntimeFilters(plan))
|
||||
}
|
||||
|
||||
@ -32,35 +32,35 @@ suite("ds_rf40") {
|
||||
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;
|
||||
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
|
||||
log.info(plan)
|
||||
def getRuntimeFilters = { plantree ->
|
||||
{
|
||||
def lst = []
|
||||
|
||||
@ -32,59 +32,59 @@ suite("ds_rf41") {
|
||||
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
|
||||
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;
|
||||
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;
|
||||
|
||||
'''
|
||||
String plan = sql "${stmt}"
|
||||
println plan
|
||||
log.info(plan)
|
||||
def getRuntimeFilters = { plantree ->
|
||||
{
|
||||
def lst = []
|
||||
|
||||
@ -32,29 +32,29 @@ suite("ds_rf42") {
|
||||
sql 'set enable_pipeline_engine=true'
|
||||
String stmt = '''
|
||||
explain physical plan
|
||||
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 ;
|
||||
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 ;
|
||||
|
||||
'''
|
||||
String plan = sql "${stmt}"
|
||||
println plan
|
||||
log.info(plan)
|
||||
def getRuntimeFilters = { plantree ->
|
||||
{
|
||||
def lst = []
|
||||
|
||||
@ -32,26 +32,26 @@ suite("ds_rf43") {
|
||||
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,
|
||||
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;
|
||||
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;
|
||||
|
||||
'''
|
||||
String plan = sql "${stmt}"
|
||||
println plan
|
||||
log.info(plan)
|
||||
def getRuntimeFilters = { plantree ->
|
||||
{
|
||||
def lst = []
|
||||
|
||||
@ -32,42 +32,42 @@ suite("ds_rf44") {
|
||||
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
|
||||
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;
|
||||
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;
|
||||
|
||||
'''
|
||||
String plan = sql "${stmt}"
|
||||
println plan
|
||||
log.info(plan)
|
||||
def getRuntimeFilters = { plantree ->
|
||||
{
|
||||
def lst = []
|
||||
|
||||
@ -32,27 +32,27 @@ suite("ds_rf45") {
|
||||
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
|
||||
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;
|
||||
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;
|
||||
|
||||
'''
|
||||
String plan = sql "${stmt}"
|
||||
println plan
|
||||
log.info(plan)
|
||||
def getRuntimeFilters = { plantree ->
|
||||
{
|
||||
def lst = []
|
||||
|
||||
@ -32,42 +32,42 @@ suite("ds_rf46") {
|
||||
sql 'set enable_pipeline_engine=true'
|
||||
String stmt = '''
|
||||
explain physical plan
|
||||
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;
|
||||
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;
|
||||
|
||||
'''
|
||||
String plan = sql "${stmt}"
|
||||
println plan
|
||||
log.info(plan)
|
||||
def getRuntimeFilters = { plantree ->
|
||||
{
|
||||
def lst = []
|
||||
|
||||
@ -32,58 +32,58 @@ suite("ds_rf47") {
|
||||
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,
|
||||
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;
|
||||
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;
|
||||
|
||||
'''
|
||||
String plan = sql "${stmt}"
|
||||
println plan
|
||||
log.info(plan)
|
||||
def getRuntimeFilters = { plantree ->
|
||||
{
|
||||
def lst = []
|
||||
|
||||
@ -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}"
|
||||
log.info(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))
|
||||
}
|
||||
|
||||
@ -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_rf49") {
|
||||
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_rf49") {
|
||||
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, item, return_ratio, return_rank, currency_rank from
|
||||
(select
|
||||
'web' as channel
|
||||
@ -158,26 +158,26 @@ suite("ds_rf49") {
|
||||
)
|
||||
t order by 1,4,5,2
|
||||
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.49"
|
||||
// File file = new File(outFile)
|
||||
// file.write(getRuntimeFilters(plan))
|
||||
|
||||
assertEquals("RF1[ws_order_number->[wr_order_number],RF2[item->[wr_item_sk],RF0[d_date_sk->[ws_sold_date_sk],RF4[cs_order_number->[cr_order_number],RF5[item->[cr_item_sk],RF3[d_date_sk->[cs_sold_date_sk],RF7[ss_ticket_number->[sr_ticket_number],RF8[item->[sr_item_sk],RF6[d_date_sk->[ss_sold_date_sk]", getRuntimeFilters(plan))
|
||||
}
|
||||
|
||||
'''
|
||||
String plan = sql "${stmt}"
|
||||
log.info(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.49"
|
||||
// File file = new File(outFile)
|
||||
// file.write(getRuntimeFilters(plan))
|
||||
|
||||
assertEquals("RF1[ws_order_number->[wr_order_number],RF2[item->[wr_item_sk],RF0[d_date_sk->[ws_sold_date_sk],RF4[cs_order_number->[cr_order_number],RF5[item->[cr_item_sk],RF3[d_date_sk->[cs_sold_date_sk],RF7[ss_ticket_number->[sr_ticket_number],RF8[item->[sr_item_sk],RF6[d_date_sk->[ss_sold_date_sk]", getRuntimeFilters(plan))
|
||||
}
|
||||
|
||||
@ -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_rf5") {
|
||||
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_rf5") {
|
||||
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 ssr as
|
||||
(select s_store_id,
|
||||
sum(sales_price) as sales,
|
||||
@ -157,26 +157,26 @@ suite("ds_rf5") {
|
||||
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.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],RF4[d_date_sk->[cs_sold_date_sk],RF5[d_date_sk->[cr_returned_date_sk],RF10[web_site_sk->[ws_web_site_sk],RF11[web_site_sk->[ws_web_site_sk],RF8[d_date_sk->[ws_sold_date_sk],RF9[d_date_sk->[wr_returned_date_sk],RF6[wr_item_sk->[ws_item_sk],RF7[wr_order_number->[ws_order_number]", getRuntimeFilters(plan))
|
||||
}
|
||||
|
||||
'''
|
||||
String plan = sql "${stmt}"
|
||||
log.info(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.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],RF4[d_date_sk->[cs_sold_date_sk],RF5[d_date_sk->[cr_returned_date_sk],RF10[web_site_sk->[ws_web_site_sk],RF11[web_site_sk->[ws_web_site_sk],RF8[d_date_sk->[ws_sold_date_sk],RF9[d_date_sk->[wr_returned_date_sk],RF6[wr_item_sk->[ws_item_sk],RF7[wr_order_number->[ws_order_number]", getRuntimeFilters(plan))
|
||||
}
|
||||
|
||||
@ -32,66 +32,66 @@ suite("ds_rf50") {
|
||||
sql 'set enable_pipeline_engine=true'
|
||||
String stmt = '''
|
||||
explain physical plan
|
||||
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;
|
||||
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;
|
||||
|
||||
'''
|
||||
String plan = sql "${stmt}"
|
||||
println plan
|
||||
log.info(plan)
|
||||
def getRuntimeFilters = { plantree ->
|
||||
{
|
||||
def lst = []
|
||||
|
||||
@ -32,52 +32,52 @@ suite("ds_rf51") {
|
||||
sql 'set enable_pipeline_engine=true'
|
||||
String stmt = '''
|
||||
explain physical plan
|
||||
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;
|
||||
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;
|
||||
|
||||
'''
|
||||
String plan = sql "${stmt}"
|
||||
println plan
|
||||
log.info(plan)
|
||||
def getRuntimeFilters = { plantree ->
|
||||
{
|
||||
def lst = []
|
||||
|
||||
@ -32,29 +32,29 @@ suite("ds_rf52") {
|
||||
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
|
||||
,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 ;
|
||||
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 ;
|
||||
|
||||
'''
|
||||
String plan = sql "${stmt}"
|
||||
println plan
|
||||
log.info(plan)
|
||||
def getRuntimeFilters = { plantree ->
|
||||
{
|
||||
def lst = []
|
||||
|
||||
@ -32,35 +32,35 @@ suite("ds_rf53") {
|
||||
sql 'set enable_pipeline_engine=true'
|
||||
String stmt = '''
|
||||
explain physical plan
|
||||
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;
|
||||
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;
|
||||
|
||||
'''
|
||||
String plan = sql "${stmt}"
|
||||
println plan
|
||||
log.info(plan)
|
||||
def getRuntimeFilters = { plantree ->
|
||||
{
|
||||
def lst = []
|
||||
|
||||
@ -32,63 +32,63 @@ suite("ds_rf54") {
|
||||
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;
|
||||
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
|
||||
log.info(plan)
|
||||
def getRuntimeFilters = { plantree ->
|
||||
{
|
||||
def lst = []
|
||||
|
||||
@ -32,21 +32,21 @@ suite("ds_rf55") {
|
||||
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
|
||||
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 ;
|
||||
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 ;
|
||||
|
||||
'''
|
||||
String plan = sql "${stmt}"
|
||||
println plan
|
||||
log.info(plan)
|
||||
def getRuntimeFilters = { plantree ->
|
||||
{
|
||||
def lst = []
|
||||
|
||||
@ -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_rf56") {
|
||||
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_rf56") {
|
||||
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 i_item_id,sum(ss_ext_sales_price) total_sales
|
||||
from
|
||||
@ -98,26 +98,26 @@ where i_color in ('powder','green','cyan'))
|
||||
order by total_sales,
|
||||
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.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[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[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))
|
||||
}
|
||||
|
||||
'''
|
||||
String plan = sql "${stmt}"
|
||||
log.info(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.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[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[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))
|
||||
}
|
||||
|
||||
@ -32,55 +32,55 @@ suite("ds_rf57") {
|
||||
sql 'set enable_pipeline_engine=true'
|
||||
String stmt = '''
|
||||
explain physical plan
|
||||
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;
|
||||
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;
|
||||
|
||||
'''
|
||||
String plan = sql "${stmt}"
|
||||
println plan
|
||||
log.info(plan)
|
||||
def getRuntimeFilters = { plantree ->
|
||||
{
|
||||
def lst = []
|
||||
|
||||
@ -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_rf58") {
|
||||
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_rf58") {
|
||||
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_items as
|
||||
(select i_item_id item_id
|
||||
,sum(ss_ext_sales_price) ss_item_rev
|
||||
@ -94,26 +94,26 @@ suite("ds_rf58") {
|
||||
order by item_id
|
||||
,ss_item_rev
|
||||
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.58"
|
||||
// File file = new File(outFile)
|
||||
// file.write(getRuntimeFilters(plan))
|
||||
|
||||
assertEquals("RF13[item_id->[i_item_id],RF12[d_date->[d_date],RF11[d_date_sk->[cs_sold_date_sk],RF10[i_item_sk->[cs_item_sk],RF9[d_week_seq->[d_week_seq],RF8[item_id->[i_item_id],RF7[d_date->[d_date],RF6[d_date_sk->[ss_sold_date_sk],RF5[i_item_sk->[ss_item_sk],RF4[d_week_seq->[d_week_seq],RF3[d_date->[d_date],RF2[d_date_sk->[ws_sold_date_sk],RF1[i_item_sk->[ws_item_sk],RF0[d_week_seq->[d_week_seq]", getRuntimeFilters(plan))
|
||||
}
|
||||
|
||||
'''
|
||||
String plan = sql "${stmt}"
|
||||
log.info(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.58"
|
||||
// File file = new File(outFile)
|
||||
// file.write(getRuntimeFilters(plan))
|
||||
|
||||
assertEquals("RF13[item_id->[i_item_id],RF12[d_date->[d_date],RF11[d_date_sk->[cs_sold_date_sk],RF10[i_item_sk->[cs_item_sk],RF9[d_week_seq->[d_week_seq],RF8[item_id->[i_item_id],RF7[d_date->[d_date],RF6[d_date_sk->[ss_sold_date_sk],RF5[i_item_sk->[ss_item_sk],RF4[d_week_seq->[d_week_seq],RF3[d_date->[d_date],RF2[d_date_sk->[ws_sold_date_sk],RF1[i_item_sk->[ws_item_sk],RF0[d_week_seq->[d_week_seq]", getRuntimeFilters(plan))
|
||||
}
|
||||
|
||||
@ -32,51 +32,51 @@ suite("ds_rf59") {
|
||||
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;
|
||||
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
|
||||
log.info(plan)
|
||||
def getRuntimeFilters = { plantree ->
|
||||
{
|
||||
def lst = []
|
||||
|
||||
@ -32,33 +32,33 @@ suite("ds_rf6") {
|
||||
sql 'set enable_pipeline_engine=true'
|
||||
String stmt = '''
|
||||
explain physical plan
|
||||
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;
|
||||
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;
|
||||
|
||||
'''
|
||||
String plan = sql "${stmt}"
|
||||
println plan
|
||||
log.info(plan)
|
||||
def getRuntimeFilters = { plantree ->
|
||||
{
|
||||
def lst = []
|
||||
|
||||
@ -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_rf60") {
|
||||
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_rf60") {
|
||||
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
|
||||
i_item_id,sum(ss_ext_sales_price) total_sales
|
||||
@ -107,26 +107,26 @@ where i_category in ('Children'))
|
||||
order by i_item_id
|
||||
,total_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.60"
|
||||
// File file = new File(outFile)
|
||||
// file.write(getRuntimeFilters(plan))
|
||||
|
||||
assertEquals("RF3[i_item_sk->[ss_item_sk],RF2[ca_address_sk->[ss_addr_sk],RF1[d_date_sk->[ss_sold_date_sk],RF0[i_item_id->[i_item_id],RF7[i_item_sk->[cs_item_sk],RF6[ca_address_sk->[cs_bill_addr_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))
|
||||
}
|
||||
|
||||
'''
|
||||
String plan = sql "${stmt}"
|
||||
log.info(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.60"
|
||||
// File file = new File(outFile)
|
||||
// file.write(getRuntimeFilters(plan))
|
||||
|
||||
assertEquals("RF3[i_item_sk->[ss_item_sk],RF2[ca_address_sk->[ss_addr_sk],RF1[d_date_sk->[ss_sold_date_sk],RF0[i_item_id->[i_item_id],RF7[i_item_sk->[cs_item_sk],RF6[ca_address_sk->[cs_bill_addr_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))
|
||||
}
|
||||
|
||||
@ -32,51 +32,51 @@ suite("ds_rf61") {
|
||||
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;
|
||||
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
|
||||
log.info(plan)
|
||||
def getRuntimeFilters = { plantree ->
|
||||
{
|
||||
def lst = []
|
||||
|
||||
@ -32,42 +32,42 @@ suite("ds_rf62") {
|
||||
sql 'set enable_pipeline_engine=true'
|
||||
String stmt = '''
|
||||
explain physical plan
|
||||
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;
|
||||
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;
|
||||
|
||||
'''
|
||||
String plan = sql "${stmt}"
|
||||
println plan
|
||||
log.info(plan)
|
||||
def getRuntimeFilters = { plantree ->
|
||||
{
|
||||
def lst = []
|
||||
|
||||
@ -32,36 +32,36 @@ suite("ds_rf63") {
|
||||
sql 'set enable_pipeline_engine=true'
|
||||
String stmt = '''
|
||||
explain physical plan
|
||||
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;
|
||||
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;
|
||||
|
||||
'''
|
||||
String plan = sql "${stmt}"
|
||||
println plan
|
||||
log.info(plan)
|
||||
def getRuntimeFilters = { plantree ->
|
||||
{
|
||||
def lst = []
|
||||
|
||||
@ -153,7 +153,7 @@ order by cs1.product_name
|
||||
|
||||
'''
|
||||
String plan = sql "${stmt}"
|
||||
println plan
|
||||
log.info(plan)
|
||||
def getRuntimeFilters = { plantree ->
|
||||
{
|
||||
def lst = []
|
||||
|
||||
@ -32,36 +32,36 @@ suite("ds_rf65") {
|
||||
sql 'set enable_pipeline_engine=true'
|
||||
String stmt = '''
|
||||
explain physical plan
|
||||
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;
|
||||
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;
|
||||
|
||||
'''
|
||||
String plan = sql "${stmt}"
|
||||
println plan
|
||||
log.info(plan)
|
||||
def getRuntimeFilters = { plantree ->
|
||||
{
|
||||
def lst = []
|
||||
|
||||
@ -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}"
|
||||
log.info(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))
|
||||
}
|
||||
|
||||
@ -32,51 +32,51 @@ suite("ds_rf67") {
|
||||
sql 'set enable_pipeline_engine=true'
|
||||
String stmt = '''
|
||||
explain physical plan
|
||||
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;
|
||||
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;
|
||||
|
||||
'''
|
||||
String plan = sql "${stmt}"
|
||||
println plan
|
||||
log.info(plan)
|
||||
def getRuntimeFilters = { plantree ->
|
||||
{
|
||||
def lst = []
|
||||
|
||||
@ -32,49 +32,49 @@ suite("ds_rf68") {
|
||||
sql 'set enable_pipeline_engine=true'
|
||||
String stmt = '''
|
||||
explain physical plan
|
||||
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;
|
||||
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;
|
||||
|
||||
'''
|
||||
String plan = sql "${stmt}"
|
||||
println plan
|
||||
log.info(plan)
|
||||
def getRuntimeFilters = { plantree ->
|
||||
{
|
||||
def lst = []
|
||||
|
||||
@ -32,54 +32,54 @@ suite("ds_rf69") {
|
||||
sql 'set enable_pipeline_engine=true'
|
||||
String stmt = '''
|
||||
explain physical plan
|
||||
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;
|
||||
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;
|
||||
|
||||
'''
|
||||
String plan = sql "${stmt}"
|
||||
println plan
|
||||
log.info(plan)
|
||||
def getRuntimeFilters = { plantree ->
|
||||
{
|
||||
def lst = []
|
||||
|
||||
@ -32,28 +32,28 @@ suite("ds_rf7") {
|
||||
sql 'set enable_pipeline_engine=true'
|
||||
String stmt = '''
|
||||
explain physical plan
|
||||
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;
|
||||
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;
|
||||
|
||||
'''
|
||||
String plan = sql "${stmt}"
|
||||
println plan
|
||||
log.info(plan)
|
||||
def getRuntimeFilters = { plantree ->
|
||||
{
|
||||
def lst = []
|
||||
|
||||
@ -32,45 +32,45 @@ suite("ds_rf70") {
|
||||
sql 'set enable_pipeline_engine=true'
|
||||
String stmt = '''
|
||||
explain physical plan
|
||||
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;
|
||||
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;
|
||||
|
||||
'''
|
||||
String plan = sql "${stmt}"
|
||||
println plan
|
||||
log.info(plan)
|
||||
def getRuntimeFilters = { plantree ->
|
||||
{
|
||||
def lst = []
|
||||
|
||||
@ -32,47 +32,47 @@ suite("ds_rf71") {
|
||||
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,
|
||||
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
|
||||
;
|
||||
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
|
||||
;
|
||||
|
||||
'''
|
||||
String plan = sql "${stmt}"
|
||||
println plan
|
||||
log.info(plan)
|
||||
def getRuntimeFilters = { plantree ->
|
||||
{
|
||||
def lst = []
|
||||
|
||||
@ -32,36 +32,36 @@ suite("ds_rf72") {
|
||||
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;
|
||||
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
|
||||
log.info(plan)
|
||||
def getRuntimeFilters = { plantree ->
|
||||
{
|
||||
def lst = []
|
||||
|
||||
@ -32,35 +32,35 @@ suite("ds_rf73") {
|
||||
sql 'set enable_pipeline_engine=true'
|
||||
String stmt = '''
|
||||
explain physical plan
|
||||
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;
|
||||
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;
|
||||
|
||||
'''
|
||||
String plan = sql "${stmt}"
|
||||
println plan
|
||||
log.info(plan)
|
||||
def getRuntimeFilters = { plantree ->
|
||||
{
|
||||
def lst = []
|
||||
|
||||
@ -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}"
|
||||
log.info(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))
|
||||
}
|
||||
|
||||
@ -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}"
|
||||
log.info(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))
|
||||
}
|
||||
|
||||
@ -32,31 +32,31 @@ suite("ds_rf76") {
|
||||
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
|
||||
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;
|
||||
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;
|
||||
|
||||
'''
|
||||
String plan = sql "${stmt}"
|
||||
println plan
|
||||
log.info(plan)
|
||||
def getRuntimeFilters = { plantree ->
|
||||
{
|
||||
def lst = []
|
||||
|
||||
@ -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}"
|
||||
log.info(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))
|
||||
}
|
||||
|
||||
@ -32,65 +32,65 @@ suite("ds_rf78") {
|
||||
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,
|
||||
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;
|
||||
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;
|
||||
|
||||
'''
|
||||
String plan = sql "${stmt}"
|
||||
println plan
|
||||
log.info(plan)
|
||||
def getRuntimeFilters = { plantree ->
|
||||
{
|
||||
def lst = []
|
||||
|
||||
@ -32,30 +32,30 @@ suite("ds_rf79") {
|
||||
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
|
||||
(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;
|
||||
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;
|
||||
|
||||
'''
|
||||
String plan = sql "${stmt}"
|
||||
println plan
|
||||
log.info(plan)
|
||||
def getRuntimeFilters = { plantree ->
|
||||
{
|
||||
def lst = []
|
||||
|
||||
@ -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}"
|
||||
log.info(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))
|
||||
}
|
||||
|
||||
@ -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_rf80") {
|
||||
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_rf80") {
|
||||
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 ssr as
|
||||
(select s_store_id as store_id,
|
||||
sum(ss_ext_sales_price) as sales,
|
||||
@ -125,26 +125,26 @@ group by web_site_id)
|
||||
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.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[p_promo_sk->[ws_promo_sk],RF13[i_item_sk->[ws_item_sk],RF12[d_date_sk->[ws_sold_date_sk]", getRuntimeFilters(plan))
|
||||
}
|
||||
|
||||
'''
|
||||
String plan = sql "${stmt}"
|
||||
log.info(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.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[p_promo_sk->[ws_promo_sk],RF13[i_item_sk->[ws_item_sk],RF12[d_date_sk->[ws_sold_date_sk]", getRuntimeFilters(plan))
|
||||
}
|
||||
|
||||
@ -32,38 +32,38 @@ suite("ds_rf81") {
|
||||
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,
|
||||
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;
|
||||
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;
|
||||
|
||||
'''
|
||||
String plan = sql "${stmt}"
|
||||
println plan
|
||||
log.info(plan)
|
||||
def getRuntimeFilters = { plantree ->
|
||||
{
|
||||
def lst = []
|
||||
|
||||
@ -32,24 +32,24 @@ suite("ds_rf82") {
|
||||
sql 'set enable_pipeline_engine=true'
|
||||
String stmt = '''
|
||||
explain physical plan
|
||||
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;
|
||||
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;
|
||||
|
||||
'''
|
||||
String plan = sql "${stmt}"
|
||||
println plan
|
||||
log.info(plan)
|
||||
def getRuntimeFilters = { plantree ->
|
||||
{
|
||||
def lst = []
|
||||
|
||||
@ -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_rf83") {
|
||||
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_rf83") {
|
||||
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 sr_items as
|
||||
(select i_item_id item_id,
|
||||
sum(sr_return_quantity) sr_item_qty
|
||||
@ -96,26 +96,26 @@ suite("ds_rf83") {
|
||||
order by sr_items.item_id
|
||||
,sr_item_qty
|
||||
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.83"
|
||||
// File file = new File(outFile)
|
||||
// file.write(getRuntimeFilters(plan))
|
||||
|
||||
assertEquals("RF13[item_id->[i_item_id],RF12[d_date->[d_date],RF11[d_date_sk->[cr_returned_date_sk],RF10[i_item_sk->[cr_item_sk],RF9[d_week_seq->[d_week_seq],RF8[item_id->[i_item_id],RF7[d_date->[d_date],RF6[d_date_sk->[sr_returned_date_sk],RF5[i_item_sk->[sr_item_sk],RF4[d_week_seq->[d_week_seq],RF3[d_date->[d_date],RF2[d_date_sk->[wr_returned_date_sk],RF1[i_item_sk->[wr_item_sk],RF0[d_week_seq->[d_week_seq]", getRuntimeFilters(plan))
|
||||
}
|
||||
|
||||
'''
|
||||
String plan = sql "${stmt}"
|
||||
log.info(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.83"
|
||||
// File file = new File(outFile)
|
||||
// file.write(getRuntimeFilters(plan))
|
||||
|
||||
assertEquals("RF13[item_id->[i_item_id],RF12[d_date->[d_date],RF11[d_date_sk->[cr_returned_date_sk],RF10[i_item_sk->[cr_item_sk],RF9[d_week_seq->[d_week_seq],RF8[item_id->[i_item_id],RF7[d_date->[d_date],RF6[d_date_sk->[sr_returned_date_sk],RF5[i_item_sk->[sr_item_sk],RF4[d_week_seq->[d_week_seq],RF3[d_date->[d_date],RF2[d_date_sk->[wr_returned_date_sk],RF1[i_item_sk->[wr_item_sk],RF0[d_week_seq->[d_week_seq]", getRuntimeFilters(plan))
|
||||
}
|
||||
|
||||
@ -32,28 +32,28 @@ suite("ds_rf84") {
|
||||
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
|
||||
,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;
|
||||
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;
|
||||
|
||||
'''
|
||||
String plan = sql "${stmt}"
|
||||
println plan
|
||||
log.info(plan)
|
||||
def getRuntimeFilters = { plantree ->
|
||||
{
|
||||
def lst = []
|
||||
|
||||
@ -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}"
|
||||
log.info(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))
|
||||
}
|
||||
|
||||
@ -32,33 +32,33 @@ suite("ds_rf86") {
|
||||
sql 'set enable_pipeline_engine=true'
|
||||
String stmt = '''
|
||||
explain physical plan
|
||||
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;
|
||||
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;
|
||||
|
||||
'''
|
||||
String plan = sql "${stmt}"
|
||||
println plan
|
||||
log.info(plan)
|
||||
def getRuntimeFilters = { plantree ->
|
||||
{
|
||||
def lst = []
|
||||
|
||||
@ -32,30 +32,30 @@ suite("ds_rf87") {
|
||||
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
|
||||
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
|
||||
;
|
||||
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
|
||||
;
|
||||
|
||||
'''
|
||||
String plan = sql "${stmt}"
|
||||
println plan
|
||||
log.info(plan)
|
||||
def getRuntimeFilters = { plantree ->
|
||||
{
|
||||
def lst = []
|
||||
|
||||
@ -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}"
|
||||
log.info(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))
|
||||
}
|
||||
|
||||
@ -32,35 +32,35 @@ suite("ds_rf89") {
|
||||
sql 'set enable_pipeline_engine=true'
|
||||
String stmt = '''
|
||||
explain physical plan
|
||||
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;
|
||||
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;
|
||||
|
||||
'''
|
||||
String plan = sql "${stmt}"
|
||||
println plan
|
||||
log.info(plan)
|
||||
def getRuntimeFilters = { plantree ->
|
||||
{
|
||||
def lst = []
|
||||
|
||||
@ -32,58 +32,58 @@ suite("ds_rf9") {
|
||||
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
|
||||
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
|
||||
;
|
||||
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
|
||||
;
|
||||
|
||||
'''
|
||||
String plan = sql "${stmt}"
|
||||
println plan
|
||||
log.info(plan)
|
||||
def getRuntimeFilters = { plantree ->
|
||||
{
|
||||
def lst = []
|
||||
|
||||
@ -32,29 +32,29 @@ suite("ds_rf90") {
|
||||
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
|
||||
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;
|
||||
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;
|
||||
|
||||
'''
|
||||
String plan = sql "${stmt}"
|
||||
println plan
|
||||
log.info(plan)
|
||||
def getRuntimeFilters = { plantree ->
|
||||
{
|
||||
def lst = []
|
||||
|
||||
@ -32,38 +32,38 @@ suite("ds_rf91") {
|
||||
sql 'set enable_pipeline_engine=true'
|
||||
String stmt = '''
|
||||
explain physical plan
|
||||
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;
|
||||
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;
|
||||
|
||||
'''
|
||||
String plan = sql "${stmt}"
|
||||
println plan
|
||||
log.info(plan)
|
||||
def getRuntimeFilters = { plantree ->
|
||||
{
|
||||
def lst = []
|
||||
|
||||
@ -32,37 +32,37 @@ suite("ds_rf92") {
|
||||
sql 'set enable_pipeline_engine=true'
|
||||
String stmt = '''
|
||||
explain physical plan
|
||||
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;
|
||||
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;
|
||||
|
||||
'''
|
||||
String plan = sql "${stmt}"
|
||||
println plan
|
||||
log.info(plan)
|
||||
def getRuntimeFilters = { plantree ->
|
||||
{
|
||||
def lst = []
|
||||
|
||||
@ -32,25 +32,25 @@ suite("ds_rf93") {
|
||||
sql 'set enable_pipeline_engine=true'
|
||||
String stmt = '''
|
||||
explain physical plan
|
||||
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;
|
||||
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;
|
||||
|
||||
'''
|
||||
String plan = sql "${stmt}"
|
||||
println plan
|
||||
log.info(plan)
|
||||
def getRuntimeFilters = { plantree ->
|
||||
{
|
||||
def lst = []
|
||||
|
||||
@ -32,36 +32,36 @@ suite("ds_rf94") {
|
||||
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"
|
||||
,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;
|
||||
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;
|
||||
|
||||
'''
|
||||
String plan = sql "${stmt}"
|
||||
println plan
|
||||
log.info(plan)
|
||||
def getRuntimeFilters = { plantree ->
|
||||
{
|
||||
def lst = []
|
||||
|
||||
@ -32,39 +32,39 @@ suite("ds_rf95") {
|
||||
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
|
||||
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;
|
||||
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;
|
||||
|
||||
'''
|
||||
String plan = sql "${stmt}"
|
||||
println plan
|
||||
log.info(plan)
|
||||
def getRuntimeFilters = { plantree ->
|
||||
{
|
||||
def lst = []
|
||||
|
||||
@ -32,23 +32,23 @@ suite("ds_rf96") {
|
||||
sql 'set enable_pipeline_engine=true'
|
||||
String stmt = '''
|
||||
explain physical plan
|
||||
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;
|
||||
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;
|
||||
|
||||
'''
|
||||
String plan = sql "${stmt}"
|
||||
println plan
|
||||
log.info(plan)
|
||||
def getRuntimeFilters = { plantree ->
|
||||
{
|
||||
def lst = []
|
||||
|
||||
@ -32,32 +32,32 @@ suite("ds_rf97") {
|
||||
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
|
||||
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;
|
||||
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;
|
||||
|
||||
'''
|
||||
String plan = sql "${stmt}"
|
||||
println plan
|
||||
log.info(plan)
|
||||
def getRuntimeFilters = { plantree ->
|
||||
{
|
||||
def lst = []
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user