diff options
author | Alexander Smirnov <alex@ydb.tech> | 2024-11-20 11:14:58 +0000 |
---|---|---|
committer | Alexander Smirnov <alex@ydb.tech> | 2024-11-20 11:14:58 +0000 |
commit | 31773f157bf8164364649b5f470f52dece0a4317 (patch) | |
tree | 33d0f7eef45303ab68cf08ab381ce5e5e36c5240 /yql/essentials/tests/sql/suites/pg-tpcds | |
parent | 2c7938962d8689e175574fc1e817c05049f27905 (diff) | |
parent | eff600952d5dfe17942f38f510a8ac2b203bb3a5 (diff) | |
download | ydb-31773f157bf8164364649b5f470f52dece0a4317.tar.gz |
Merge branch 'rightlib' into mergelibs-241120-1113
Diffstat (limited to 'yql/essentials/tests/sql/suites/pg-tpcds')
148 files changed, 5756 insertions, 0 deletions
diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/call_center.txt b/yql/essentials/tests/sql/suites/pg-tpcds/call_center.txt new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/call_center.txt diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/call_center.txt.attr b/yql/essentials/tests/sql/suites/pg-tpcds/call_center.txt.attr new file mode 100644 index 0000000000..397a5b6105 --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/call_center.txt.attr @@ -0,0 +1,37 @@ +{ + "_yql_row_spec"={ + "Type"=["StructType";[ + ["cc_call_center_sk";["PgType";"int4";];]; + ["cc_call_center_id";["PgType";"text";];]; + ["cc_rec_start_date";["PgType";"date";];]; + ["cc_rec_end_date";["PgType";"date";];]; + ["cc_closed_date_sk";["PgType";"int4";];]; + ["cc_open_date_sk";["PgType";"int4";];]; + ["cc_name";["PgType";"text";];]; + ["cc_class";["PgType";"text";];]; + ["cc_employees";["PgType";"int4";];]; + ["cc_sq_ft";["PgType";"int4";];]; + ["cc_hours";["PgType";"text";];]; + ["cc_manager";["PgType";"text";];]; + ["cc_mkt_id";["PgType";"int4";];]; + ["cc_mkt_class";["PgType";"text";];]; + ["cc_mkt_desc";["PgType";"text";];]; + ["cc_market_manager";["PgType";"text";];]; + ["cc_division";["PgType";"int4";];]; + ["cc_division_name";["PgType";"text";];]; + ["cc_company";["PgType";"int4";];]; + ["cc_company_name";["PgType";"text";];]; + ["cc_street_number";["PgType";"text";];]; + ["cc_street_name";["PgType";"text";];]; + ["cc_street_type";["PgType";"text";];]; + ["cc_suite_number";["PgType";"text";];]; + ["cc_city";["PgType";"text";];]; + ["cc_county";["PgType";"text";];]; + ["cc_state";["PgType";"text";];]; + ["cc_zip";["PgType";"text";];]; + ["cc_country";["PgType";"text";];]; + ["cc_gmt_offset";["PgType";"numeric";];]; + ["cc_tax_percentage";["PgType";"numeric";];]; + ];]; + } +} diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/catalog_page.txt b/yql/essentials/tests/sql/suites/pg-tpcds/catalog_page.txt new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/catalog_page.txt diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/catalog_page.txt.attr b/yql/essentials/tests/sql/suites/pg-tpcds/catalog_page.txt.attr new file mode 100644 index 0000000000..1de2694081 --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/catalog_page.txt.attr @@ -0,0 +1,15 @@ +{ + "_yql_row_spec"={ + "Type"=["StructType";[ + ["cp_catalog_page_sk";["PgType";"int4";];]; + ["cp_catalog_page_id";["PgType";"text";];]; + ["cp_start_date_sk";["PgType";"int4";];]; + ["cp_end_date_sk";["PgType";"int4";];]; + ["cp_department";["PgType";"text";];]; + ["cp_catalog_number";["PgType";"int4";];]; + ["cp_catalog_page_number";["PgType";"int4";];]; + ["cp_description";["PgType";"text";];]; + ["cp_type";["PgType";"text";];]; + ];]; + } +} diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/catalog_returns.txt b/yql/essentials/tests/sql/suites/pg-tpcds/catalog_returns.txt new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/catalog_returns.txt diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/catalog_returns.txt.attr b/yql/essentials/tests/sql/suites/pg-tpcds/catalog_returns.txt.attr new file mode 100644 index 0000000000..209677594f --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/catalog_returns.txt.attr @@ -0,0 +1,33 @@ +{ + "_yql_row_spec"={ + "Type"=["StructType";[ + ["cr_returned_date_sk";["PgType";"int4";];]; + ["cr_returned_time_sk";["PgType";"int4";];]; + ["cr_item_sk";["PgType";"int4";];]; + ["cr_refunded_customer_sk";["PgType";"int4";];]; + ["cr_refunded_cdemo_sk";["PgType";"int4";];]; + ["cr_refunded_hdemo_sk";["PgType";"int4";];]; + ["cr_refunded_addr_sk";["PgType";"int4";];]; + ["cr_returning_customer_sk";["PgType";"int4";];]; + ["cr_returning_cdemo_sk";["PgType";"int4";];]; + ["cr_returning_hdemo_sk";["PgType";"int4";];]; + ["cr_returning_addr_sk";["PgType";"int4";];]; + ["cr_call_center_sk";["PgType";"int4";];]; + ["cr_catalog_page_sk";["PgType";"int4";];]; + ["cr_ship_mode_sk";["PgType";"int4";];]; + ["cr_warehouse_sk";["PgType";"int4";];]; + ["cr_reason_sk";["PgType";"int4";];]; + ["cr_order_number";["PgType";"int4";];]; + ["cr_return_quantity";["PgType";"int4";];]; + ["cr_return_amount";["PgType";"numeric";];]; + ["cr_return_tax";["PgType";"numeric";];]; + ["cr_return_amt_inc_tax";["PgType";"numeric";];]; + ["cr_fee";["PgType";"numeric";];]; + ["cr_return_ship_cost";["PgType";"numeric";];]; + ["cr_refunded_cash";["PgType";"numeric";];]; + ["cr_reversed_charge";["PgType";"numeric";];]; + ["cr_store_credit";["PgType";"numeric";];]; + ["cr_net_loss";["PgType";"numeric";];]; + ];]; + } +} diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/catalog_sales.txt b/yql/essentials/tests/sql/suites/pg-tpcds/catalog_sales.txt new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/catalog_sales.txt diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/catalog_sales.txt.attr b/yql/essentials/tests/sql/suites/pg-tpcds/catalog_sales.txt.attr new file mode 100644 index 0000000000..3765f24437 --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/catalog_sales.txt.attr @@ -0,0 +1,40 @@ +{ + "_yql_row_spec"={ + "Type"=["StructType";[ + ["cs_sold_date_sk";["PgType";"int4";];]; + ["cs_sold_time_sk";["PgType";"int4";];]; + ["cs_ship_date_sk";["PgType";"int4";];]; + ["cs_bill_customer_sk";["PgType";"int4";];]; + ["cs_bill_cdemo_sk";["PgType";"int4";];]; + ["cs_bill_hdemo_sk";["PgType";"int4";];]; + ["cs_bill_addr_sk";["PgType";"int4";];]; + ["cs_ship_customer_sk";["PgType";"int4";];]; + ["cs_ship_cdemo_sk";["PgType";"int4";];]; + ["cs_ship_hdemo_sk";["PgType";"int4";];]; + ["cs_ship_addr_sk";["PgType";"int4";];]; + ["cs_call_center_sk";["PgType";"int4";];]; + ["cs_catalog_page_sk";["PgType";"int4";];]; + ["cs_ship_mode_sk";["PgType";"int4";];]; + ["cs_warehouse_sk";["PgType";"int4";];]; + ["cs_item_sk";["PgType";"int4";];]; + ["cs_promo_sk";["PgType";"int4";];]; + ["cs_order_number";["PgType";"int4";];]; + ["cs_quantity";["PgType";"int4";];]; + ["cs_wholesale_cost";["PgType";"numeric";];]; + ["cs_list_price";["PgType";"numeric";];]; + ["cs_sales_price";["PgType";"numeric";];]; + ["cs_ext_discount_amt";["PgType";"numeric";];]; + ["cs_ext_sales_price";["PgType";"numeric";];]; + ["cs_ext_wholesale_cost";["PgType";"numeric";];]; + ["cs_ext_list_price";["PgType";"numeric";];]; + ["cs_ext_tax";["PgType";"numeric";];]; + ["cs_coupon_amt";["PgType";"numeric";];]; + ["cs_ext_ship_cost";["PgType";"numeric";];]; + ["cs_net_paid";["PgType";"numeric";];]; + ["cs_net_paid_inc_tax";["PgType";"numeric";];]; + ["cs_net_paid_inc_ship";["PgType";"numeric";];]; + ["cs_net_paid_inc_ship_tax";["PgType";"numeric";];]; + ["cs_net_profit";["PgType";"numeric";];]; + ];]; + } +} diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/customer.txt b/yql/essentials/tests/sql/suites/pg-tpcds/customer.txt new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/customer.txt diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/customer.txt.attr b/yql/essentials/tests/sql/suites/pg-tpcds/customer.txt.attr new file mode 100644 index 0000000000..0994cf7951 --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/customer.txt.attr @@ -0,0 +1,24 @@ +{ + "_yql_row_spec"={ + "Type"=["StructType";[ + ["c_customer_sk";["PgType";"int4";];]; + ["c_customer_id";["PgType";"text";];]; + ["c_current_cdemo_sk";["PgType";"int4";];]; + ["c_current_hdemo_sk";["PgType";"int4";];]; + ["c_current_addr_sk";["PgType";"int4";];]; + ["c_first_shipto_date_sk";["PgType";"int4";];]; + ["c_first_sales_date_sk";["PgType";"int4";];]; + ["c_salutation";["PgType";"text";];]; + ["c_first_name";["PgType";"text";];]; + ["c_last_name";["PgType";"text";];]; + ["c_preferred_cust_flag";["PgType";"text";];]; + ["c_birth_day";["PgType";"int4";];]; + ["c_birth_month";["PgType";"int4";];]; + ["c_birth_year";["PgType";"int4";];]; + ["c_birth_country";["PgType";"text";];]; + ["c_login";["PgType";"text";];]; + ["c_email_address";["PgType";"text";];]; + ["c_last_review_date";["PgType";"text";];]; + ];]; + } +} diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/customer_address.txt b/yql/essentials/tests/sql/suites/pg-tpcds/customer_address.txt new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/customer_address.txt diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/customer_address.txt.attr b/yql/essentials/tests/sql/suites/pg-tpcds/customer_address.txt.attr new file mode 100644 index 0000000000..6bd1ce06c7 --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/customer_address.txt.attr @@ -0,0 +1,19 @@ +{ + "_yql_row_spec"={ + "Type"=["StructType";[ + ["ca_address_sk";["PgType";"int4";];]; + ["ca_address_id";["PgType";"text";];]; + ["ca_street_number";["PgType";"text";];]; + ["ca_street_name";["PgType";"text";];]; + ["ca_street_type";["PgType";"text";];]; + ["ca_suite_number";["PgType";"text";];]; + ["ca_city";["PgType";"text";];]; + ["ca_county";["PgType";"text";];]; + ["ca_state";["PgType";"text";];]; + ["ca_zip";["PgType";"text";];]; + ["ca_country";["PgType";"text";];]; + ["ca_gmt_offset";["PgType";"numeric";];]; + ["ca_location_type";["PgType";"text";];]; + ];]; + } +} diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/customer_demographics.txt b/yql/essentials/tests/sql/suites/pg-tpcds/customer_demographics.txt new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/customer_demographics.txt diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/customer_demographics.txt.attr b/yql/essentials/tests/sql/suites/pg-tpcds/customer_demographics.txt.attr new file mode 100644 index 0000000000..6f106de2a7 --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/customer_demographics.txt.attr @@ -0,0 +1,15 @@ +{ + "_yql_row_spec"={ + "Type"=["StructType";[ + ["cd_demo_sk";["PgType";"int4";];]; + ["cd_gender";["PgType";"text";];]; + ["cd_marital_status";["PgType";"text";];]; + ["cd_education_status";["PgType";"text";];]; + ["cd_purchase_estimate";["PgType";"int4";];]; + ["cd_credit_rating";["PgType";"text";];]; + ["cd_dep_count";["PgType";"int4";];]; + ["cd_dep_employed_count";["PgType";"int4";];]; + ["cd_dep_college_count";["PgType";"int4";];]; + ];]; + } +} diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/date_dim.txt b/yql/essentials/tests/sql/suites/pg-tpcds/date_dim.txt new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/date_dim.txt diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/date_dim.txt.attr b/yql/essentials/tests/sql/suites/pg-tpcds/date_dim.txt.attr new file mode 100644 index 0000000000..fcead9adcc --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/date_dim.txt.attr @@ -0,0 +1,34 @@ +{ + "_yql_row_spec"={ + "Type"=["StructType";[ + ["d_date_sk";["PgType";"int4";];]; + ["d_date_id";["PgType";"text";];]; + ["d_date";["PgType";"date";];]; + ["d_month_seq";["PgType";"int4";];]; + ["d_week_seq";["PgType";"int4";];]; + ["d_quarter_seq";["PgType";"int4";];]; + ["d_year";["PgType";"int4";];]; + ["d_dow";["PgType";"int4";];]; + ["d_moy";["PgType";"int4";];]; + ["d_dom";["PgType";"int4";];]; + ["d_qoy";["PgType";"int4";];]; + ["d_fy_year";["PgType";"int4";];]; + ["d_fy_quarter_seq";["PgType";"int4";];]; + ["d_fy_week_seq";["PgType";"int4";];]; + ["d_day_name";["PgType";"text";];]; + ["d_quarter_name";["PgType";"text";];]; + ["d_holiday";["PgType";"text";];]; + ["d_weekend";["PgType";"text";];]; + ["d_following_holiday";["PgType";"text";];]; + ["d_first_dom";["PgType";"int4";];]; + ["d_last_dom";["PgType";"int4";];]; + ["d_same_day_ly";["PgType";"int4";];]; + ["d_same_day_lq";["PgType";"int4";];]; + ["d_current_day";["PgType";"text";];]; + ["d_current_week";["PgType";"text";];]; + ["d_current_month";["PgType";"text";];]; + ["d_current_quarter";["PgType";"text";];]; + ["d_current_year";["PgType";"text";];]; + ];]; + } +} diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/default.cfg b/yql/essentials/tests/sql/suites/pg-tpcds/default.cfg new file mode 100644 index 0000000000..67c1396cb1 --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/default.cfg @@ -0,0 +1,24 @@ +in call_center call_center.txt +in catalog_page catalog_page.txt +in catalog_returns catalog_returns.txt +in catalog_sales catalog_sales.txt +in customer customer.txt +in customer_address customer_address.txt +in customer_demographics customer_demographics.txt +in date_dim date_dim.txt +in household_demographics household_demographics.txt +in income_band income_band.txt +in inventory inventory.txt +in item item.txt +in promotion promotion.txt +in reason reason.txt +in ship_mode ship_mode.txt +in store store.txt +in store_returns store_returns.txt +in store_sales store_sales.txt +in time_dim time_dim.txt +in warehouse warehouse.txt +in web_page web_page.txt +in web_returns web_returns.txt +in web_sales web_sales.txt +in web_site web_site.txt
\ No newline at end of file diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/household_demographics.txt b/yql/essentials/tests/sql/suites/pg-tpcds/household_demographics.txt new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/household_demographics.txt diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/household_demographics.txt.attr b/yql/essentials/tests/sql/suites/pg-tpcds/household_demographics.txt.attr new file mode 100644 index 0000000000..c8ab25eb6d --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/household_demographics.txt.attr @@ -0,0 +1,11 @@ +{ + "_yql_row_spec"={ + "Type"=["StructType";[ + ["hd_demo_sk";["PgType";"int4";];]; + ["hd_income_band_sk";["PgType";"int4";];]; + ["hd_buy_potential";["PgType";"text";];]; + ["hd_dep_count";["PgType";"int4";];]; + ["hd_vehicle_count";["PgType";"int4";];]; + ];]; + } +} diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/income_band.txt b/yql/essentials/tests/sql/suites/pg-tpcds/income_band.txt new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/income_band.txt diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/income_band.txt.attr b/yql/essentials/tests/sql/suites/pg-tpcds/income_band.txt.attr new file mode 100644 index 0000000000..63310508f7 --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/income_band.txt.attr @@ -0,0 +1,9 @@ +{ + "_yql_row_spec"={ + "Type"=["StructType";[ + ["ib_income_band_sk";["PgType";"int4";];]; + ["ib_lower_bound";["PgType";"int4";];]; + ["ib_upper_bound";["PgType";"int4";];]; + ];]; + } +} diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/inventory.txt b/yql/essentials/tests/sql/suites/pg-tpcds/inventory.txt new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/inventory.txt diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/inventory.txt.attr b/yql/essentials/tests/sql/suites/pg-tpcds/inventory.txt.attr new file mode 100644 index 0000000000..95f22bfd71 --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/inventory.txt.attr @@ -0,0 +1,10 @@ +{ + "_yql_row_spec"={ + "Type"=["StructType";[ + ["inv_date_sk";["PgType";"int4";];]; + ["inv_item_sk";["PgType";"int4";];]; + ["inv_warehouse_sk";["PgType";"int4";];]; + ["inv_quantity_on_hand";["PgType";"int4";];]; + ];]; + } +} diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/item.txt b/yql/essentials/tests/sql/suites/pg-tpcds/item.txt new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/item.txt diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/item.txt.attr b/yql/essentials/tests/sql/suites/pg-tpcds/item.txt.attr new file mode 100644 index 0000000000..9d103928f0 --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/item.txt.attr @@ -0,0 +1,28 @@ +{ + "_yql_row_spec"={ + "Type"=["StructType";[ + ["i_item_sk";["PgType";"int4";];]; + ["i_item_id";["PgType";"text";];]; + ["i_rec_start_date";["PgType";"date";];]; + ["i_rec_end_date";["PgType";"date";];]; + ["i_item_desc";["PgType";"text";];]; + ["i_current_price";["PgType";"numeric";];]; + ["i_wholesale_cost";["PgType";"numeric";];]; + ["i_brand_id";["PgType";"int4";];]; + ["i_brand";["PgType";"text";];]; + ["i_class_id";["PgType";"int4";];]; + ["i_class";["PgType";"text";];]; + ["i_category_id";["PgType";"int4";];]; + ["i_category";["PgType";"text";];]; + ["i_manufact_id";["PgType";"int4";];]; + ["i_manufact";["PgType";"text";];]; + ["i_size";["PgType";"text";];]; + ["i_formulation";["PgType";"text";];]; + ["i_color";["PgType";"text";];]; + ["i_units";["PgType";"text";];]; + ["i_container";["PgType";"text";];]; + ["i_manager_id";["PgType";"int4";];]; + ["i_product_name";["PgType";"text";];]; + ];]; + } +} diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/promotion.txt b/yql/essentials/tests/sql/suites/pg-tpcds/promotion.txt new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/promotion.txt diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/promotion.txt.attr b/yql/essentials/tests/sql/suites/pg-tpcds/promotion.txt.attr new file mode 100644 index 0000000000..7db23f7b1b --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/promotion.txt.attr @@ -0,0 +1,25 @@ +{ + "_yql_row_spec"={ + "Type"=["StructType";[ + ["p_promo_sk";["PgType";"int4";];]; + ["p_promo_id";["PgType";"text";];]; + ["p_start_date_sk";["PgType";"int4";];]; + ["p_end_date_sk";["PgType";"int4";];]; + ["p_item_sk";["PgType";"int4";];]; + ["p_cost";["PgType";"numeric";];]; + ["p_response_target";["PgType";"int4";];]; + ["p_promo_name";["PgType";"text";];]; + ["p_channel_dmail";["PgType";"text";];]; + ["p_channel_email";["PgType";"text";];]; + ["p_channel_catalog";["PgType";"text";];]; + ["p_channel_tv";["PgType";"text";];]; + ["p_channel_radio";["PgType";"text";];]; + ["p_channel_press";["PgType";"text";];]; + ["p_channel_event";["PgType";"text";];]; + ["p_channel_demo";["PgType";"text";];]; + ["p_channel_details";["PgType";"text";];]; + ["p_purpose";["PgType";"text";];]; + ["p_discount_active";["PgType";"text";];]; + ];]; + } +} diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/q01.sql b/yql/essentials/tests/sql/suites/pg-tpcds/q01.sql new file mode 100644 index 0000000000..7e40034da4 --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/q01.sql @@ -0,0 +1,28 @@ +--!syntax_pg +--TPC-DS Q1 + +-- start query 1 in stream 0 using template ../query_templates/query1.tpl +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 plato.store_returns +,plato.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 +,plato.store +,plato.customer +where ctr1.ctr_total_return > (select avg(ctr_total_return)*1.2::numeric +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 = 'TN' +and ctr1.ctr_customer_sk = c_customer_sk +order by c_customer_id +limit 100; + +-- end query 1 in stream 0 using template ../query_templates/query1.tpl diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/q02.sql b/yql/essentials/tests/sql/suites/pg-tpcds/q02.sql new file mode 100644 index 0000000000..0b1e03a631 --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/q02.sql @@ -0,0 +1,63 @@ +--!syntax_pg +--TPC-DS Q2 + +-- start query 1 in stream 0 using template ../query_templates/query2.tpl +with wscs as + (select sold_date_sk + ,sales_price + from (select ws_sold_date_sk sold_date_sk + ,ws_ext_sales_price sales_price + from plato.web_sales + union all + select cs_sold_date_sk sold_date_sk + ,cs_ext_sales_price sales_price + from plato.catalog_sales) a), + wswscs as + (select d_week_seq, + sum(case when (d_day_name='Sunday') then sales_price else null::numeric end) sun_sales, + sum(case when (d_day_name='Monday') then sales_price else null::numeric end) mon_sales, + sum(case when (d_day_name='Tuesday') then sales_price else null::numeric end) tue_sales, + sum(case when (d_day_name='Wednesday') then sales_price else null::numeric end) wed_sales, + sum(case when (d_day_name='Thursday') then sales_price else null::numeric end) thu_sales, + sum(case when (d_day_name='Friday') then sales_price else null::numeric end) fri_sales, + sum(case when (d_day_name='Saturday') then sales_price else null::numeric end) sat_sales + from wscs + ,plato.date_dim + where d_date_sk = sold_date_sk + group by d_week_seq) + select d_week_seq1 + ,round(sun_sales1/sun_sales2,2) r1 + ,round(mon_sales1/mon_sales2,2) r2 + ,round(tue_sales1/tue_sales2,2) r3 + ,round(wed_sales1/wed_sales2,2) r4 + ,round(thu_sales1/thu_sales2,2) r5 + ,round(fri_sales1/fri_sales2,2) r6 + ,round(sat_sales1/sat_sales2,2) r7 + from + (select wswscs.d_week_seq d_week_seq1 + ,sun_sales sun_sales1 + ,mon_sales mon_sales1 + ,tue_sales tue_sales1 + ,wed_sales wed_sales1 + ,thu_sales thu_sales1 + ,fri_sales fri_sales1 + ,sat_sales sat_sales1 + from wswscs,plato.date_dim + where date_dim.d_week_seq = wswscs.d_week_seq and + d_year = 2001) y, + (select wswscs.d_week_seq d_week_seq2 + ,sun_sales sun_sales2 + ,mon_sales mon_sales2 + ,tue_sales tue_sales2 + ,wed_sales wed_sales2 + ,thu_sales thu_sales2 + ,fri_sales fri_sales2 + ,sat_sales sat_sales2 + from wswscs + ,plato.date_dim + where date_dim.d_week_seq = wswscs.d_week_seq and + d_year = 2001+1) z + where d_week_seq1=d_week_seq2-53 + order by d_week_seq1; + +-- end query 1 in stream 0 using template ../query_templates/query2.tpl diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/q03.sql b/yql/essentials/tests/sql/suites/pg-tpcds/q03.sql new file mode 100644 index 0000000000..58a82aad56 --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/q03.sql @@ -0,0 +1,24 @@ +--!syntax_pg +--TPC-DS Q3 + +-- start query 1 in stream 0 using template ../query_templates/query3.tpl +select dt.d_year + ,item.i_brand_id brand_id + ,item.i_brand brand + ,sum(ss_ext_sales_price) sum_agg + from plato.date_dim dt + ,plato.store_sales + ,plato.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 = 436 + and dt.d_moy=12 + group by dt.d_year + ,item.i_brand + ,item.i_brand_id + order by dt.d_year + ,sum_agg desc + ,brand_id + limit 100; + +-- end query 1 in stream 0 using template ../query_templates/query3.tpl diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/q04.sql b/yql/essentials/tests/sql/suites/pg-tpcds/q04.sql new file mode 100644 index 0000000000..88e5ffdb32 --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/q04.sql @@ -0,0 +1,119 @@ +--!syntax_pg +--TPC-DS Q4 + +-- start query 1 in stream 0 using template ../query_templates/query4.tpl +with year_total as ( + select c_customer_id customer_id + ,c_first_name customer_first_name + ,c_last_name customer_last_name + ,c_preferred_cust_flag customer_preferred_cust_flag + ,c_birth_country customer_birth_country + ,c_login customer_login + ,c_email_address customer_email_address + ,d_year dyear + ,sum(((ss_ext_list_price-ss_ext_wholesale_cost-ss_ext_discount_amt)+ss_ext_sales_price)/2::numeric) year_total + ,'s' sale_type + from plato.customer + ,plato.store_sales + ,plato.date_dim + where c_customer_sk = ss_customer_sk + and ss_sold_date_sk = d_date_sk + group by c_customer_id + ,c_first_name + ,c_last_name + ,c_preferred_cust_flag + ,c_birth_country + ,c_login + ,c_email_address + ,d_year + union all + select c_customer_id customer_id + ,c_first_name customer_first_name + ,c_last_name customer_last_name + ,c_preferred_cust_flag customer_preferred_cust_flag + ,c_birth_country customer_birth_country + ,c_login customer_login + ,c_email_address customer_email_address + ,d_year dyear + ,sum((((cs_ext_list_price-cs_ext_wholesale_cost-cs_ext_discount_amt)+cs_ext_sales_price)/2::numeric) ) year_total + ,'c' sale_type + from plato.customer + ,plato.catalog_sales + ,plato.date_dim + where c_customer_sk = cs_bill_customer_sk + and cs_sold_date_sk = d_date_sk + group by c_customer_id + ,c_first_name + ,c_last_name + ,c_preferred_cust_flag + ,c_birth_country + ,c_login + ,c_email_address + ,d_year +union all + select c_customer_id customer_id + ,c_first_name customer_first_name + ,c_last_name customer_last_name + ,c_preferred_cust_flag customer_preferred_cust_flag + ,c_birth_country customer_birth_country + ,c_login customer_login + ,c_email_address customer_email_address + ,d_year dyear + ,sum((((ws_ext_list_price-ws_ext_wholesale_cost-ws_ext_discount_amt)+ws_ext_sales_price)/2::numeric) ) year_total + ,'w' sale_type + from plato.customer + ,plato.web_sales + ,plato.date_dim + where c_customer_sk = ws_bill_customer_sk + and ws_sold_date_sk = d_date_sk + group by c_customer_id + ,c_first_name + ,c_last_name + ,c_preferred_cust_flag + ,c_birth_country + ,c_login + ,c_email_address + ,d_year + ) + select + t_s_secyear.customer_id + ,t_s_secyear.customer_first_name + ,t_s_secyear.customer_last_name + ,t_s_secyear.customer_email_address + from year_total t_s_firstyear + ,year_total t_s_secyear + ,year_total t_c_firstyear + ,year_total t_c_secyear + ,year_total t_w_firstyear + ,year_total t_w_secyear + where t_s_secyear.customer_id = t_s_firstyear.customer_id + and t_s_firstyear.customer_id = t_c_secyear.customer_id + and t_s_firstyear.customer_id = t_c_firstyear.customer_id + and t_s_firstyear.customer_id = t_w_firstyear.customer_id + and t_s_firstyear.customer_id = t_w_secyear.customer_id + and t_s_firstyear.sale_type = 's' + and t_c_firstyear.sale_type = 'c' + and t_w_firstyear.sale_type = 'w' + and t_s_secyear.sale_type = 's' + and t_c_secyear.sale_type = 'c' + and t_w_secyear.sale_type = 'w' + and t_s_firstyear.dyear = 2001 + and t_s_secyear.dyear = 2001+1 + and t_c_firstyear.dyear = 2001 + and t_c_secyear.dyear = 2001+1 + and t_w_firstyear.dyear = 2001 + and t_w_secyear.dyear = 2001+1 + and t_s_firstyear.year_total > 0::numeric + and t_c_firstyear.year_total > 0::numeric + and t_w_firstyear.year_total > 0::numeric + and case when t_c_firstyear.year_total > 0::numeric then t_c_secyear.year_total / t_c_firstyear.year_total else null::numeric end + > case when t_s_firstyear.year_total > 0::numeric then t_s_secyear.year_total / t_s_firstyear.year_total else null::numeric end + and case when t_c_firstyear.year_total > 0::numeric then t_c_secyear.year_total / t_c_firstyear.year_total else null::numeric end + > case when t_w_firstyear.year_total > 0::numeric then t_w_secyear.year_total / t_w_firstyear.year_total else null::numeric end + order by t_s_secyear.customer_id + ,t_s_secyear.customer_first_name + ,t_s_secyear.customer_last_name + ,t_s_secyear.customer_email_address +limit 100; + +-- end query 1 in stream 0 using template ../query_templates/query4.tpl diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/q05.sql b/yql/essentials/tests/sql/suites/pg-tpcds/q05.sql new file mode 100644 index 0000000000..9601785498 --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/q05.sql @@ -0,0 +1,131 @@ +--!syntax_pg +--TPC-DS Q5 + +-- start query 1 in stream 0 using template ../query_templates/query5.tpl +with ssr as + (select s_store_id, + sum(sales_price) as sales, + sum(profit) as profit, + sum(return_amt) as returns, + sum(net_loss) as profit_loss + from + ( select ss_store_sk as store_sk, + ss_sold_date_sk as date_sk, + ss_ext_sales_price as sales_price, + ss_net_profit as profit, + cast(0 as decimal(7,2)) as return_amt, + cast(0 as decimal(7,2)) as net_loss + from plato.store_sales + union all + select sr_store_sk as store_sk, + sr_returned_date_sk as date_sk, + cast(0 as decimal(7,2)) as sales_price, + cast(0 as decimal(7,2)) as profit, + sr_return_amt as return_amt, + sr_net_loss as net_loss + from plato.store_returns + ) salesreturns, + plato.date_dim, + plato.store + where date_sk = d_date_sk + and d_date between cast('1998-08-04' as date) + and (cast('1998-08-04' as date) + interval '14' day)::date + and store_sk = s_store_sk + group by s_store_id) + , + csr as + (select cp_catalog_page_id, + sum(sales_price) as sales, + sum(profit) as profit, + sum(return_amt) as returns, + sum(net_loss) as profit_loss + from + ( select cs_catalog_page_sk as page_sk, + cs_sold_date_sk as date_sk, + cs_ext_sales_price as sales_price, + cs_net_profit as profit, + cast(0 as decimal(7,2)) as return_amt, + cast(0 as decimal(7,2)) as net_loss + from plato.catalog_sales + union all + select cr_catalog_page_sk as page_sk, + cr_returned_date_sk as date_sk, + cast(0 as decimal(7,2)) as sales_price, + cast(0 as decimal(7,2)) as profit, + cr_return_amount as return_amt, + cr_net_loss as net_loss + from plato.catalog_returns + ) salesreturns, + plato.date_dim, + plato.catalog_page + where date_sk = d_date_sk + and d_date between cast('1998-08-04' as date) + and (cast('1998-08-04' as date) + interval '14' day)::date + and page_sk = cp_catalog_page_sk + group by cp_catalog_page_id) + , + wsr as + (select web_site_id, + sum(sales_price) as sales, + sum(profit) as profit, + sum(return_amt) as returns, + sum(net_loss) as profit_loss + from + ( select ws_web_site_sk as wsr_web_site_sk, + ws_sold_date_sk as date_sk, + ws_ext_sales_price as sales_price, + ws_net_profit as profit, + cast(0 as decimal(7,2)) as return_amt, + cast(0 as decimal(7,2)) as net_loss + from plato.web_sales + union all + select ws_web_site_sk as wsr_web_site_sk, + wr_returned_date_sk as date_sk, + cast(0 as decimal(7,2)) as sales_price, + cast(0 as decimal(7,2)) as profit, + wr_return_amt as return_amt, + wr_net_loss as net_loss + from plato.web_returns left outer join plato.web_sales on + ( wr_item_sk = ws_item_sk + and wr_order_number = ws_order_number) + ) salesreturns, + plato.date_dim, + plato.web_site + where date_sk = d_date_sk + and d_date between cast('1998-08-04' as date) + and (cast('1998-08-04' as date) + interval '14' day)::date + and wsr_web_site_sk = web_site_sk + group by web_site_id) + select channel + , id + , sum(sales) as sales + , sum(returns) as returns + , sum(profit) as profit + from + (select 'store channel' as channel + , 'store' || s_store_id as id + , sales + , returns + , (profit - profit_loss) as profit + from ssr + union all + select 'catalog channel' as channel + , 'catalog_page' || cp_catalog_page_id as id + , sales + , returns + , (profit - profit_loss) as profit + from csr + union all + select 'web channel' as channel + , 'web_site' || web_site_id as id + , sales + , returns + , (profit - profit_loss) as profit + from wsr + ) x + group by rollup (channel, id) + order by channel + ,id + limit 100; + +-- end query 1 in stream 0 using template ../query_templates/query5.tpl diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/q06.sql b/yql/essentials/tests/sql/suites/pg-tpcds/q06.sql new file mode 100644 index 0000000000..045e74df82 --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/q06.sql @@ -0,0 +1,29 @@ +--!syntax_pg +--TPC-DS Q6 + +-- start query 1 in stream 0 using template ../query_templates/query6.tpl +select a.ca_state state, count(*) cnt + from plato.customer_address a + ,plato.customer c + ,plato.store_sales s + ,plato.date_dim d + ,plato.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 plato.date_dim + where d_year = 2000 + and d_moy = 2 ) + and i.i_current_price > 1.2::numeric * + (select avg(j.i_current_price) + from plato.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; + +-- end query 1 in stream 0 using template ../query_templates/query6.tpl diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/q07.sql b/yql/essentials/tests/sql/suites/pg-tpcds/q07.sql new file mode 100644 index 0000000000..909507305f --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/q07.sql @@ -0,0 +1,24 @@ +--!syntax_pg +--TPC-DS Q7 + +-- start query 1 in stream 0 using template ../query_templates/query7.tpl +select i_item_id, + avg(ss_quantity) agg1, + avg(ss_list_price) agg2, + avg(ss_coupon_amt) agg3, + avg(ss_sales_price) agg4 + from plato.store_sales, plato.customer_demographics, plato.date_dim, plato.item, plato.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 = 'Primary' and + (p_channel_email = 'N' or p_channel_event = 'N') and + d_year = 1998 + group by i_item_id + order by i_item_id + limit 100; + +-- end query 1 in stream 0 using template ../query_templates/query7.tpl diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/q08.sql b/yql/essentials/tests/sql/suites/pg-tpcds/q08.sql new file mode 100644 index 0000000000..7041a81acc --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/q08.sql @@ -0,0 +1,111 @@ +--!syntax_pg +--TPC-DS Q8 + +-- start query 1 in stream 0 using template ../query_templates/query8.tpl +select s_store_name + ,sum(ss_net_profit) + from plato.store_sales + ,plato.date_dim + ,plato.store, + (select ca_zip + from ( + SELECT substr(ca_zip,1,5) ca_zip + FROM plato.customer_address + WHERE substr(ca_zip,1,5) IN ( + '89436','30868','65085','22977','83927','77557', + '58429','40697','80614','10502','32779', + '91137','61265','98294','17921','18427', + '21203','59362','87291','84093','21505', + '17184','10866','67898','25797','28055', + '18377','80332','74535','21757','29742', + '90885','29898','17819','40811','25990', + '47513','89531','91068','10391','18846', + '99223','82637','41368','83658','86199', + '81625','26696','89338','88425','32200', + '81427','19053','77471','36610','99823', + '43276','41249','48584','83550','82276', + '18842','78890','14090','38123','40936', + '34425','19850','43286','80072','79188', + '54191','11395','50497','84861','90733', + '21068','57666','37119','25004','57835', + '70067','62878','95806','19303','18840', + '19124','29785','16737','16022','49613', + '89977','68310','60069','98360','48649', + '39050','41793','25002','27413','39736', + '47208','16515','94808','57648','15009', + '80015','42961','63982','21744','71853', + '81087','67468','34175','64008','20261', + '11201','51799','48043','45645','61163', + '48375','36447','57042','21218','41100', + '89951','22745','35851','83326','61125', + '78298','80752','49858','52940','96976', + '63792','11376','53582','18717','90226', + '50530','94203','99447','27670','96577', + '57856','56372','16165','23427','54561', + '28806','44439','22926','30123','61451', + '92397','56979','92309','70873','13355', + '21801','46346','37562','56458','28286', + '47306','99555','69399','26234','47546', + '49661','88601','35943','39936','25632', + '24611','44166','56648','30379','59785', + '11110','14329','93815','52226','71381', + '13842','25612','63294','14664','21077', + '82626','18799','60915','81020','56447', + '76619','11433','13414','42548','92713', + '70467','30884','47484','16072','38936', + '13036','88376','45539','35901','19506', + '65690','73957','71850','49231','14276', + '20005','18384','76615','11635','38177', + '55607','41369','95447','58581','58149', + '91946','33790','76232','75692','95464', + '22246','51061','56692','53121','77209', + '15482','10688','14868','45907','73520', + '72666','25734','17959','24677','66446', + '94627','53535','15560','41967','69297', + '11929','59403','33283','52232','57350', + '43933','40921','36635','10827','71286', + '19736','80619','25251','95042','15526', + '36496','55854','49124','81980','35375', + '49157','63512','28944','14946','36503', + '54010','18767','23969','43905','66979', + '33113','21286','58471','59080','13395', + '79144','70373','67031','38360','26705', + '50906','52406','26066','73146','15884', + '31897','30045','61068','45550','92454', + '13376','14354','19770','22928','97790', + '50723','46081','30202','14410','20223', + '88500','67298','13261','14172','81410', + '93578','83583','46047','94167','82564', + '21156','15799','86709','37931','74703', + '83103','23054','70470','72008','49247', + '91911','69998','20961','70070','63197', + '54853','88191','91830','49521','19454', + '81450','89091','62378','25683','61869', + '51744','36580','85778','36871','48121', + '28810','83712','45486','67393','26935', + '42393','20132','55349','86057','21309', + '80218','10094','11357','48819','39734', + '40758','30432','21204','29467','30214', + '61024','55307','74621','11622','68908', + '33032','52868','99194','99900','84936', + '69036','99149','45013','32895','59004', + '32322','14933','32936','33562','72550', + '27385','58049','58200','16808','21360', + '32961','18586','79307','15492') + intersect + select ca_zip + from (SELECT substr(ca_zip,1,5) ca_zip,count(*) cnt + FROM plato.customer_address, plato.customer + WHERE ca_address_sk = c_current_addr_sk and + c_preferred_cust_flag='Y' + group by ca_zip + having count(*) > 10)A1)A2) V1 + where ss_store_sk = s_store_sk + and ss_sold_date_sk = d_date_sk + and d_qoy = 1 and d_year = 2002 + and (substr(s_zip,1,2) = substr(V1.ca_zip,1,2)) + group by s_store_name + order by s_store_name + limit 100; + +-- end query 1 in stream 0 using template ../query_templates/query8.tpl diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/q09.sql b/yql/essentials/tests/sql/suites/pg-tpcds/q09.sql new file mode 100644 index 0000000000..11b75aa231 --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/q09.sql @@ -0,0 +1,54 @@ +--!syntax_pg +--TPC-DS Q9 + +-- start query 1 in stream 0 using template ../query_templates/query9.tpl +select case when (select count(*) + from plato.store_sales + where ss_quantity between 1 and 20) > 25437 + then (select avg(ss_ext_discount_amt) + from plato.store_sales + where ss_quantity between 1 and 20) + else (select avg(ss_net_profit) + from plato.store_sales + where ss_quantity between 1 and 20) end bucket1 , + case when (select count(*) + from plato.store_sales + where ss_quantity between 21 and 40) > 22746 + then (select avg(ss_ext_discount_amt) + from plato.store_sales + where ss_quantity between 21 and 40) + else (select avg(ss_net_profit) + from plato.store_sales + where ss_quantity between 21 and 40) end bucket2, + case when (select count(*) + from plato.store_sales + where ss_quantity between 41 and 60) > 9387 + then (select avg(ss_ext_discount_amt) + from plato.store_sales + where ss_quantity between 41 and 60) + else (select avg(ss_net_profit) + from plato.store_sales + where ss_quantity between 41 and 60) end bucket3, + case when (select count(*) + from plato.store_sales + where ss_quantity between 61 and 80) > 10098 + then (select avg(ss_ext_discount_amt) + from plato.store_sales + where ss_quantity between 61 and 80) + else (select avg(ss_net_profit) + from plato.store_sales + where ss_quantity between 61 and 80) end bucket4, + case when (select count(*) + from plato.store_sales + where ss_quantity between 81 and 100) > 18213 + then (select avg(ss_ext_discount_amt) + from plato.store_sales + where ss_quantity between 81 and 100) + else (select avg(ss_net_profit) + from plato.store_sales + where ss_quantity between 81 and 100) end bucket5 +from plato.reason +where r_reason_sk = 1 +; + +-- end query 1 in stream 0 using template ../query_templates/query9.tpl diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/q10.sql b/yql/essentials/tests/sql/suites/pg-tpcds/q10.sql new file mode 100644 index 0000000000..4295edb76e --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/q10.sql @@ -0,0 +1,62 @@ +--!syntax_pg +--TPC-DS Q10 + +-- start query 1 in stream 0 using template ../query_templates/query10.tpl +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 + plato.customer c,plato.customer_address ca,plato.customer_demographics + where + c.c_current_addr_sk = ca.ca_address_sk and + ca_county in ('Walker County','Richland County','Gaines County','Douglas County','Dona Ana County') and + cd_demo_sk = c.c_current_cdemo_sk and + exists (select * + from plato.store_sales,plato.date_dim + where c.c_customer_sk = ss_customer_sk and + ss_sold_date_sk = d_date_sk and + d_year = 2002 and + d_moy between 4 and 4+3) and + (exists (select * + from plato.web_sales,plato.date_dim + where c.c_customer_sk = ws_bill_customer_sk and + ws_sold_date_sk = d_date_sk and + d_year = 2002 and + d_moy between 4 ANd 4+3) or + exists (select * + from plato.catalog_sales,plato.date_dim + where c.c_customer_sk = cs_ship_customer_sk and + cs_sold_date_sk = d_date_sk and + d_year = 2002 and + d_moy between 4 and 4+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; + +-- end query 1 in stream 0 using template ../query_templates/query10.tpl diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/q11.sql b/yql/essentials/tests/sql/suites/pg-tpcds/q11.sql new file mode 100644 index 0000000000..3befe397a2 --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/q11.sql @@ -0,0 +1,84 @@ +--!syntax_pg +--TPC-DS Q11 + +-- start query 1 in stream 0 using template ../query_templates/query11.tpl +with year_total as ( + select c_customer_id customer_id + ,c_first_name customer_first_name + ,c_last_name customer_last_name + ,c_preferred_cust_flag customer_preferred_cust_flag + ,c_birth_country customer_birth_country + ,c_login customer_login + ,c_email_address customer_email_address + ,d_year dyear + ,sum(ss_ext_list_price-ss_ext_discount_amt) year_total + ,'s' sale_type + from plato.customer + ,plato.store_sales + ,plato.date_dim + where c_customer_sk = ss_customer_sk + and ss_sold_date_sk = d_date_sk + group by c_customer_id + ,c_first_name + ,c_last_name + ,c_preferred_cust_flag + ,c_birth_country + ,c_login + ,c_email_address + ,d_year + union all + select c_customer_id customer_id + ,c_first_name customer_first_name + ,c_last_name customer_last_name + ,c_preferred_cust_flag customer_preferred_cust_flag + ,c_birth_country customer_birth_country + ,c_login customer_login + ,c_email_address customer_email_address + ,d_year dyear + ,sum(ws_ext_list_price-ws_ext_discount_amt) year_total + ,'w' sale_type + from plato.customer + ,plato.web_sales + ,plato.date_dim + where c_customer_sk = ws_bill_customer_sk + and ws_sold_date_sk = d_date_sk + group by c_customer_id + ,c_first_name + ,c_last_name + ,c_preferred_cust_flag + ,c_birth_country + ,c_login + ,c_email_address + ,d_year + ) + select + t_s_secyear.customer_id + ,t_s_secyear.customer_first_name + ,t_s_secyear.customer_last_name + ,t_s_secyear.customer_email_address + from year_total t_s_firstyear + ,year_total t_s_secyear + ,year_total t_w_firstyear + ,year_total t_w_secyear + where t_s_secyear.customer_id = t_s_firstyear.customer_id + and t_s_firstyear.customer_id = t_w_secyear.customer_id + and t_s_firstyear.customer_id = t_w_firstyear.customer_id + and t_s_firstyear.sale_type = 's' + and t_w_firstyear.sale_type = 'w' + and t_s_secyear.sale_type = 's' + and t_w_secyear.sale_type = 'w' + and t_s_firstyear.dyear = 2001 + and t_s_secyear.dyear = 2001+1 + and t_w_firstyear.dyear = 2001 + and t_w_secyear.dyear = 2001+1 + and t_s_firstyear.year_total > 0::numeric + and t_w_firstyear.year_total > 0::numeric + and case when t_w_firstyear.year_total > 0::numeric then t_w_secyear.year_total / t_w_firstyear.year_total else 0.0::numeric end + > case when t_s_firstyear.year_total > 0::numeric then t_s_secyear.year_total / t_s_firstyear.year_total else 0.0::numeric end + order by t_s_secyear.customer_id + ,t_s_secyear.customer_first_name + ,t_s_secyear.customer_last_name + ,t_s_secyear.customer_email_address +limit 100; + +-- end query 1 in stream 0 using template ../query_templates/query11.tpl diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/q12.sql b/yql/essentials/tests/sql/suites/pg-tpcds/q12.sql new file mode 100644 index 0000000000..1523125711 --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/q12.sql @@ -0,0 +1,37 @@ +--!syntax_pg +--TPC-DS Q12 + +-- start query 1 in stream 0 using template ../query_templates/query12.tpl +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::numeric/sum(sum(ws_ext_sales_price)) over + (partition by i_class) as revenueratio +from + plato.web_sales + ,plato.item + ,plato.date_dim +where + ws_item_sk = i_item_sk + and i_category in ('Jewelry', 'Sports', 'Books') + and ws_sold_date_sk = d_date_sk + and d_date between cast('2001-01-12' as date) + and (cast('2001-01-12' as date) + interval '30' day)::date +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; + +-- end query 1 in stream 0 using template ../query_templates/query12.tpl diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/q13.sql b/yql/essentials/tests/sql/suites/pg-tpcds/q13.sql new file mode 100644 index 0000000000..c8e8a60cc8 --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/q13.sql @@ -0,0 +1,55 @@ +--!syntax_pg +--TPC-DS Q13 + +-- start query 1 in stream 0 using template ../query_templates/query13.tpl +select avg(ss_quantity) avg_ss_q + ,avg(ss_ext_sales_price) avg_ss_s + ,avg(ss_ext_wholesale_cost) avg_ss_w + ,sum(ss_ext_wholesale_cost) sum_ss_w + from plato.store_sales + ,plato.store + ,plato.customer_demographics + ,plato.household_demographics + ,plato.customer_address + ,plato.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 = '2 yr Degree' + and ss_sales_price between 100.00::numeric and 150.00::numeric + 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 = 'Secondary' + and ss_sales_price between 50.00::numeric and 100.00::numeric + and hd_dep_count = 1 + ) or + (ss_hdemo_sk=hd_demo_sk + and cd_demo_sk = ss_cdemo_sk + and cd_marital_status = 'W' + and cd_education_status = 'Advanced Degree' + and ss_sales_price between 150.00::numeric and 200.00::numeric + and hd_dep_count = 1 + )) + and((ss_addr_sk = ca_address_sk + and ca_country = 'United States' + and ca_state in ('CO', 'IL', 'MN') + and ss_net_profit between 100::numeric and 200::numeric + ) or + (ss_addr_sk = ca_address_sk + and ca_country = 'United States' + and ca_state in ('OH', 'MT', 'NM') + and ss_net_profit between 150::numeric and 300::numeric + ) or + (ss_addr_sk = ca_address_sk + and ca_country = 'United States' + and ca_state in ('TX', 'MO', 'MI') + and ss_net_profit between 50::numeric and 250::numeric + )) +; + +-- end query 1 in stream 0 using template ../query_templates/query13.tpl diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/q14.sql b/yql/essentials/tests/sql/suites/pg-tpcds/q14.sql new file mode 100644 index 0000000000..00cc9da131 --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/q14.sql @@ -0,0 +1,213 @@ +--!syntax_pg +--TPC-DS Q14 + +-- start query 1 in stream 0 using template ../query_templates/query14.tpl +with cross_items as + (select i_item_sk ss_item_sk + from plato.item, + (select iss.i_brand_id brand_id + ,iss.i_class_id class_id + ,iss.i_category_id category_id + from plato.store_sales + ,plato.item iss + ,plato.date_dim d1 + where ss_item_sk = iss.i_item_sk + and ss_sold_date_sk = d1.d_date_sk + and d1.d_year between 1998 AND 1998 + 2 + intersect + select ics.i_brand_id + ,ics.i_class_id + ,ics.i_category_id + from plato.catalog_sales + ,plato.item ics + ,plato.date_dim d2 + where cs_item_sk = ics.i_item_sk + and cs_sold_date_sk = d2.d_date_sk + and d2.d_year between 1998 AND 1998 + 2 + intersect + select iws.i_brand_id + ,iws.i_class_id + ,iws.i_category_id + from plato.web_sales + ,plato.item iws + ,plato.date_dim d3 + where ws_item_sk = iws.i_item_sk + and ws_sold_date_sk = d3.d_date_sk + and d3.d_year between 1998 AND 1998 + 2) a + where i_brand_id = brand_id + and i_class_id = class_id + and i_category_id = category_id +), + avg_sales as + (select avg(quantity::numeric*list_price) average_sales + from (select ss_quantity quantity + ,ss_list_price list_price + from plato.store_sales + ,plato.date_dim + where ss_sold_date_sk = d_date_sk + and d_year between 1998 and 1998 + 2 + union all + select cs_quantity quantity + ,cs_list_price list_price + from plato.catalog_sales + ,plato.date_dim + where cs_sold_date_sk = d_date_sk + and d_year between 1998 and 1998 + 2 + union all + select ws_quantity quantity + ,ws_list_price list_price + from plato.web_sales + ,plato.date_dim + where ws_sold_date_sk = d_date_sk + and d_year between 1998 and 1998 + 2) x) + select channel, i_brand_id,i_class_id,i_category_id,sum(sales) sum_sales, sum(number_sales) sum_num_sales + from( + select 'store' channel, i_brand_id,i_class_id + ,i_category_id,sum(ss_quantity::numeric*ss_list_price) sales + , count(*) number_sales + from plato.store_sales + ,plato.item + ,plato.date_dim + where ss_item_sk in (select ss_item_sk from cross_items) + and ss_item_sk = i_item_sk + and ss_sold_date_sk = d_date_sk + and d_year = 1998+2 + and d_moy = 11 + group by i_brand_id,i_class_id,i_category_id + having sum(ss_quantity::numeric*ss_list_price) > (select average_sales from avg_sales) + union all + select 'catalog' channel, i_brand_id,i_class_id,i_category_id, sum(cs_quantity::numeric*cs_list_price) sales, count(*) number_sales + from plato.catalog_sales + ,plato.item + ,plato.date_dim + where cs_item_sk in (select ss_item_sk from cross_items) + and cs_item_sk = i_item_sk + and cs_sold_date_sk = d_date_sk + and d_year = 1998+2 + and d_moy = 11 + group by i_brand_id,i_class_id,i_category_id + having sum(cs_quantity::numeric*cs_list_price) > (select average_sales from avg_sales) + union all + select 'web' channel, i_brand_id,i_class_id,i_category_id, sum(ws_quantity::numeric*ws_list_price) sales , count(*) number_sales + from plato.web_sales + ,plato.item + ,plato.date_dim + where ws_item_sk in (select ss_item_sk from cross_items) + and ws_item_sk = i_item_sk + and ws_sold_date_sk = d_date_sk + and d_year = 1998+2 + and d_moy = 11 + group by i_brand_id,i_class_id,i_category_id + having sum(ws_quantity::numeric*ws_list_price) > (select average_sales from avg_sales) + ) y + group by rollup (channel, i_brand_id,i_class_id,i_category_id) + order by channel,i_brand_id,i_class_id,i_category_id + limit 100; +with cross_items as + (select i_item_sk ss_item_sk + from plato.item, + (select iss.i_brand_id brand_id + ,iss.i_class_id class_id + ,iss.i_category_id category_id + from plato.store_sales + ,plato.item iss + ,plato.date_dim d1 + where ss_item_sk = iss.i_item_sk + and ss_sold_date_sk = d1.d_date_sk + and d1.d_year between 1998 AND 1998 + 2 + intersect + select ics.i_brand_id + ,ics.i_class_id + ,ics.i_category_id + from plato.catalog_sales + ,plato.item ics + ,plato.date_dim d2 + where cs_item_sk = ics.i_item_sk + and cs_sold_date_sk = d2.d_date_sk + and d2.d_year between 1998 AND 1998 + 2 + intersect + select iws.i_brand_id + ,iws.i_class_id + ,iws.i_category_id + from plato.web_sales + ,plato.item iws + ,plato.date_dim d3 + where ws_item_sk = iws.i_item_sk + and ws_sold_date_sk = d3.d_date_sk + and d3.d_year between 1998 AND 1998 + 2) x + where i_brand_id = brand_id + and i_class_id = class_id + and i_category_id = category_id +), + avg_sales as +(select avg(quantity::numeric*list_price) average_sales + from (select ss_quantity quantity + ,ss_list_price list_price + from plato.store_sales + ,plato.date_dim + where ss_sold_date_sk = d_date_sk + and d_year between 1998 and 1998 + 2 + union all + select cs_quantity quantity + ,cs_list_price list_price + from plato.catalog_sales + ,plato.date_dim + where cs_sold_date_sk = d_date_sk + and d_year between 1998 and 1998 + 2 + union all + select ws_quantity quantity + ,ws_list_price list_price + from plato.web_sales + ,plato.date_dim + where ws_sold_date_sk = d_date_sk + and d_year between 1998 and 1998 + 2) x) + select this_year.channel ty_channel + ,this_year.i_brand_id ty_brand + ,this_year.i_class_id ty_class + ,this_year.i_category_id ty_category + ,this_year.sales ty_sales + ,this_year.number_sales ty_number_sales + ,last_year.channel ly_channel + ,last_year.i_brand_id ly_brand + ,last_year.i_class_id ly_class + ,last_year.i_category_id ly_category + ,last_year.sales ly_sales + ,last_year.number_sales ly_number_sales + from + (select 'store' channel, i_brand_id,i_class_id,i_category_id + ,sum(ss_quantity::numeric*ss_list_price) sales, count(*) number_sales + from plato.store_sales + ,plato.item + ,plato.date_dim + where ss_item_sk in (select ss_item_sk from cross_items) + and ss_item_sk = i_item_sk + and ss_sold_date_sk = d_date_sk + and d_week_seq = (select d_week_seq + from plato.date_dim + where d_year = 1998 + 1 + and d_moy = 12 + and d_dom = 16) + group by i_brand_id,i_class_id,i_category_id + having sum(ss_quantity::numeric*ss_list_price) > (select average_sales from avg_sales)) this_year, + (select 'store' channel, i_brand_id,i_class_id + ,i_category_id, sum(ss_quantity::numeric*ss_list_price) sales, count(*) number_sales + from plato.store_sales + ,plato.item + ,plato.date_dim + where ss_item_sk in (select ss_item_sk from cross_items) + and ss_item_sk = i_item_sk + and ss_sold_date_sk = d_date_sk + and d_week_seq = (select d_week_seq + from plato.date_dim + where d_year = 1998 + and d_moy = 12 + and d_dom = 16) + group by i_brand_id,i_class_id,i_category_id + having sum(ss_quantity::numeric*ss_list_price) > (select average_sales from avg_sales)) last_year + where this_year.i_brand_id= last_year.i_brand_id + and this_year.i_class_id = last_year.i_class_id + and this_year.i_category_id = last_year.i_category_id + order by this_year.channel, this_year.i_brand_id, this_year.i_class_id, this_year.i_category_id + limit 100; + +-- end query 1 in stream 0 using template ../query_templates/query14.tpl diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/q15.sql b/yql/essentials/tests/sql/suites/pg-tpcds/q15.sql new file mode 100644 index 0000000000..1ceca68e03 --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/q15.sql @@ -0,0 +1,23 @@ +--!syntax_pg +--TPC-DS Q15 + +-- start query 1 in stream 0 using template ../query_templates/query15.tpl +select ca_zip + ,sum(cs_sales_price) + from plato.catalog_sales + ,plato.customer + ,plato.customer_address + ,plato.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::numeric) + and cs_sold_date_sk = d_date_sk + and d_qoy = 2 and d_year = 2000 + group by ca_zip + order by ca_zip + limit 100; + +-- end query 1 in stream 0 using template ../query_templates/query15.tpl diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/q16.sql b/yql/essentials/tests/sql/suites/pg-tpcds/q16.sql new file mode 100644 index 0000000000..04ad619f13 --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/q16.sql @@ -0,0 +1,34 @@ +--!syntax_pg +--TPC-DS Q16 + +-- start query 1 in stream 0 using template ../query_templates/query16.tpl +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 + plato.catalog_sales cs1 + ,plato.date_dim + ,plato.customer_address + ,plato.call_center +where + d_date between '1999-2-01'::date and + (cast('1999-2-01' as date) + interval '60' day)::date +and cs1.cs_ship_date_sk = d_date_sk +and cs1.cs_ship_addr_sk = ca_address_sk +and ca_state = 'IL' +and cs1.cs_call_center_sk = cc_call_center_sk +and cc_county in ('Williamson County','Williamson County','Williamson County','Williamson County', + 'Williamson County' +) +and exists (select * + from plato.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 plato.catalog_returns cr1 + where cs1.cs_order_number = cr1.cr_order_number) +order by count(distinct cs_order_number) +limit 100; + +-- end query 1 in stream 0 using template ../query_templates/query16.tpl diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/q17.sql b/yql/essentials/tests/sql/suites/pg-tpcds/q17.sql new file mode 100644 index 0000000000..2b0a6cf476 --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/q17.sql @@ -0,0 +1,48 @@ +--!syntax_pg +--TPC-DS Q17 + +-- start query 1 in stream 0 using template ../query_templates/query17.tpl +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 plato.store_sales + ,plato.store_returns + ,plato.catalog_sales + ,plato.date_dim d1 + ,plato.date_dim d2 + ,plato.date_dim d3 + ,plato.store + ,plato.item + where d1.d_quarter_name = '1998Q1' + 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 ('1998Q1','1998Q2','1998Q3') + 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 ('1998Q1','1998Q2','1998Q3') + group by i_item_id + ,i_item_desc + ,s_state + order by i_item_id + ,i_item_desc + ,s_state +limit 100; + +-- end query 1 in stream 0 using template ../query_templates/query17.tpl diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/q18.sql b/yql/essentials/tests/sql/suites/pg-tpcds/q18.sql new file mode 100644 index 0000000000..11b5a79cfb --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/q18.sql @@ -0,0 +1,37 @@ +--!syntax_pg +--TPC-DS Q18 + +-- start query 1 in stream 0 using template ../query_templates/query18.tpl +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 plato.catalog_sales, plato.customer_demographics cd1, + plato.customer_demographics cd2, plato.customer, plato.customer_address, plato.date_dim, plato.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 = 'M' and + cd1.cd_education_status = 'College' and + c_current_cdemo_sk = cd2.cd_demo_sk and + c_current_addr_sk = ca_address_sk and + c_birth_month in (9,5,12,4,1,10) and + d_year = 2001 and + ca_state in ('ND','WI','AL' + ,'NC','OK','MS','TN') + 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; + +-- end query 1 in stream 0 using template ../query_templates/query18.tpl diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/q19.sql b/yql/essentials/tests/sql/suites/pg-tpcds/q19.sql new file mode 100644 index 0000000000..ff2d9315c8 --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/q19.sql @@ -0,0 +1,28 @@ +--!syntax_pg +--TPC-DS Q19 + +-- start query 1 in stream 0 using template ../query_templates/query19.tpl +select i_brand_id brand_id, i_brand brand, i_manufact_id, i_manufact, + sum(ss_ext_sales_price) ext_price + from plato.date_dim, plato.store_sales, plato.item,plato.customer,plato.customer_address,plato.store + where d_date_sk = ss_sold_date_sk + and ss_item_sk = i_item_sk + and i_manager_id=7 + and d_moy=11 + 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 ; + +-- end query 1 in stream 0 using template ../query_templates/query19.tpl diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/q20.sql b/yql/essentials/tests/sql/suites/pg-tpcds/q20.sql new file mode 100644 index 0000000000..8e1e02682f --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/q20.sql @@ -0,0 +1,33 @@ +--!syntax_pg +--TPC-DS Q20 + +-- start query 1 in stream 0 using template ../query_templates/query20.tpl +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::numeric/sum(sum(cs_ext_sales_price)) over + (partition by i_class) as revenueratio + from plato.catalog_sales + ,plato.item + ,plato.date_dim + where cs_item_sk = i_item_sk + and i_category in ('Jewelry', 'Sports', 'Books') + and cs_sold_date_sk = d_date_sk + and d_date between cast('2001-01-12' as date) + and (cast('2001-01-12' as date) + interval '30' day)::date + 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; + +-- end query 1 in stream 0 using template ../query_templates/query20.tpl diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/q21.sql b/yql/essentials/tests/sql/suites/pg-tpcds/q21.sql new file mode 100644 index 0000000000..c5eca101b9 --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/q21.sql @@ -0,0 +1,33 @@ +--!syntax_pg +--TPC-DS Q21 + +-- start query 1 in stream 0 using template ../query_templates/query21.tpl +select * + from(select w_warehouse_name + ,i_item_id + ,sum(case when (cast(d_date as date) < cast ('1998-04-08' as date)) + then inv_quantity_on_hand + else 0 end) as inv_before + ,sum(case when (cast(d_date as date) >= cast ('1998-04-08' as date)) + then inv_quantity_on_hand + else 0 end) as inv_after + from plato.inventory + ,plato.warehouse + ,plato.item + ,plato.date_dim + where i_current_price between 0.99::numeric and 1.49::numeric + 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 ('1998-04-08' as date) - interval '30' day)::date + and (cast ('1998-04-08' as date) + interval '30' day)::date + group by w_warehouse_name, i_item_id) x + where (case when inv_before > 0 + then inv_after / inv_before + else null::int8 + end) between (2.0/3.0)::int8 and (3.0/2.0)::int8 + order by w_warehouse_name + ,i_item_id + limit 100; + +-- end query 1 in stream 0 using template ../query_templates/query21.tpl diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/q22.sql b/yql/essentials/tests/sql/suites/pg-tpcds/q22.sql new file mode 100644 index 0000000000..889168511b --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/q22.sql @@ -0,0 +1,23 @@ +--!syntax_pg +--TPC-DS Q22 + +-- start query 1 in stream 0 using template ../query_templates/query22.tpl +select i_product_name + ,i_brand + ,i_class + ,i_category + ,avg(inv_quantity_on_hand) qoh + from plato.inventory + ,plato.date_dim + ,plato.item + where inv_date_sk=d_date_sk + and inv_item_sk=i_item_sk + and d_month_seq between 1212 and 1212 + 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; + +-- end query 1 in stream 0 using template ../query_templates/query22.tpl diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/q23.sql b/yql/essentials/tests/sql/suites/pg-tpcds/q23.sql new file mode 100644 index 0000000000..7dfc9f03ee --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/q23.sql @@ -0,0 +1,110 @@ +--!syntax_pg +--TPC-DS Q23 + +-- start query 1 in stream 0 using template ../query_templates/query23.tpl +with frequent_ss_items as + (select substr(i_item_desc,1,30) itemdesc,i_item_sk item_sk,d_date solddate,count(*) cnt + from plato.store_sales + ,plato.date_dim + ,plato.item + where ss_sold_date_sk = d_date_sk + and ss_item_sk = i_item_sk + and d_year in (1999,1999+1,1999+2,1999+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::numeric*ss_sales_price) csales + from plato.store_sales + ,plato.customer + ,plato.date_dim + where ss_customer_sk = c_customer_sk + and ss_sold_date_sk = d_date_sk + and d_year in (1999,1999+1,1999+2,1999+3) + group by c_customer_sk) a), + best_ss_customer as + (select c_customer_sk,sum(ss_quantity::numeric*ss_sales_price) ssales + from plato.store_sales + ,plato.customer + where ss_customer_sk = c_customer_sk + group by c_customer_sk + having sum(ss_quantity::numeric*ss_sales_price) > (95.0/100.0)::numeric * (select + * +from + max_store_sales)::numeric) + select sum(sales) + from (select cs_quantity::numeric*cs_list_price sales + from plato.catalog_sales + ,plato.date_dim + where d_year = 1999 + and d_moy = 1 + 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::numeric*ws_list_price sales + from plato.web_sales + ,plato.date_dim + where d_year = 1999 + and d_moy = 1 + 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)) a + 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 plato.store_sales + ,plato.date_dim + ,plato.item + where ss_sold_date_sk = d_date_sk + and ss_item_sk = i_item_sk + and d_year in (1999,1999 + 1,1999 + 2,1999 + 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::numeric*ss_sales_price) csales + from plato.store_sales + ,plato.customer + ,plato.date_dim + where ss_customer_sk = c_customer_sk + and ss_sold_date_sk = d_date_sk + and d_year in (1999,1999+1,1999+2,1999+3) + group by c_customer_sk) a), + best_ss_customer as + (select c_customer_sk,sum(ss_quantity::numeric*ss_sales_price) ssales + from plato.store_sales + ,plato.customer + where ss_customer_sk = c_customer_sk + group by c_customer_sk + having sum(ss_quantity::numeric*ss_sales_price) > (95.0/100.0)::numeric * (select + * + from max_store_sales)::numeric) + select c_last_name,c_first_name,sales + from (select c_last_name,c_first_name,sum(cs_quantity::numeric*cs_list_price) sales + from plato.catalog_sales + ,plato.customer + ,plato.date_dim + where d_year = 1999 + and d_moy = 1 + and cs_sold_date_sk = d_date_sk + and cs_item_sk in (select item_sk from frequent_ss_items) + and cs_bill_customer_sk in (select c_customer_sk from best_ss_customer) + and cs_bill_customer_sk = c_customer_sk + group by c_last_name,c_first_name + union all + select c_last_name,c_first_name,sum(ws_quantity::numeric*ws_list_price) sales + from plato.web_sales + ,plato.customer + ,plato.date_dim + where d_year = 1999 + and d_moy = 1 + and ws_sold_date_sk = d_date_sk + and ws_item_sk in (select item_sk from frequent_ss_items) + and ws_bill_customer_sk in (select c_customer_sk from best_ss_customer) + and ws_bill_customer_sk = c_customer_sk + group by c_last_name,c_first_name) a + order by c_last_name,c_first_name,sales + limit 100; + +-- end query 1 in stream 0 using template ../query_templates/query23.tpl diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/q24.sql b/yql/essentials/tests/sql/suites/pg-tpcds/q24.sql new file mode 100644 index 0000000000..320888452d --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/q24.sql @@ -0,0 +1,110 @@ +--!syntax_pg +--TPC-DS Q24 + +-- start query 1 in stream 0 using template ../query_templates/query24.tpl +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_sales_price) netpaid +from plato.store_sales + ,plato.store_returns + ,plato.store + ,plato.item + ,plato.customer + ,plato.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=7 +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 = 'orchid' +group by c_last_name + ,c_first_name + ,s_store_name +having sum(netpaid) > (select 0.05::numeric*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_sales_price) netpaid +from plato.store_sales + ,plato.store_returns + ,plato.store + ,plato.item + ,plato.customer + ,plato.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 = 7 +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 = 'chiffon' +group by c_last_name + ,c_first_name + ,s_store_name +having sum(netpaid) > (select 0.05::numeric*avg(netpaid) + from ssales) +order by c_last_name + ,c_first_name + ,s_store_name +; + +-- end query 1 in stream 0 using template ../query_templates/query24.tpl diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/q25.sql b/yql/essentials/tests/sql/suites/pg-tpcds/q25.sql new file mode 100644 index 0000000000..764be84db6 --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/q25.sql @@ -0,0 +1,51 @@ +--!syntax_pg +--TPC-DS Q25 + +-- start query 1 in stream 0 using template ../query_templates/query25.tpl +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 + plato.store_sales + ,plato.store_returns + ,plato.catalog_sales + ,plato.date_dim d1 + ,plato.date_dim d2 + ,plato.date_dim d3 + ,plato.store + ,plato.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; + +-- end query 1 in stream 0 using template ../query_templates/query25.tpl diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/q26.sql b/yql/essentials/tests/sql/suites/pg-tpcds/q26.sql new file mode 100644 index 0000000000..9d3e5f6200 --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/q26.sql @@ -0,0 +1,24 @@ +--!syntax_pg +--TPC-DS Q26 + +-- start query 1 in stream 0 using template ../query_templates/query26.tpl +select i_item_id, + avg(cs_quantity) agg1, + avg(cs_list_price) agg2, + avg(cs_coupon_amt) agg3, + avg(cs_sales_price) agg4 + from plato.catalog_sales, plato.customer_demographics, plato.date_dim, plato.item, plato.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 = 'F' and + cd_marital_status = 'W' and + cd_education_status = 'Primary' and + (p_channel_email = 'N' or p_channel_event = 'N') and + d_year = 1998 + group by i_item_id + order by i_item_id + limit 100; + +-- end query 1 in stream 0 using template ../query_templates/query26.tpl diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/q27.sql b/yql/essentials/tests/sql/suites/pg-tpcds/q27.sql new file mode 100644 index 0000000000..a83e9a6e19 --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/q27.sql @@ -0,0 +1,26 @@ +--!syntax_pg +--TPC-DS Q27 + +-- start query 1 in stream 0 using template ../query_templates/query27.tpl +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 plato.store_sales, plato.customer_demographics, plato.date_dim, plato.store, plato.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 = 'W' and + cd_education_status = 'Primary' and + d_year = 1998 and + s_state in ('TN','TN', 'TN', 'TN', 'TN', 'TN') + group by rollup (i_item_id, s_state) + order by i_item_id + ,s_state + limit 100; + +-- end query 1 in stream 0 using template ../query_templates/query27.tpl diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/q28.sql b/yql/essentials/tests/sql/suites/pg-tpcds/q28.sql new file mode 100644 index 0000000000..c20841d8b8 --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/q28.sql @@ -0,0 +1,56 @@ +--!syntax_pg +--TPC-DS Q28 + +-- start query 1 in stream 0 using template ../query_templates/query28.tpl +select * +from (select avg(ss_list_price) B1_LP + ,count(ss_list_price) B1_CNT + ,count(distinct ss_list_price) B1_CNTD + from plato.store_sales + where ss_quantity between 0 and 5 + and (ss_list_price between 11::numeric and (11+10)::numeric + or ss_coupon_amt between 460::numeric and (460+1000)::numeric + or ss_wholesale_cost between 14::numeric and (14+20)::numeric)) B1, + (select avg(ss_list_price) B2_LP + ,count(ss_list_price) B2_CNT + ,count(distinct ss_list_price) B2_CNTD + from plato.store_sales + where ss_quantity between 6 and 10 + and (ss_list_price between 91::numeric and (91+10)::numeric + or ss_coupon_amt between 1430::numeric and (1430+1000)::numeric + or ss_wholesale_cost between 32::numeric and (32+20)::numeric)) B2, + (select avg(ss_list_price) B3_LP + ,count(ss_list_price) B3_CNT + ,count(distinct ss_list_price) B3_CNTD + from plato.store_sales + where ss_quantity between 11 and 15 + and (ss_list_price between 66::numeric and (66+10)::numeric + or ss_coupon_amt between 920::numeric and (920+1000)::numeric + or ss_wholesale_cost between 4::numeric and (4+20)::numeric)) B3, + (select avg(ss_list_price) B4_LP + ,count(ss_list_price) B4_CNT + ,count(distinct ss_list_price) B4_CNTD + from plato.store_sales + where ss_quantity between 16 and 20 + and (ss_list_price between 142::numeric and (142+10)::numeric + or ss_coupon_amt between 3054::numeric and (3054+1000)::numeric + or ss_wholesale_cost between 80::numeric and (80+20)::numeric)) B4, + (select avg(ss_list_price) B5_LP + ,count(ss_list_price) B5_CNT + ,count(distinct ss_list_price) B5_CNTD + from plato.store_sales + where ss_quantity between 21 and 25 + and (ss_list_price between 135::numeric and (135+10)::numeric + or ss_coupon_amt between 14180::numeric and (14180+1000)::numeric + or ss_wholesale_cost between 38::numeric and (38+20)::numeric)) B5, + (select avg(ss_list_price) B6_LP + ,count(ss_list_price) B6_CNT + ,count(distinct ss_list_price) B6_CNTD + from plato.store_sales + where ss_quantity between 26 and 30 + and (ss_list_price between 28::numeric and (28+10)::numeric + or ss_coupon_amt between 2513::numeric and (2513+1000)::numeric + or ss_wholesale_cost between 42::numeric and (42+20)::numeric)) B6 +limit 100; + +-- end query 1 in stream 0 using template ../query_templates/query28.tpl diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/q29.sql b/yql/essentials/tests/sql/suites/pg-tpcds/q29.sql new file mode 100644 index 0000000000..0b2bf6556b --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/q29.sql @@ -0,0 +1,50 @@ +--!syntax_pg +--TPC-DS Q29 + +-- start query 1 in stream 0 using template ../query_templates/query29.tpl +select + i_item_id + ,i_item_desc + ,s_store_id + ,s_store_name + ,sum(ss_quantity) as store_sales_quantity + ,sum(sr_return_quantity) as store_returns_quantity + ,sum(cs_quantity) as catalog_sales_quantity + from + plato.store_sales + ,plato.store_returns + ,plato.catalog_sales + ,plato.date_dim d1 + ,plato.date_dim d2 + ,plato.date_dim d3 + ,plato.store + ,plato.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; + +-- end query 1 in stream 0 using template ../query_templates/query29.tpl diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/q30.sql b/yql/essentials/tests/sql/suites/pg-tpcds/q30.sql new file mode 100644 index 0000000000..a1d3319069 --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/q30.sql @@ -0,0 +1,34 @@ +--!syntax_pg +--TPC-DS Q30 + +-- start query 1 in stream 0 using template ../query_templates/query30.tpl +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 plato.web_returns + ,plato.date_dim + ,plato.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,ctr_total_return + from customer_total_return ctr1 + ,plato.customer_address + ,plato.customer + where ctr1.ctr_total_return > (select avg(ctr_total_return)*1.2::numeric + from customer_total_return ctr2 + where ctr1.ctr_state = ctr2.ctr_state) + and ca_address_sk = c_current_addr_sk + and ca_state = 'IL' + 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,ctr_total_return +limit 100; + +-- end query 1 in stream 0 using template ../query_templates/query30.tpl diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/q31.sql b/yql/essentials/tests/sql/suites/pg-tpcds/q31.sql new file mode 100644 index 0000000000..7cc0cc6542 --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/q31.sql @@ -0,0 +1,55 @@ +--!syntax_pg +--TPC-DS Q31 + +-- start query 1 in stream 0 using template ../query_templates/query31.tpl +with ss as + (select ca_county,d_qoy, d_year,sum(ss_ext_sales_price) as store_sales + from plato.store_sales,plato.date_dim,plato.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 plato.web_sales,plato.date_dim,plato.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::numeric then ws2.web_sales/ws1.web_sales else null::numeric end + > case when ss1.store_sales > 0::numeric then ss2.store_sales/ss1.store_sales else null::numeric end + and case when ws2.web_sales > 0::numeric then ws3.web_sales/ws2.web_sales else null::numeric end + > case when ss2.store_sales > 0::numeric then ss3.store_sales/ss2.store_sales else null::numeric end + order by ss1.d_year; + +-- end query 1 in stream 0 using template ../query_templates/query31.tpl diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/q32.sql b/yql/essentials/tests/sql/suites/pg-tpcds/q32.sql new file mode 100644 index 0000000000..babfacba04 --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/q32.sql @@ -0,0 +1,31 @@ +--!syntax_pg +--TPC-DS Q32 + +-- start query 1 in stream 0 using template ../query_templates/query32.tpl +select sum(cs_ext_discount_amt) as "excess discount amount" +from + plato.catalog_sales + ,plato.item + ,plato.date_dim +where +i_manufact_id = 269 +and i_item_sk = cs_item_sk +and d_date between '1998-03-18'::date and + (cast('1998-03-18' as date) + interval '90' day)::date +and d_date_sk = cs_sold_date_sk +and cs_ext_discount_amt + > ( + select + 1.3::numeric * avg(cs_ext_discount_amt) + from + plato.catalog_sales + ,plato.date_dim + where + cs_item_sk = i_item_sk + and d_date between '1998-03-18'::date and + (cast('1998-03-18' as date) + interval '90' day)::date + and d_date_sk = cs_sold_date_sk + ) +limit 100; + +-- end query 1 in stream 0 using template ../query_templates/query32.tpl diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/q33.sql b/yql/essentials/tests/sql/suites/pg-tpcds/q33.sql new file mode 100644 index 0000000000..1fa71e6f9e --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/q33.sql @@ -0,0 +1,78 @@ +--!syntax_pg +--TPC-DS Q33 + +-- start query 1 in stream 0 using template ../query_templates/query33.tpl +with ss as ( + select + i_manufact_id,sum(ss_ext_sales_price) total_sales + from + plato.store_sales, + plato.date_dim, + plato.customer_address, + plato.item + where + i_manufact_id in (select + i_manufact_id +from + plato.item +where i_category in ('Books')) + and ss_item_sk = i_item_sk + and ss_sold_date_sk = d_date_sk + and d_year = 1999 + and d_moy = 3 + and ss_addr_sk = ca_address_sk + and ca_gmt_offset = -5::numeric + group by i_manufact_id), + cs as ( + select + i_manufact_id,sum(cs_ext_sales_price) total_sales + from + plato.catalog_sales, + plato.date_dim, + plato.customer_address, + plato.item + where + i_manufact_id in (select + i_manufact_id +from + plato.item +where i_category in ('Books')) + and cs_item_sk = i_item_sk + and cs_sold_date_sk = d_date_sk + and d_year = 1999 + and d_moy = 3 + and cs_bill_addr_sk = ca_address_sk + and ca_gmt_offset = -5::numeric + group by i_manufact_id), + ws as ( + select + i_manufact_id,sum(ws_ext_sales_price) total_sales + from + plato.web_sales, + plato.date_dim, + plato.customer_address, + plato.item + where + i_manufact_id in (select + i_manufact_id +from + plato.item +where i_category in ('Books')) + and ws_item_sk = i_item_sk + and ws_sold_date_sk = d_date_sk + and d_year = 1999 + and d_moy = 3 + and ws_bill_addr_sk = ca_address_sk + and ca_gmt_offset = -5::numeric + group by i_manufact_id) + select i_manufact_id ,sum(total_sales) total_sales + from (select * from ss + union all + select * from cs + union all + select * from ws) tmp1 + group by i_manufact_id + order by total_sales +limit 100; + +-- end query 1 in stream 0 using template ../query_templates/query33.tpl diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/q34.sql b/yql/essentials/tests/sql/suites/pg-tpcds/q34.sql new file mode 100644 index 0000000000..c00f60c79f --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/q34.sql @@ -0,0 +1,34 @@ +--!syntax_pg +--TPC-DS Q34 + +-- start query 1 in stream 0 using template ../query_templates/query34.tpl +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 plato.store_sales,plato.date_dim,plato.store,plato.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 = '>10000' 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::int4 + end)::float8 > 1.2::float8 + and date_dim.d_year in (1998,1998+1,1998+2) + and store.s_county in ('Williamson County','Williamson County','Williamson County','Williamson County', + 'Williamson County','Williamson County','Williamson County','Williamson County') + group by ss_ticket_number,ss_customer_sk) dn,plato.customer + where ss_customer_sk = c_customer_sk + and cnt between 15::int8 and 20::int8 + order by c_last_name,c_first_name,c_salutation,c_preferred_cust_flag desc, ss_ticket_number; + +-- end query 1 in stream 0 using template ../query_templates/query34.tpl diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/q35.sql b/yql/essentials/tests/sql/suites/pg-tpcds/q35.sql new file mode 100644 index 0000000000..4177175164 --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/q35.sql @@ -0,0 +1,61 @@ +--!syntax_pg +--TPC-DS Q35 + +-- start query 1 in stream 0 using template ../query_templates/query35.tpl +select + ca_state, + cd_gender, + cd_marital_status, + cd_dep_count, + count(*) cnt1, + avg(cd_dep_count) a1, + max(cd_dep_count) x1, + sum(cd_dep_count) s1, + cd_dep_employed_count, + count(*) cnt2, + avg(cd_dep_employed_count) a2, + max(cd_dep_employed_count) x2, + sum(cd_dep_employed_count) s2, + cd_dep_college_count, + count(*) cnt3, + avg(cd_dep_college_count) a3, + max(cd_dep_college_count) x3, + sum(cd_dep_college_count) s3 + from + plato.customer c,plato.customer_address ca,plato.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 plato.store_sales,plato.date_dim + where c.c_customer_sk = ss_customer_sk and + ss_sold_date_sk = d_date_sk and + d_year = 1999 and + d_qoy < 4) and + (exists (select * + from plato.web_sales,plato.date_dim + where c.c_customer_sk = ws_bill_customer_sk and + ws_sold_date_sk = d_date_sk and + d_year = 1999 and + d_qoy < 4) or + exists (select * + from plato.catalog_sales,plato.date_dim + where c.c_customer_sk = cs_ship_customer_sk and + cs_sold_date_sk = d_date_sk and + d_year = 1999 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; + +-- end query 1 in stream 0 using template ../query_templates/query35.tpl diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/q36.sql b/yql/essentials/tests/sql/suites/pg-tpcds/q36.sql new file mode 100644 index 0000000000..fe38dc7e86 --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/q36.sql @@ -0,0 +1,33 @@ +--!syntax_pg +--TPC-DS Q36 + +-- start query 1 in stream 0 using template ../query_templates/query36.tpl +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 + plato.store_sales + ,plato.date_dim d1 + ,plato.item + ,plato.store + where + 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 s_state in ('TN','TN','TN','TN', + 'TN','TN','TN','TN') + group by rollup(i_category,i_class) + order by + lochierarchy desc + ,case when lochierarchy = 0 then i_category end + ,rank_within_parent + limit 100; + +-- end query 1 in stream 0 using template ../query_templates/query36.tpl diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/q37.sql b/yql/essentials/tests/sql/suites/pg-tpcds/q37.sql new file mode 100644 index 0000000000..285325bfae --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/q37.sql @@ -0,0 +1,20 @@ +--!syntax_pg +--TPC-DS Q37 + +-- start query 1 in stream 0 using template ../query_templates/query37.tpl +select i_item_id + ,i_item_desc + ,i_current_price + from plato.item, plato.inventory, plato.date_dim, plato.catalog_sales + where i_current_price between 22::numeric and (22 + 30)::numeric + and inv_item_sk = i_item_sk + and d_date_sk=inv_date_sk + and d_date between cast('2001-06-02' as date) and (cast('2001-06-02' as date) + interval '60' day)::date + and i_manufact_id in (678,964,918,849) + 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; + +-- end query 1 in stream 0 using template ../query_templates/query37.tpl diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/q38.sql b/yql/essentials/tests/sql/suites/pg-tpcds/q38.sql new file mode 100644 index 0000000000..f27da36e41 --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/q38.sql @@ -0,0 +1,26 @@ +--!syntax_pg +--TPC-DS Q38 + +-- start query 1 in stream 0 using template ../query_templates/query38.tpl +select count(*) from ( + select distinct c_last_name, c_first_name, d_date + from plato.store_sales, plato.date_dim, plato.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 1212 and 1212 + 11 + intersect + select distinct c_last_name, c_first_name, d_date + from plato.catalog_sales, plato.date_dim, plato.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 1212 and 1212 + 11 + intersect + select distinct c_last_name, c_first_name, d_date + from plato.web_sales, plato.date_dim, plato.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 1212 and 1212 + 11 +) hot_cust +limit 100; + +-- end query 1 in stream 0 using template ../query_templates/query38.tpl diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/q39.sql b/yql/essentials/tests/sql/suites/pg-tpcds/q39.sql new file mode 100644 index 0000000000..c877082142 --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/q39.sql @@ -0,0 +1,57 @@ +--!syntax_pg +--TPC-DS Q39 + +-- start query 1 in stream 0 using template ../query_templates/query39.tpl +with inv as +(select w_warehouse_name,w_warehouse_sk,i_item_sk,d_moy + ,stdev,mean, case mean when 0::numeric then null::numeric 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 plato.inventory + ,plato.item + ,plato.warehouse + ,plato.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::numeric then 0::numeric else stdev/mean end > 1::numeric) +select inv1.w_warehouse_sk as inv1_w_warehouse_sk,inv1.i_item_sk as inv1_i_item_sk,inv1.d_moy as inv1_d_moy,inv1.mean as inv1_mean, inv1.cov as inv1_cov + ,inv2.w_warehouse_sk as inv2_w_warehouse_sk,inv2.i_item_sk as inv2_i_item_sk,inv2.d_moy as inv2_d_moy,inv2.mean as inv2_mean, inv2.cov as 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=4 + and inv2.d_moy=4+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::numeric then null::numeric 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 plato.inventory + ,plato.item + ,plato.warehouse + ,plato.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::numeric then 0::numeric else stdev/mean end > 1::numeric) +select inv1.w_warehouse_sk as inv1_w_warehouse_sk,inv1.i_item_sk as inv1_i_item_sk,inv1.d_moy as inv1_d_moy,inv1.mean as inv1_mean, inv1.cov as inv1_cov + ,inv2.w_warehouse_sk as inv2_w_warehouse_sk,inv2.i_item_sk as inv2_i_item_sk,inv2.d_moy as inv2_d_moy,inv2.mean as inv2_mean, inv2.cov as 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=4 + and inv2.d_moy=4+1 + and inv1.cov > 1.5::numeric +order by inv1_w_warehouse_sk,inv1_i_item_sk,inv1_d_moy,inv1_mean,inv1_cov + ,inv2_d_moy,inv2_mean, inv2_cov +; + +-- end query 1 in stream 0 using template ../query_templates/query39.tpl diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/q40.sql b/yql/essentials/tests/sql/suites/pg-tpcds/q40.sql new file mode 100644 index 0000000000..f7249d21c4 --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/q40.sql @@ -0,0 +1,31 @@ +--!syntax_pg +--TPC-DS Q40 + +-- start query 1 in stream 0 using template ../query_templates/query40.tpl +select + w_state + ,i_item_id + ,sum(case when (cast(d_date as date) < cast ('1998-04-08' as date)) + then cs_sales_price - coalesce(cr_refunded_cash,0::numeric) else 0::numeric end) as sales_before + ,sum(case when (cast(d_date as date) >= cast ('1998-04-08' as date)) + then cs_sales_price - coalesce(cr_refunded_cash,0::numeric) else 0::numeric end) as sales_after + from + plato.catalog_sales left outer join plato.catalog_returns on + (cs_order_number = cr_order_number + and cs_item_sk = cr_item_sk) + ,plato.warehouse + ,plato.item + ,plato.date_dim + where + i_current_price between 0.99::numeric and 1.49::numeric + 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 ('1998-04-08' as date) - interval '30' day)::date + and (cast ('1998-04-08' as date) + interval '30' day)::date + group by + w_state,i_item_id + order by w_state,i_item_id +limit 100; + +-- end query 1 in stream 0 using template ../query_templates/query40.tpl diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/q41.sql b/yql/essentials/tests/sql/suites/pg-tpcds/q41.sql new file mode 100644 index 0000000000..6b79d610f1 --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/q41.sql @@ -0,0 +1,55 @@ +--!syntax_pg +--TPC-DS Q41 + +-- start query 1 in stream 0 using template ../query_templates/query41.tpl +select distinct(i_product_name) + from plato.item i1 + where i_manufact_id between 742 and 742+40 + and (select count(*) as item_cnt + from plato.item + where (i_manufact = i1.i_manufact and + ((i_category = 'Women' and + (i_color = 'orchid' or i_color = 'papaya') and + (i_units = 'Pound' or i_units = 'Lb') and + (i_size = 'petite' or i_size = 'medium') + ) or + (i_category = 'Women' and + (i_color = 'burlywood' or i_color = 'navy') and + (i_units = 'Bundle' or i_units = 'Each') and + (i_size = 'N/A' or i_size = 'extra large') + ) or + (i_category = 'Men' and + (i_color = 'bisque' or i_color = 'azure') and + (i_units = 'N/A' or i_units = 'Tsp') and + (i_size = 'small' or i_size = 'large') + ) or + (i_category = 'Men' and + (i_color = 'chocolate' or i_color = 'cornflower') and + (i_units = 'Bunch' or i_units = 'Gross') and + (i_size = 'petite' or i_size = 'medium') + ))) or + (i_manufact = i1.i_manufact and + ((i_category = 'Women' and + (i_color = 'salmon' or i_color = 'midnight') and + (i_units = 'Oz' or i_units = 'Box') and + (i_size = 'petite' or i_size = 'medium') + ) or + (i_category = 'Women' and + (i_color = 'snow' or i_color = 'steel') and + (i_units = 'Carton' or i_units = 'Tbl') and + (i_size = 'N/A' or i_size = 'extra large') + ) or + (i_category = 'Men' and + (i_color = 'purple' or i_color = 'gainsboro') and + (i_units = 'Dram' or i_units = 'Unknown') and + (i_size = 'small' or i_size = 'large') + ) or + (i_category = 'Men' and + (i_color = 'metallic' or i_color = 'forest') and + (i_units = 'Gram' or i_units = 'Ounce') and + (i_size = 'petite' or i_size = 'medium') + )))) > 0 + order by i_product_name + limit 100; + +-- end query 1 in stream 0 using template ../query_templates/query41.tpl diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/q42.sql b/yql/essentials/tests/sql/suites/pg-tpcds/q42.sql new file mode 100644 index 0000000000..a8fed2fb3a --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/q42.sql @@ -0,0 +1,25 @@ +--!syntax_pg +--TPC-DS Q42 + +-- start query 1 in stream 0 using template ../query_templates/query42.tpl +select dt.d_year + ,item.i_category_id + ,item.i_category + ,sum(ss_ext_sales_price) + from plato.date_dim dt + ,plato.store_sales + ,plato.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=1998 + 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 ; + +-- end query 1 in stream 0 using template ../query_templates/query42.tpl diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/q43.sql b/yql/essentials/tests/sql/suites/pg-tpcds/q43.sql new file mode 100644 index 0000000000..a2adaad63a --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/q43.sql @@ -0,0 +1,22 @@ +--!syntax_pg +--TPC-DS Q43 + +-- start query 1 in stream 0 using template ../query_templates/query43.tpl +select s_store_name, s_store_id, + sum(case when (d_day_name='Sunday') then ss_sales_price else null::numeric end) sun_sales, + sum(case when (d_day_name='Monday') then ss_sales_price else null::numeric end) mon_sales, + sum(case when (d_day_name='Tuesday') then ss_sales_price else null::numeric end) tue_sales, + sum(case when (d_day_name='Wednesday') then ss_sales_price else null::numeric end) wed_sales, + sum(case when (d_day_name='Thursday') then ss_sales_price else null::numeric end) thu_sales, + sum(case when (d_day_name='Friday') then ss_sales_price else null::numeric end) fri_sales, + sum(case when (d_day_name='Saturday') then ss_sales_price else null::numeric end) sat_sales + from plato.date_dim, plato.store_sales, plato.store + where d_date_sk = ss_sold_date_sk and + s_store_sk = ss_store_sk and + s_gmt_offset = -5::numeric and + d_year = 1998 + 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; + +-- end query 1 in stream 0 using template ../query_templates/query43.tpl diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/q44.sql b/yql/essentials/tests/sql/suites/pg-tpcds/q44.sql new file mode 100644 index 0000000000..cf5a5fd9fb --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/q44.sql @@ -0,0 +1,38 @@ +--!syntax_pg +--TPC-DS Q44 + +-- start query 1 in stream 0 using template ../query_templates/query44.tpl +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 plato.store_sales ss1 + where ss_store_sk = 2 + group by ss_item_sk + having avg(ss_net_profit) > 0.9::numeric*(select avg(ss_net_profit) rank_col + from plato.store_sales + where ss_store_sk = 2 + and ss_hdemo_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 plato.store_sales ss1 + where ss_store_sk = 2 + group by ss_item_sk + having avg(ss_net_profit) > 0.9::numeric*(select avg(ss_net_profit) rank_col + from plato.store_sales + where ss_store_sk = 2 + and ss_hdemo_sk is null + group by ss_store_sk))V2)V21 + where rnk < 11) descending, +plato.item i1, +plato.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; + +-- end query 1 in stream 0 using template ../query_templates/query44.tpl diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/q45.sql b/yql/essentials/tests/sql/suites/pg-tpcds/q45.sql new file mode 100644 index 0000000000..0e8df9be19 --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/q45.sql @@ -0,0 +1,23 @@ +--!syntax_pg +--TPC-DS Q45 + +-- start query 1 in stream 0 using template ../query_templates/query45.tpl +select ca_zip, ca_county, sum(ws_sales_price) + from plato.web_sales, plato.customer, plato.customer_address, plato.date_dim, plato.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 plato.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_county + order by ca_zip, ca_county + limit 100; + +-- end query 1 in stream 0 using template ../query_templates/query45.tpl diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/q46.sql b/yql/essentials/tests/sql/suites/pg-tpcds/q46.sql new file mode 100644 index 0000000000..27c2b14727 --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/q46.sql @@ -0,0 +1,38 @@ +--!syntax_pg +--TPC-DS Q46 + +-- start query 1 in stream 0 using template ../query_templates/query46.tpl +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 plato.store_sales,plato.date_dim,plato.store,plato.household_demographics,plato.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 = 5 or + household_demographics.hd_vehicle_count= 3) + and date_dim.d_dow in (6,0) + and date_dim.d_year in (1999,1999+1,1999+2) + and store.s_city in ('Midway','Fairview','Fairview','Midway','Fairview') + group by ss_ticket_number,ss_customer_sk,ss_addr_sk,ca_city) dn,plato.customer,plato.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; + +-- end query 1 in stream 0 using template ../query_templates/query46.tpl diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/q47.sql b/yql/essentials/tests/sql/suites/pg-tpcds/q47.sql new file mode 100644 index 0000000000..126f80e1eb --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/q47.sql @@ -0,0 +1,54 @@ +--!syntax_pg +--TPC-DS Q47 + +-- start query 1 in stream 0 using template ../query_templates/query47.tpl +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 plato.item, plato.store_sales, plato.date_dim, plato.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 = 2000 or + ( d_year = 2000-1 and d_moy =12) or + ( d_year = 2000+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.i_category, v1.i_brand + ,v1.d_year, v1.d_moy + ,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 = 2000 and + avg_monthly_sales > 0::numeric and + case when avg_monthly_sales > 0::numeric then abs(sum_sales - avg_monthly_sales) / avg_monthly_sales else null::numeric end > 0.1::numeric + order by sum_sales - avg_monthly_sales, nsum + limit 100; + +-- end query 1 in stream 0 using template ../query_templates/query47.tpl diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/q48.sql b/yql/essentials/tests/sql/suites/pg-tpcds/q48.sql new file mode 100644 index 0000000000..43155a852e --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/q48.sql @@ -0,0 +1,70 @@ +--!syntax_pg +--TPC-DS Q48 + +-- start query 1 in stream 0 using template ../query_templates/query48.tpl +select sum (ss_quantity) + from plato.store_sales, plato.store, plato.customer_demographics, plato.customer_address, plato.date_dim + where s_store_sk = ss_store_sk + and ss_sold_date_sk = d_date_sk and d_year = 1998 + and + ( + ( + cd_demo_sk = ss_cdemo_sk + and + cd_marital_status = 'M' + and + cd_education_status = '4 yr Degree' + and + ss_sales_price between 100.00::numeric and 150.00::numeric + ) + or + ( + cd_demo_sk = ss_cdemo_sk + and + cd_marital_status = 'D' + and + cd_education_status = 'Primary' + and + ss_sales_price between 50.00::numeric and 100.00::numeric + ) + or + ( + cd_demo_sk = ss_cdemo_sk + and + cd_marital_status = 'U' + and + cd_education_status = 'Advanced Degree' + and + ss_sales_price between 150.00::numeric and 200.00::numeric + ) + ) + and + ( + ( + ss_addr_sk = ca_address_sk + and + ca_country = 'United States' + and + ca_state in ('KY', 'GA', 'NM') + and ss_net_profit between 0::numeric and 2000::numeric + ) + or + (ss_addr_sk = ca_address_sk + and + ca_country = 'United States' + and + ca_state in ('MT', 'OR', 'IN') + and ss_net_profit between 150::numeric and 3000::numeric + ) + or + (ss_addr_sk = ca_address_sk + and + ca_country = 'United States' + and + ca_state in ('WI', 'MO', 'WV') + and ss_net_profit between 50::numeric and 25000::numeric + ) + ) +; + +-- end query 1 in stream 0 using template ../query_templates/query48.tpl diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/q49.sql b/yql/essentials/tests/sql/suites/pg-tpcds/q49.sql new file mode 100644 index 0000000000..62fa592b2b --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/q49.sql @@ -0,0 +1,132 @@ +--!syntax_pg +--TPC-DS Q49 + +-- start query 1 in stream 0 using template ../query_templates/query49.tpl +select channel, item, return_ratio, return_rank, currency_rank from + (select + 'web' as channel + ,web.item + ,web.return_ratio + ,web.return_rank + ,web.currency_rank + from ( + select + item + ,return_ratio + ,currency_ratio + ,rank() over (order by return_ratio) as return_rank + ,rank() over (order by currency_ratio) as currency_rank + from + ( select ws.ws_item_sk as item + ,(cast(sum(coalesce(wr.wr_return_quantity,0)) as decimal(15,4))/ + cast(sum(coalesce(ws.ws_quantity,0)) as decimal(15,4) )) as return_ratio + ,(cast(sum(coalesce(wr.wr_return_amt,0::numeric)) as decimal(15,4))/ + cast(sum(coalesce(ws.ws_net_paid,0::numeric)) as decimal(15,4) )) as currency_ratio + from + plato.web_sales ws left outer join plato.web_returns wr + on (ws.ws_order_number = wr.wr_order_number and + ws.ws_item_sk = wr.wr_item_sk) + ,plato.date_dim + where + wr.wr_return_amt > 10000::numeric + and ws.ws_net_profit > 1::numeric + and ws.ws_net_paid > 0::numeric + and ws.ws_quantity > 0 + and ws_sold_date_sk = d_date_sk + and d_year = 2000 + and d_moy = 12 + group by ws.ws_item_sk + ) in_web + ) web + where + ( + web.return_rank <= 10 + or + web.currency_rank <= 10 + ) + union + select + 'catalog' as channel + ,catalog.item + ,catalog.return_ratio + ,catalog.return_rank + ,catalog.currency_rank + from ( + select + item + ,return_ratio + ,currency_ratio + ,rank() over (order by return_ratio) as return_rank + ,rank() over (order by currency_ratio) as currency_rank + from + ( select + cs.cs_item_sk as item + ,(cast(sum(coalesce(cr.cr_return_quantity,0)) as decimal(15,4))/ + cast(sum(coalesce(cs.cs_quantity,0)) as decimal(15,4) )) as return_ratio + ,(cast(sum(coalesce(cr.cr_return_amount,0::numeric)) as decimal(15,4))/ + cast(sum(coalesce(cs.cs_net_paid,0::numeric)) as decimal(15,4) )) as currency_ratio + from + plato.catalog_sales cs left outer join plato.catalog_returns cr + on (cs.cs_order_number = cr.cr_order_number and + cs.cs_item_sk = cr.cr_item_sk) + ,plato.date_dim + where + cr.cr_return_amount > 10000::numeric + and cs.cs_net_profit > 1::numeric + and cs.cs_net_paid > 0::numeric + and cs.cs_quantity > 0 + and cs_sold_date_sk = d_date_sk + and d_year = 2000 + and d_moy = 12 + group by cs.cs_item_sk + ) in_cat + ) catalog + where + ( + catalog.return_rank <= 10 + or + catalog.currency_rank <=10 + ) + union + select + 'store' as channel + ,store.item + ,store.return_ratio + ,store.return_rank + ,store.currency_rank + from ( + select + item + ,return_ratio + ,currency_ratio + ,rank() over (order by return_ratio) as return_rank + ,rank() over (order by currency_ratio) as currency_rank + from + ( select sts.ss_item_sk as item + ,(cast(sum(coalesce(sr.sr_return_quantity,0)) as decimal(15,4))/cast(sum(coalesce(sts.ss_quantity,0)) as decimal(15,4) )) as return_ratio + ,(cast(sum(coalesce(sr.sr_return_amt,0::numeric)) as decimal(15,4))/cast(sum(coalesce(sts.ss_net_paid,0::numeric)) as decimal(15,4) )) as currency_ratio + from + plato.store_sales sts left outer join plato.store_returns sr + on (sts.ss_ticket_number = sr.sr_ticket_number and sts.ss_item_sk = sr.sr_item_sk) + ,plato.date_dim + where + sr.sr_return_amt > 10000::numeric + and sts.ss_net_profit > 1::numeric + and sts.ss_net_paid > 0::numeric + and sts.ss_quantity > 0 + and ss_sold_date_sk = d_date_sk + and d_year = 2000 + and d_moy = 12 + group by sts.ss_item_sk + ) in_store + ) store + where ( + store.return_rank <= 10 + or + store.currency_rank <= 10 + ) + ) a + order by 1,4,5,2 + limit 100; + +-- end query 1 in stream 0 using template ../query_templates/query49.tpl diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/q50.sql b/yql/essentials/tests/sql/suites/pg-tpcds/q50.sql new file mode 100644 index 0000000000..967a684157 --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/q50.sql @@ -0,0 +1,62 @@ +--!syntax_pg +--TPC-DS Q50 + +-- start query 1 in stream 0 using template ../query_templates/query50.tpl +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 + plato.store_sales + ,plato.store_returns + ,plato.store + ,plato.date_dim d1 + ,plato.date_dim d2 +where + d2.d_year = 2000 +and d2.d_moy = 9 +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; + +-- end query 1 in stream 0 using template ../query_templates/query50.tpl diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/q51.sql b/yql/essentials/tests/sql/suites/pg-tpcds/q51.sql new file mode 100644 index 0000000000..07e822bb3a --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/q51.sql @@ -0,0 +1,48 @@ +--!syntax_pg +--TPC-DS Q51 + +-- start query 1 in stream 0 using template ../query_templates/query51.tpl +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 plato.web_sales + ,plato.date_dim +where ws_sold_date_sk=d_date_sk + and d_month_seq between 1212 and 1212+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 plato.store_sales + ,plato.date_dim +where ss_sold_date_sk=d_date_sk + and d_month_seq between 1212 and 1212+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; + +-- end query 1 in stream 0 using template ../query_templates/query51.tpl diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/q52.sql b/yql/essentials/tests/sql/suites/pg-tpcds/q52.sql new file mode 100644 index 0000000000..e49b9b8142 --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/q52.sql @@ -0,0 +1,25 @@ +--!syntax_pg +--TPC-DS Q52 + +-- start query 1 in stream 0 using template ../query_templates/query52.tpl +select dt.d_year + ,item.i_brand_id brand_id + ,item.i_brand brand + ,sum(ss_ext_sales_price) ext_price + from plato.date_dim dt + ,plato.store_sales + ,plato.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=1998 + group by dt.d_year + ,item.i_brand + ,item.i_brand_id + order by dt.d_year + ,ext_price desc + ,brand_id +limit 100 ; + +-- end query 1 in stream 0 using template ../query_templates/query52.tpl diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/q53.sql b/yql/essentials/tests/sql/suites/pg-tpcds/q53.sql new file mode 100644 index 0000000000..bb9c25ce72 --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/q53.sql @@ -0,0 +1,31 @@ +--!syntax_pg +--TPC-DS Q53 + +-- start query 1 in stream 0 using template ../query_templates/query53.tpl +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 plato.item, plato.store_sales, plato.date_dim, plato.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 (1212,1212+1,1212+2,1212+3,1212+4,1212+5,1212+6,1212+7,1212+8,1212+9,1212+10,1212+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::numeric + then abs (sum_sales - avg_quarterly_sales)/ avg_quarterly_sales + else null::numeric end > 0.1::numeric +order by avg_quarterly_sales, + sum_sales, + i_manufact_id +limit 100; + +-- end query 1 in stream 0 using template ../query_templates/query53.tpl diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/q54.sql b/yql/essentials/tests/sql/suites/pg-tpcds/q54.sql new file mode 100644 index 0000000000..2396c50fe9 --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/q54.sql @@ -0,0 +1,59 @@ +--!syntax_pg +--TPC-DS Q54 + +-- start query 1 in stream 0 using template ../query_templates/query54.tpl +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 plato.catalog_sales + union all + select ws_sold_date_sk sold_date_sk, + ws_bill_customer_sk customer_sk, + ws_item_sk item_sk + from plato.web_sales + ) cs_or_ws_sales, + plato.item, + plato.date_dim, + plato.customer + where sold_date_sk = d_date_sk + and item_sk = i_item_sk + and i_category = 'Jewelry' + and i_class = 'consignment' + and c_customer_sk = cs_or_ws_sales.customer_sk + and d_moy = 3 + and d_year = 1999 + ) + , my_revenue as ( + select c_customer_sk, + sum(ss_ext_sales_price) as revenue + from my_customers, + plato.store_sales, + plato.customer_address, + plato.store, + plato.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 plato.date_dim where d_year = 1999 and d_moy = 3) + and (select distinct d_month_seq+3 + from plato.date_dim where d_year = 1999 and d_moy = 3) + group by c_customer_sk + ) + , segments as + (select cast((revenue/50::numeric) 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; + +-- end query 1 in stream 0 using template ../query_templates/query54.tpl diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/q55.sql b/yql/essentials/tests/sql/suites/pg-tpcds/q55.sql new file mode 100644 index 0000000000..3f42cc3c82 --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/q55.sql @@ -0,0 +1,17 @@ +--!syntax_pg +--TPC-DS Q55 + +-- start query 1 in stream 0 using template ../query_templates/query55.tpl +select i_brand_id brand_id, i_brand brand, + sum(ss_ext_sales_price) ext_price + from plato.date_dim, plato.store_sales, plato.item + where d_date_sk = ss_sold_date_sk + and ss_item_sk = i_item_sk + and i_manager_id=36 + and d_moy=12 + and d_year=2001 + group by i_brand, i_brand_id + order by ext_price desc, i_brand_id +limit 100 ; + +-- end query 1 in stream 0 using template ../query_templates/query55.tpl diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/q56.sql b/yql/essentials/tests/sql/suites/pg-tpcds/q56.sql new file mode 100644 index 0000000000..8f6b72b284 --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/q56.sql @@ -0,0 +1,72 @@ +--!syntax_pg +--TPC-DS Q56 + +-- start query 1 in stream 0 using template ../query_templates/query56.tpl +with ss as ( + select i_item_id,sum(ss_ext_sales_price) total_sales + from + plato.store_sales, + plato.date_dim, + plato.customer_address, + plato.item + where i_item_id in (select + i_item_id +from plato.item +where i_color in ('orchid','chiffon','lace')) + and ss_item_sk = i_item_sk + and ss_sold_date_sk = d_date_sk + and d_year = 2000 + and d_moy = 1 + and ss_addr_sk = ca_address_sk + and ca_gmt_offset = -8::numeric + group by i_item_id), + cs as ( + select i_item_id,sum(cs_ext_sales_price) total_sales + from + plato.catalog_sales, + plato.date_dim, + plato.customer_address, + plato.item + where + i_item_id in (select + i_item_id +from plato.item +where i_color in ('orchid','chiffon','lace')) + and cs_item_sk = i_item_sk + and cs_sold_date_sk = d_date_sk + and d_year = 2000 + and d_moy = 1 + and cs_bill_addr_sk = ca_address_sk + and ca_gmt_offset = -8::numeric + group by i_item_id), + ws as ( + select i_item_id,sum(ws_ext_sales_price) total_sales + from + plato.web_sales, + plato.date_dim, + plato.customer_address, + plato.item + where + i_item_id in (select + i_item_id +from plato.item +where i_color in ('orchid','chiffon','lace')) + and ws_item_sk = i_item_sk + and ws_sold_date_sk = d_date_sk + and d_year = 2000 + and d_moy = 1 + and ws_bill_addr_sk = ca_address_sk + and ca_gmt_offset = -8::numeric + group by i_item_id) + select i_item_id ,sum(total_sales) total_sales + from (select * from ss + union all + select * from cs + union all + select * from ws) tmp1 + group by i_item_id + order by total_sales, + i_item_id + limit 100; + +-- end query 1 in stream 0 using template ../query_templates/query56.tpl diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/q57.sql b/yql/essentials/tests/sql/suites/pg-tpcds/q57.sql new file mode 100644 index 0000000000..29d1e9ee12 --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/q57.sql @@ -0,0 +1,51 @@ +--!syntax_pg +--TPC-DS Q57 + +-- start query 1 in stream 0 using template ../query_templates/query57.tpl +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 plato.item, plato.catalog_sales, plato.date_dim, plato.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 = 2000 or + ( d_year = 2000-1 and d_moy =12) or + ( d_year = 2000+1 and d_moy =1) + ) + group by i_category, i_brand, + cc_name , d_year, d_moy), + v2 as( + select v1.cc_name + ,v1.d_year, v1.d_moy + ,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 = 2000 and + avg_monthly_sales > 0::numeric and + case when avg_monthly_sales > 0::numeric then abs(sum_sales - avg_monthly_sales) / avg_monthly_sales else null::numeric end > 0.1::numeric + order by sum_sales - avg_monthly_sales, nsum + limit 100; + +-- end query 1 in stream 0 using template ../query_templates/query57.tpl diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/q58.sql b/yql/essentials/tests/sql/suites/pg-tpcds/q58.sql new file mode 100644 index 0000000000..5dd8e6aa22 --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/q58.sql @@ -0,0 +1,68 @@ +--!syntax_pg +--TPC-DS Q58 + +-- start query 1 in stream 0 using template ../query_templates/query58.tpl +with ss_items as + (select i_item_id item_id + ,sum(ss_ext_sales_price) ss_item_rev + from plato.store_sales + ,plato.item + ,plato.date_dim + where ss_item_sk = i_item_sk + and d_date in (select d_date + from plato.date_dim + where d_week_seq = (select d_week_seq + from plato.date_dim + where d_date = '1998-02-19'::date)) + and ss_sold_date_sk = d_date_sk + group by i_item_id), + cs_items as + (select i_item_id item_id + ,sum(cs_ext_sales_price) cs_item_rev + from plato.catalog_sales + ,plato.item + ,plato.date_dim + where cs_item_sk = i_item_sk + and d_date in (select d_date + from plato.date_dim + where d_week_seq = (select d_week_seq + from plato.date_dim + where d_date = '1998-02-19'::date)) + and cs_sold_date_sk = d_date_sk + group by i_item_id), + ws_items as + (select i_item_id item_id + ,sum(ws_ext_sales_price) ws_item_rev + from plato.web_sales + ,plato.item + ,plato.date_dim + where ws_item_sk = i_item_sk + and d_date in (select d_date + from plato.date_dim + where d_week_seq =(select d_week_seq + from plato.date_dim + where d_date = '1998-02-19'::date)) + and ws_sold_date_sk = d_date_sk + group by i_item_id) + select ss_items.item_id + ,ss_item_rev + ,ss_item_rev/((ss_item_rev+cs_item_rev+ws_item_rev)/3::numeric) * 100::numeric ss_dev + ,cs_item_rev + ,cs_item_rev/((ss_item_rev+cs_item_rev+ws_item_rev)/3::numeric) * 100::numeric cs_dev + ,ws_item_rev + ,ws_item_rev/((ss_item_rev+cs_item_rev+ws_item_rev)/3::numeric) * 100::numeric ws_dev + ,(ss_item_rev+cs_item_rev+ws_item_rev)/3::numeric average + from ss_items,cs_items,ws_items + where ss_items.item_id=cs_items.item_id + and ss_items.item_id=ws_items.item_id + and ss_item_rev between 0.9::numeric * cs_item_rev and 1.1::numeric * cs_item_rev + and ss_item_rev between 0.9::numeric * ws_item_rev and 1.1::numeric * ws_item_rev + and cs_item_rev between 0.9::numeric * ss_item_rev and 1.1::numeric * ss_item_rev + and cs_item_rev between 0.9::numeric * ws_item_rev and 1.1::numeric * ws_item_rev + and ws_item_rev between 0.9::numeric * ss_item_rev and 1.1::numeric * ss_item_rev + and ws_item_rev between 0.9::numeric * cs_item_rev and 1.1::numeric * cs_item_rev + order by item_id + ,ss_item_rev + limit 100; + +-- end query 1 in stream 0 using template ../query_templates/query58.tpl diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/q59.sql b/yql/essentials/tests/sql/suites/pg-tpcds/q59.sql new file mode 100644 index 0000000000..7d16a9aec8 --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/q59.sql @@ -0,0 +1,47 @@ +--!syntax_pg +--TPC-DS Q59 + +-- start query 1 in stream 0 using template ../query_templates/query59.tpl +with wss as + (select d_week_seq, + ss_store_sk, + sum(case when (d_day_name='Sunday') then ss_sales_price else null::numeric end) sun_sales, + sum(case when (d_day_name='Monday') then ss_sales_price else null::numeric end) mon_sales, + sum(case when (d_day_name='Tuesday') then ss_sales_price else null::numeric end) tue_sales, + sum(case when (d_day_name='Wednesday') then ss_sales_price else null::numeric end) wed_sales, + sum(case when (d_day_name='Thursday') then ss_sales_price else null::numeric end) thu_sales, + sum(case when (d_day_name='Friday') then ss_sales_price else null::numeric end) fri_sales, + sum(case when (d_day_name='Saturday') then ss_sales_price else null::numeric end) sat_sales + from plato.store_sales,plato.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,plato.store,plato.date_dim d + where d.d_week_seq = wss.d_week_seq and + ss_store_sk = s_store_sk and + d_month_seq between 1185 and 1185 + 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,plato.store,plato.date_dim d + where d.d_week_seq = wss.d_week_seq and + ss_store_sk = s_store_sk and + d_month_seq between 1185+ 12 and 1185 + 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; + +-- end query 1 in stream 0 using template ../query_templates/query59.tpl diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/q60.sql b/yql/essentials/tests/sql/suites/pg-tpcds/q60.sql new file mode 100644 index 0000000000..e8913a839c --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/q60.sql @@ -0,0 +1,81 @@ +--!syntax_pg +--TPC-DS Q60 + +-- start query 1 in stream 0 using template ../query_templates/query60.tpl +with ss as ( + select + i_item_id,sum(ss_ext_sales_price) total_sales + from + plato.store_sales, + plato.date_dim, + plato.customer_address, + plato.item + where + i_item_id in (select + i_item_id +from + plato.item +where i_category in ('Children')) + and ss_item_sk = i_item_sk + and ss_sold_date_sk = d_date_sk + and d_year = 1999 + and d_moy = 9 + and ss_addr_sk = ca_address_sk + and ca_gmt_offset = -6::numeric + group by i_item_id), + cs as ( + select + i_item_id,sum(cs_ext_sales_price) total_sales + from + plato.catalog_sales, + plato.date_dim, + plato.customer_address, + plato.item + where + i_item_id in (select + i_item_id +from + plato.item +where i_category in ('Children')) + and cs_item_sk = i_item_sk + and cs_sold_date_sk = d_date_sk + and d_year = 1999 + and d_moy = 9 + and cs_bill_addr_sk = ca_address_sk + and ca_gmt_offset = -6::numeric + group by i_item_id), + ws as ( + select + i_item_id,sum(ws_ext_sales_price) total_sales + from + plato.web_sales, + plato.date_dim, + plato.customer_address, + plato.item + where + i_item_id in (select + i_item_id +from + plato.item +where i_category in ('Children')) + and ws_item_sk = i_item_sk + and ws_sold_date_sk = d_date_sk + and d_year = 1999 + and d_moy = 9 + and ws_bill_addr_sk = ca_address_sk + and ca_gmt_offset = -6::numeric + group by i_item_id) + select + i_item_id +,sum(total_sales) total_sales + from (select * from ss + union all + select * from cs + union all + select * from ws) tmp1 + group by i_item_id + order by i_item_id + ,total_sales + limit 100; + +-- end query 1 in stream 0 using template ../query_templates/query60.tpl diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/q61.sql b/yql/essentials/tests/sql/suites/pg-tpcds/q61.sql new file mode 100644 index 0000000000..0862c0747e --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/q61.sql @@ -0,0 +1,47 @@ +--!syntax_pg +--TPC-DS Q61 + +-- start query 1 in stream 0 using template ../query_templates/query61.tpl +select promotions,total,cast(promotions as decimal(15,4))/cast(total as decimal(15,4))*100::numeric +from + (select sum(ss_ext_sales_price) promotions + from plato.store_sales + ,plato.store + ,plato.promotion + ,plato.date_dim + ,plato.customer + ,plato.customer_address + ,plato.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::numeric + and i_category = 'Books' + and (p_channel_dmail = 'Y' or p_channel_email = 'Y' or p_channel_tv = 'Y') + and s_gmt_offset = -7::numeric + and d_year = 1999 + and d_moy = 11) promotional_sales, + (select sum(ss_ext_sales_price) total + from plato.store_sales + ,plato.store + ,plato.date_dim + ,plato.customer + ,plato.customer_address + ,plato.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::numeric + and i_category = 'Books' + and s_gmt_offset = -7::numeric + and d_year = 1999 + and d_moy = 11) all_sales +order by promotions, total +limit 100; + +-- end query 1 in stream 0 using template ../query_templates/query61.tpl diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/q62.sql b/yql/essentials/tests/sql/suites/pg-tpcds/q62.sql new file mode 100644 index 0000000000..c65b503787 --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/q62.sql @@ -0,0 +1,38 @@ +--!syntax_pg +--TPC-DS Q62 + +-- start query 1 in stream 0 using template ../query_templates/query62.tpl +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 + plato.web_sales + ,plato.warehouse + ,plato.ship_mode + ,plato.web_site + ,plato.date_dim +where + d_month_seq between 1212 and 1212 + 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; + +-- end query 1 in stream 0 using template ../query_templates/query62.tpl diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/q63.sql b/yql/essentials/tests/sql/suites/pg-tpcds/q63.sql new file mode 100644 index 0000000000..87064c5b8a --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/q63.sql @@ -0,0 +1,32 @@ +--!syntax_pg +--TPC-DS Q63 + +-- start query 1 in stream 0 using template ../query_templates/query63.tpl +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 plato.item + ,plato.store_sales + ,plato.date_dim + ,plato.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 (1212,1212+1,1212+2,1212+3,1212+4,1212+5,1212+6,1212+7,1212+8,1212+9,1212+10,1212+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::numeric then abs (sum_sales - avg_monthly_sales) / avg_monthly_sales else null::numeric end > 0.1::numeric +order by i_manager_id + ,avg_monthly_sales + ,sum_sales +limit 100; + +-- end query 1 in stream 0 using template ../query_templates/query63.tpl diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/q64.sql b/yql/essentials/tests/sql/suites/pg-tpcds/q64.sql new file mode 100644 index 0000000000..57884978ec --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/q64.sql @@ -0,0 +1,124 @@ +--!syntax_pg +--TPC-DS Q64 + +-- start query 1 in stream 0 using template ../query_templates/query64.tpl +with cs_ui as + (select cs_item_sk + ,sum(cs_ext_list_price) as sale,sum(cr_refunded_cash+cr_reversed_charge+cr_store_credit) as refund + from plato.catalog_sales + ,plato.catalog_returns + where cs_item_sk = cr_item_sk + and cs_order_number = cr_order_number + group by cs_item_sk + having sum(cs_ext_list_price)>2::numeric*sum(cr_refunded_cash+cr_reversed_charge+cr_store_credit)), +cross_sales as + (select i_product_name product_name + ,i_item_sk item_sk + ,s_store_name store_name + ,s_zip store_zip + ,ad1.ca_street_number b_street_number + ,ad1.ca_street_name b_street_name + ,ad1.ca_city b_city + ,ad1.ca_zip b_zip + ,ad2.ca_street_number c_street_number + ,ad2.ca_street_name c_street_name + ,ad2.ca_city c_city + ,ad2.ca_zip c_zip + ,d1.d_year as syear + ,d2.d_year as fsyear + ,d3.d_year s2year + ,count(*) cnt + ,sum(ss_wholesale_cost) s1 + ,sum(ss_list_price) s2 + ,sum(ss_coupon_amt) s3 + FROM plato.store_sales + ,plato.store_returns + ,cs_ui + ,plato.date_dim d1 + ,plato.date_dim d2 + ,plato.date_dim d3 + ,plato.store + ,plato.customer + ,plato.customer_demographics cd1 + ,plato.customer_demographics cd2 + ,plato.promotion + ,plato.household_demographics hd1 + ,plato.household_demographics hd2 + ,plato.customer_address ad1 + ,plato.customer_address ad2 + ,plato.income_band ib1 + ,plato.income_band ib2 + ,plato.item + WHERE ss_store_sk = s_store_sk AND + ss_sold_date_sk = d1.d_date_sk AND + ss_customer_sk = c_customer_sk AND + ss_cdemo_sk= cd1.cd_demo_sk AND + ss_hdemo_sk = hd1.hd_demo_sk AND + ss_addr_sk = ad1.ca_address_sk and + ss_item_sk = i_item_sk and + ss_item_sk = sr_item_sk and + ss_ticket_number = sr_ticket_number and + ss_item_sk = cs_ui.cs_item_sk and + c_current_cdemo_sk = cd2.cd_demo_sk AND + c_current_hdemo_sk = hd2.hd_demo_sk AND + c_current_addr_sk = ad2.ca_address_sk and + c_first_sales_date_sk = d2.d_date_sk and + c_first_shipto_date_sk = d3.d_date_sk and + ss_promo_sk = p_promo_sk and + hd1.hd_income_band_sk = ib1.ib_income_band_sk and + hd2.hd_income_band_sk = ib2.ib_income_band_sk and + cd1.cd_marital_status <> cd2.cd_marital_status and + i_color in ('maroon','burnished','dim','steel','navajo','chocolate') and + i_current_price between 35::numeric and (35 + 10)::numeric and + i_current_price between (35 + 1)::numeric and (35 + 15)::numeric +group by i_product_name + ,i_item_sk + ,s_store_name + ,s_zip + ,ad1.ca_street_number + ,ad1.ca_street_name + ,ad1.ca_city + ,ad1.ca_zip + ,ad2.ca_street_number + ,ad2.ca_street_name + ,ad2.ca_city + ,ad2.ca_zip + ,d1.d_year + ,d2.d_year + ,d3.d_year +) +select cs1.product_name + ,cs1.store_name + ,cs1.store_zip + ,cs1.b_street_number + ,cs1.b_street_name + ,cs1.b_city + ,cs1.b_zip + ,cs1.c_street_number + ,cs1.c_street_name + ,cs1.c_city + ,cs1.c_zip + ,cs1.syear as cs1_syear + ,cs1.cnt as cs1_cnt + ,cs1.s1 as s11 + ,cs1.s2 as s21 + ,cs1.s3 as s31 + ,cs2.s1 as s12 + ,cs2.s2 as s22 + ,cs2.s3 as s32 + ,cs2.syear as cs2_syear + ,cs2.cnt as cs2_cnt +from cross_sales cs1,cross_sales cs2 +where cs1.item_sk=cs2.item_sk and + cs1.syear = 2000 and + cs2.syear = 2000 + 1 and + cs2.cnt <= cs1.cnt and + cs1.store_name = cs2.store_name and + cs1.store_zip = cs2.store_zip +order by cs1.product_name + ,cs1.store_name + ,cs2_cnt + ,cs1.s1 + ,cs2.s1; + +-- end query 1 in stream 0 using template ../query_templates/query64.tpl diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/q65.sql b/yql/essentials/tests/sql/suites/pg-tpcds/q65.sql new file mode 100644 index 0000000000..87d4e776af --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/q65.sql @@ -0,0 +1,32 @@ +--!syntax_pg +--TPC-DS Q65 + +-- start query 1 in stream 0 using template ../query_templates/query65.tpl +select + s_store_name, + i_item_desc, + sc.revenue, + i_current_price, + i_wholesale_cost, + i_brand + from plato.store, plato.item, + (select ss_store_sk, avg(revenue) as ave + from + (select ss_store_sk, ss_item_sk, + sum(ss_sales_price) as revenue + from plato.store_sales, plato.date_dim + where ss_sold_date_sk = d_date_sk and d_month_seq between 1212 and 1212+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 plato.store_sales, plato.date_dim + where ss_sold_date_sk = d_date_sk and d_month_seq between 1212 and 1212+11 + group by ss_store_sk, ss_item_sk) sc + where sb.ss_store_sk = sc.ss_store_sk and + sc.revenue <= 0.1::numeric * 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; + +-- end query 1 in stream 0 using template ../query_templates/query65.tpl diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/q66.sql b/yql/essentials/tests/sql/suites/pg-tpcds/q66.sql new file mode 100644 index 0000000000..2e6a5eabad --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/q66.sql @@ -0,0 +1,223 @@ +--!syntax_pg +--TPC-DS Q66 + +-- start query 1 in stream 0 using template ../query_templates/query66.tpl +select + w_warehouse_name + ,w_warehouse_sq_ft + ,w_city + ,w_county + ,w_state + ,w_country + ,ship_carriers + ,year + ,sum(jan_sales) as jan_sales + ,sum(feb_sales) as feb_sales + ,sum(mar_sales) as mar_sales + ,sum(apr_sales) as apr_sales + ,sum(may_sales) as may_sales + ,sum(jun_sales) as jun_sales + ,sum(jul_sales) as jul_sales + ,sum(aug_sales) as aug_sales + ,sum(sep_sales) as sep_sales + ,sum(oct_sales) as oct_sales + ,sum(nov_sales) as nov_sales + ,sum(dec_sales) as dec_sales + ,sum(jan_sales/w_warehouse_sq_ft::numeric) as jan_sales_per_sq_foot + ,sum(feb_sales/w_warehouse_sq_ft::numeric) as feb_sales_per_sq_foot + ,sum(mar_sales/w_warehouse_sq_ft::numeric) as mar_sales_per_sq_foot + ,sum(apr_sales/w_warehouse_sq_ft::numeric) as apr_sales_per_sq_foot + ,sum(may_sales/w_warehouse_sq_ft::numeric) as may_sales_per_sq_foot + ,sum(jun_sales/w_warehouse_sq_ft::numeric) as jun_sales_per_sq_foot + ,sum(jul_sales/w_warehouse_sq_ft::numeric) as jul_sales_per_sq_foot + ,sum(aug_sales/w_warehouse_sq_ft::numeric) as aug_sales_per_sq_foot + ,sum(sep_sales/w_warehouse_sq_ft::numeric) as sep_sales_per_sq_foot + ,sum(oct_sales/w_warehouse_sq_ft::numeric) as oct_sales_per_sq_foot + ,sum(nov_sales/w_warehouse_sq_ft::numeric) as nov_sales_per_sq_foot + ,sum(dec_sales/w_warehouse_sq_ft::numeric) as dec_sales_per_sq_foot + ,sum(jan_net) as jan_net + ,sum(feb_net) as feb_net + ,sum(mar_net) as mar_net + ,sum(apr_net) as apr_net + ,sum(may_net) as may_net + ,sum(jun_net) as jun_net + ,sum(jul_net) as jul_net + ,sum(aug_net) as aug_net + ,sum(sep_net) as sep_net + ,sum(oct_net) as oct_net + ,sum(nov_net) as nov_net + ,sum(dec_net) as dec_net + from ( + select + w_warehouse_name + ,w_warehouse_sq_ft + ,w_city + ,w_county + ,w_state + ,w_country + ,'DIAMOND' || ',' || 'AIRBORNE' as ship_carriers + ,d_year as year + ,sum(case when d_moy = 1 + then ws_sales_price* ws_quantity::numeric else 0::numeric end) as jan_sales + ,sum(case when d_moy = 2 + then ws_sales_price* ws_quantity::numeric else 0::numeric end) as feb_sales + ,sum(case when d_moy = 3 + then ws_sales_price* ws_quantity::numeric else 0::numeric end) as mar_sales + ,sum(case when d_moy = 4 + then ws_sales_price* ws_quantity::numeric else 0::numeric end) as apr_sales + ,sum(case when d_moy = 5 + then ws_sales_price* ws_quantity::numeric else 0::numeric end) as may_sales + ,sum(case when d_moy = 6 + then ws_sales_price* ws_quantity::numeric else 0::numeric end) as jun_sales + ,sum(case when d_moy = 7 + then ws_sales_price* ws_quantity::numeric else 0::numeric end) as jul_sales + ,sum(case when d_moy = 8 + then ws_sales_price* ws_quantity::numeric else 0::numeric end) as aug_sales + ,sum(case when d_moy = 9 + then ws_sales_price* ws_quantity::numeric else 0::numeric end) as sep_sales + ,sum(case when d_moy = 10 + then ws_sales_price* ws_quantity::numeric else 0::numeric end) as oct_sales + ,sum(case when d_moy = 11 + then ws_sales_price* ws_quantity::numeric else 0::numeric end) as nov_sales + ,sum(case when d_moy = 12 + then ws_sales_price* ws_quantity::numeric else 0::numeric end) as dec_sales + ,sum(case when d_moy = 1 + then ws_net_paid_inc_tax * ws_quantity::numeric else 0::numeric end) as jan_net + ,sum(case when d_moy = 2 + then ws_net_paid_inc_tax * ws_quantity::numeric else 0::numeric end) as feb_net + ,sum(case when d_moy = 3 + then ws_net_paid_inc_tax * ws_quantity::numeric else 0::numeric end) as mar_net + ,sum(case when d_moy = 4 + then ws_net_paid_inc_tax * ws_quantity::numeric else 0::numeric end) as apr_net + ,sum(case when d_moy = 5 + then ws_net_paid_inc_tax * ws_quantity::numeric else 0::numeric end) as may_net + ,sum(case when d_moy = 6 + then ws_net_paid_inc_tax * ws_quantity::numeric else 0::numeric end) as jun_net + ,sum(case when d_moy = 7 + then ws_net_paid_inc_tax * ws_quantity::numeric else 0::numeric end) as jul_net + ,sum(case when d_moy = 8 + then ws_net_paid_inc_tax * ws_quantity::numeric else 0::numeric end) as aug_net + ,sum(case when d_moy = 9 + then ws_net_paid_inc_tax * ws_quantity::numeric else 0::numeric end) as sep_net + ,sum(case when d_moy = 10 + then ws_net_paid_inc_tax * ws_quantity::numeric else 0::numeric end) as oct_net + ,sum(case when d_moy = 11 + then ws_net_paid_inc_tax * ws_quantity::numeric else 0::numeric end) as nov_net + ,sum(case when d_moy = 12 + then ws_net_paid_inc_tax * ws_quantity::numeric else 0::numeric end) as dec_net + from + plato.web_sales + ,plato.warehouse + ,plato.date_dim + ,plato.time_dim + ,plato.ship_mode + where + ws_warehouse_sk = w_warehouse_sk + and ws_sold_date_sk = d_date_sk + and ws_sold_time_sk = t_time_sk + and ws_ship_mode_sk = sm_ship_mode_sk + and d_year = 2002 + and t_time between 49530 and 49530+28800 + and sm_carrier in ('DIAMOND','AIRBORNE') + group by + w_warehouse_name + ,w_warehouse_sq_ft + ,w_city + ,w_county + ,w_state + ,w_country + ,d_year + union all + select + w_warehouse_name + ,w_warehouse_sq_ft + ,w_city + ,w_county + ,w_state + ,w_country + ,'DIAMOND' || ',' || 'AIRBORNE' as ship_carriers + ,d_year as year + ,sum(case when d_moy = 1 + then cs_ext_sales_price* cs_quantity::numeric else 0::numeric end) as jan_sales + ,sum(case when d_moy = 2 + then cs_ext_sales_price* cs_quantity::numeric else 0::numeric end) as feb_sales + ,sum(case when d_moy = 3 + then cs_ext_sales_price* cs_quantity::numeric else 0::numeric end) as mar_sales + ,sum(case when d_moy = 4 + then cs_ext_sales_price* cs_quantity::numeric else 0::numeric end) as apr_sales + ,sum(case when d_moy = 5 + then cs_ext_sales_price* cs_quantity::numeric else 0::numeric end) as may_sales + ,sum(case when d_moy = 6 + then cs_ext_sales_price* cs_quantity::numeric else 0::numeric end) as jun_sales + ,sum(case when d_moy = 7 + then cs_ext_sales_price* cs_quantity::numeric else 0::numeric end) as jul_sales + ,sum(case when d_moy = 8 + then cs_ext_sales_price* cs_quantity::numeric else 0::numeric end) as aug_sales + ,sum(case when d_moy = 9 + then cs_ext_sales_price* cs_quantity::numeric else 0::numeric end) as sep_sales + ,sum(case when d_moy = 10 + then cs_ext_sales_price* cs_quantity::numeric else 0::numeric end) as oct_sales + ,sum(case when d_moy = 11 + then cs_ext_sales_price* cs_quantity::numeric else 0::numeric end) as nov_sales + ,sum(case when d_moy = 12 + then cs_ext_sales_price* cs_quantity::numeric else 0::numeric end) as dec_sales + ,sum(case when d_moy = 1 + then cs_net_paid_inc_ship_tax * cs_quantity::numeric else 0::numeric end) as jan_net + ,sum(case when d_moy = 2 + then cs_net_paid_inc_ship_tax * cs_quantity::numeric else 0::numeric end) as feb_net + ,sum(case when d_moy = 3 + then cs_net_paid_inc_ship_tax * cs_quantity::numeric else 0::numeric end) as mar_net + ,sum(case when d_moy = 4 + then cs_net_paid_inc_ship_tax * cs_quantity::numeric else 0::numeric end) as apr_net + ,sum(case when d_moy = 5 + then cs_net_paid_inc_ship_tax * cs_quantity::numeric else 0::numeric end) as may_net + ,sum(case when d_moy = 6 + then cs_net_paid_inc_ship_tax * cs_quantity::numeric else 0::numeric end) as jun_net + ,sum(case when d_moy = 7 + then cs_net_paid_inc_ship_tax * cs_quantity::numeric else 0::numeric end) as jul_net + ,sum(case when d_moy = 8 + then cs_net_paid_inc_ship_tax * cs_quantity::numeric else 0::numeric end) as aug_net + ,sum(case when d_moy = 9 + then cs_net_paid_inc_ship_tax * cs_quantity::numeric else 0::numeric end) as sep_net + ,sum(case when d_moy = 10 + then cs_net_paid_inc_ship_tax * cs_quantity::numeric else 0::numeric end) as oct_net + ,sum(case when d_moy = 11 + then cs_net_paid_inc_ship_tax * cs_quantity::numeric else 0::numeric end) as nov_net + ,sum(case when d_moy = 12 + then cs_net_paid_inc_ship_tax * cs_quantity::numeric else 0::numeric end) as dec_net + from + plato.catalog_sales + ,plato.warehouse + ,plato.date_dim + ,plato.time_dim + ,plato.ship_mode + where + cs_warehouse_sk = w_warehouse_sk + and cs_sold_date_sk = d_date_sk + and cs_sold_time_sk = t_time_sk + and cs_ship_mode_sk = sm_ship_mode_sk + and d_year = 2002 + and t_time between 49530 AND 49530+28800 + and sm_carrier in ('DIAMOND','AIRBORNE') + group by + w_warehouse_name + ,w_warehouse_sq_ft + ,w_city + ,w_county + ,w_state + ,w_country + ,d_year + ) x + group by + w_warehouse_name + ,w_warehouse_sq_ft + ,w_city + ,w_county + ,w_state + ,w_country + ,ship_carriers + ,year + order by w_warehouse_name + limit 100; + +-- end query 1 in stream 0 using template ../query_templates/query66.tpl diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/q67.sql b/yql/essentials/tests/sql/suites/pg-tpcds/q67.sql new file mode 100644 index 0000000000..8f3f7a868a --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/q67.sql @@ -0,0 +1,47 @@ +--!syntax_pg +--TPC-DS Q67 + +-- start query 1 in stream 0 using template ../query_templates/query67.tpl +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::numeric,0::numeric)) sumsales + from plato.store_sales + ,plato.date_dim + ,plato.store + ,plato.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 1212 and 1212+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; + +-- end query 1 in stream 0 using template ../query_templates/query67.tpl diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/q68.sql b/yql/essentials/tests/sql/suites/pg-tpcds/q68.sql new file mode 100644 index 0000000000..385f421edc --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/q68.sql @@ -0,0 +1,45 @@ +--!syntax_pg +--TPC-DS Q68 + +-- start query 1 in stream 0 using template ../query_templates/query68.tpl +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 plato.store_sales + ,plato.date_dim + ,plato.store + ,plato.household_demographics + ,plato.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 = 5 or + household_demographics.hd_vehicle_count= 3) + and date_dim.d_year in (1999,1999+1,1999+2) + and store.s_city in ('Midway','Fairview') + group by ss_ticket_number + ,ss_customer_sk + ,ss_addr_sk,ca_city) dn + ,plato.customer + ,plato.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; + +-- end query 1 in stream 0 using template ../query_templates/query68.tpl diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/q69.sql b/yql/essentials/tests/sql/suites/pg-tpcds/q69.sql new file mode 100644 index 0000000000..7fd3ba6c71 --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/q69.sql @@ -0,0 +1,50 @@ +--!syntax_pg +--TPC-DS Q69 + +-- start query 1 in stream 0 using template ../query_templates/query69.tpl +select + cd_gender, + cd_marital_status, + cd_education_status, + count(*) cnt1, + cd_purchase_estimate, + count(*) cnt2, + cd_credit_rating, + count(*) cnt3 + from + plato.customer c,plato.customer_address ca,plato.customer_demographics + where + c.c_current_addr_sk = ca.ca_address_sk and + ca_state in ('CO','IL','MN') and + cd_demo_sk = c.c_current_cdemo_sk and + exists (select * + from plato.store_sales,plato.date_dim + where c.c_customer_sk = ss_customer_sk and + ss_sold_date_sk = d_date_sk and + d_year = 1999 and + d_moy between 1 and 1+2) and + (not exists (select * + from plato.web_sales,plato.date_dim + where c.c_customer_sk = ws_bill_customer_sk and + ws_sold_date_sk = d_date_sk and + d_year = 1999 and + d_moy between 1 and 1+2) and + not exists (select * + from plato.catalog_sales,plato.date_dim + where c.c_customer_sk = cs_ship_customer_sk and + cs_sold_date_sk = d_date_sk and + d_year = 1999 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; + +-- end query 1 in stream 0 using template ../query_templates/query69.tpl diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/q70.sql b/yql/essentials/tests/sql/suites/pg-tpcds/q70.sql new file mode 100644 index 0000000000..530cb0f973 --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/q70.sql @@ -0,0 +1,41 @@ +--!syntax_pg +--TPC-DS Q70 + +-- start query 1 in stream 0 using template ../query_templates/query70.tpl +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 + plato.store_sales + ,plato.date_dim d1 + ,plato.store + where + d1.d_month_seq between 1212 and 1212+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 plato.store_sales, plato.store, plato.date_dim + where d_month_seq between 1212 and 1212+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; + +-- end query 1 in stream 0 using template ../query_templates/query70.tpl diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/q71.sql b/yql/essentials/tests/sql/suites/pg-tpcds/q71.sql new file mode 100644 index 0000000000..72f8f06225 --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/q71.sql @@ -0,0 +1,43 @@ +--!syntax_pg +--TPC-DS Q71 + +-- start query 1 in stream 0 using template ../query_templates/query71.tpl +select i_brand_id brand_id, i_brand brand,t_hour,t_minute, + sum(ext_price) ext_price + from plato.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 plato.web_sales,plato.date_dim + where d_date_sk = ws_sold_date_sk + and d_moy=12 + and d_year=2000 + 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 plato.catalog_sales,plato.date_dim + where d_date_sk = cs_sold_date_sk + and d_moy=12 + and d_year=2000 + 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 plato.store_sales,plato.date_dim + where d_date_sk = ss_sold_date_sk + and d_moy=12 + and d_year=2000 + ) tmp,plato.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 + ; + +-- end query 1 in stream 0 using template ../query_templates/query71.tpl diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/q72.sql b/yql/essentials/tests/sql/suites/pg-tpcds/q72.sql new file mode 100644 index 0000000000..1687f6f0e5 --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/q72.sql @@ -0,0 +1,32 @@ +--!syntax_pg +--TPC-DS Q72 + +-- start query 1 in stream 0 using template ../query_templates/query72.tpl +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 plato.catalog_sales +join plato.inventory on (cs_item_sk = inv_item_sk) +join plato.warehouse on (w_warehouse_sk=inv_warehouse_sk) +join plato.item on (i_item_sk = cs_item_sk) +join plato.customer_demographics on (cs_bill_cdemo_sk = cd_demo_sk) +join plato.household_demographics on (cs_bill_hdemo_sk = hd_demo_sk) +join plato.date_dim d1 on (cs_sold_date_sk = d1.d_date_sk) +join plato.date_dim d2 on (inv_date_sk = d2.d_date_sk) +join plato.date_dim d3 on (cs_ship_date_sk = d3.d_date_sk) +left outer join plato.promotion on (cs_promo_sk=p_promo_sk) +left outer join plato.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 + 5 + and hd_buy_potential = '1001-5000' + and d1.d_year = 2001 + and cd_marital_status = 'M' +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; + +-- end query 1 in stream 0 using template ../query_templates/query72.tpl diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/q73.sql b/yql/essentials/tests/sql/suites/pg-tpcds/q73.sql new file mode 100644 index 0000000000..768a01d4cf --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/q73.sql @@ -0,0 +1,31 @@ +--!syntax_pg +--TPC-DS Q73 + +-- start query 1 in stream 0 using template ../query_templates/query73.tpl +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 plato.store_sales,plato.date_dim,plato.store,plato.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 = '>10000' 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::int4 end > 1 + and date_dim.d_year in (1998,1998+1,1998+2) + and store.s_county in ('Williamson County','Williamson County','Williamson County','Williamson County') + group by ss_ticket_number,ss_customer_sk) dj,plato.customer + where ss_customer_sk = c_customer_sk + and cnt between 1::int8 and 5::int8 + order by cnt desc, c_last_name asc; + +-- end query 1 in stream 0 using template ../query_templates/query73.tpl diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/q74.sql b/yql/essentials/tests/sql/suites/pg-tpcds/q74.sql new file mode 100644 index 0000000000..86b46f1122 --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/q74.sql @@ -0,0 +1,64 @@ +--!syntax_pg +--TPC-DS Q74 + +-- start query 1 in stream 0 using template ../query_templates/query74.tpl +with year_total as ( + select c_customer_id customer_id + ,c_first_name customer_first_name + ,c_last_name customer_last_name + ,d_year as year + ,max(ss_net_paid) year_total + ,'s' sale_type + from plato.customer + ,plato.store_sales + ,plato.date_dim + where c_customer_sk = ss_customer_sk + and ss_sold_date_sk = d_date_sk + and d_year in (2001,2001+1) + group by c_customer_id + ,c_first_name + ,c_last_name + ,d_year + union all + select c_customer_id customer_id + ,c_first_name customer_first_name + ,c_last_name customer_last_name + ,d_year as year + ,max(ws_net_paid) year_total + ,'w' sale_type + from plato.customer + ,plato.web_sales + ,plato.date_dim + where c_customer_sk = ws_bill_customer_sk + and ws_sold_date_sk = d_date_sk + and d_year in (2001,2001+1) + group by c_customer_id + ,c_first_name + ,c_last_name + ,d_year + ) + select + t_s_secyear.customer_id, t_s_secyear.customer_first_name, t_s_secyear.customer_last_name + from year_total t_s_firstyear + ,year_total t_s_secyear + ,year_total t_w_firstyear + ,year_total t_w_secyear + where t_s_secyear.customer_id = t_s_firstyear.customer_id + and t_s_firstyear.customer_id = t_w_secyear.customer_id + and t_s_firstyear.customer_id = t_w_firstyear.customer_id + and t_s_firstyear.sale_type = 's' + and t_w_firstyear.sale_type = 'w' + and t_s_secyear.sale_type = 's' + and t_w_secyear.sale_type = 'w' + and t_s_firstyear.year = 2001 + and t_s_secyear.year = 2001+1 + and t_w_firstyear.year = 2001 + and t_w_secyear.year = 2001+1 + and t_s_firstyear.year_total > 0::numeric + and t_w_firstyear.year_total > 0::numeric + and case when t_w_firstyear.year_total > 0::numeric then t_w_secyear.year_total / t_w_firstyear.year_total else null::numeric end + > case when t_s_firstyear.year_total > 0::numeric then t_s_secyear.year_total / t_s_firstyear.year_total else null::numeric end + order by 2,1,3 +limit 100; + +-- end query 1 in stream 0 using template ../query_templates/query74.tpl diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/q75.sql b/yql/essentials/tests/sql/suites/pg-tpcds/q75.sql new file mode 100644 index 0000000000..62937cb56d --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/q75.sql @@ -0,0 +1,73 @@ +--!syntax_pg +--TPC-DS Q75 + +-- start query 1 in stream 0 using template ../query_templates/query75.tpl +WITH all_sales AS ( + SELECT d_year + ,i_brand_id + ,i_class_id + ,i_category_id + ,i_manufact_id + ,SUM(sales_cnt) AS sales_cnt + ,SUM(sales_amt) AS sales_amt + FROM (SELECT d_year + ,i_brand_id + ,i_class_id + ,i_category_id + ,i_manufact_id + ,cs_quantity - COALESCE(cr_return_quantity,0) AS sales_cnt + ,cs_ext_sales_price - COALESCE(cr_return_amount,0.0::numeric) AS sales_amt + FROM plato.catalog_sales JOIN plato.item ON i_item_sk=cs_item_sk + JOIN plato.date_dim ON d_date_sk=cs_sold_date_sk + LEFT JOIN plato.catalog_returns ON (cs_order_number=cr_order_number + AND cs_item_sk=cr_item_sk) + WHERE i_category='Sports' + UNION + SELECT d_year + ,i_brand_id + ,i_class_id + ,i_category_id + ,i_manufact_id + ,ss_quantity - COALESCE(sr_return_quantity,0) AS sales_cnt + ,ss_ext_sales_price - COALESCE(sr_return_amt,0.0::numeric) AS sales_amt + FROM plato.store_sales JOIN plato.item ON i_item_sk=ss_item_sk + JOIN plato.date_dim ON d_date_sk=ss_sold_date_sk + LEFT JOIN plato.store_returns ON (ss_ticket_number=sr_ticket_number + AND ss_item_sk=sr_item_sk) + WHERE i_category='Sports' + UNION + SELECT d_year + ,i_brand_id + ,i_class_id + ,i_category_id + ,i_manufact_id + ,ws_quantity - COALESCE(wr_return_quantity,0) AS sales_cnt + ,ws_ext_sales_price - COALESCE(wr_return_amt,0.0::numeric) AS sales_amt + FROM plato.web_sales JOIN plato.item ON i_item_sk=ws_item_sk + JOIN plato.date_dim ON d_date_sk=ws_sold_date_sk + LEFT JOIN plato.web_returns ON (ws_order_number=wr_order_number + AND ws_item_sk=wr_item_sk) + WHERE i_category='Sports') sales_detail + GROUP BY d_year, i_brand_id, i_class_id, i_category_id, i_manufact_id) + SELECT prev_yr.d_year AS prev_year + ,curr_yr.d_year AS year + ,curr_yr.i_brand_id + ,curr_yr.i_class_id + ,curr_yr.i_category_id + ,curr_yr.i_manufact_id + ,prev_yr.sales_cnt AS prev_yr_cnt + ,curr_yr.sales_cnt AS curr_yr_cnt + ,curr_yr.sales_cnt-prev_yr.sales_cnt AS sales_cnt_diff + ,curr_yr.sales_amt-prev_yr.sales_amt AS sales_amt_diff + FROM all_sales curr_yr, all_sales prev_yr + WHERE curr_yr.i_brand_id=prev_yr.i_brand_id + AND curr_yr.i_class_id=prev_yr.i_class_id + AND curr_yr.i_category_id=prev_yr.i_category_id + AND curr_yr.i_manufact_id=prev_yr.i_manufact_id + AND curr_yr.d_year=2002 + AND prev_yr.d_year=2002-1 + AND CAST(curr_yr.sales_cnt AS DECIMAL(17,2))/CAST(prev_yr.sales_cnt AS DECIMAL(17,2))<0.9::numeric + ORDER BY sales_cnt_diff,sales_amt_diff + limit 100; + +-- end query 1 in stream 0 using template ../query_templates/query75.tpl diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/q76.sql b/yql/essentials/tests/sql/suites/pg-tpcds/q76.sql new file mode 100644 index 0000000000..ce2e458ace --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/q76.sql @@ -0,0 +1,27 @@ +--!syntax_pg +--TPC-DS Q76 + +-- start query 1 in stream 0 using template ../query_templates/query76.tpl +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_addr_sk' col_name, d_year, d_qoy, i_category, ss_ext_sales_price ext_sales_price + FROM plato.store_sales, plato.item, plato.date_dim + WHERE ss_addr_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_web_page_sk' col_name, d_year, d_qoy, i_category, ws_ext_sales_price ext_sales_price + FROM plato.web_sales, plato.item, plato.date_dim + WHERE ws_web_page_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 plato.catalog_sales, plato.item, plato.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; + +-- end query 1 in stream 0 using template ../query_templates/query76.tpl diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/q77.sql b/yql/essentials/tests/sql/suites/pg-tpcds/q77.sql new file mode 100644 index 0000000000..fbef66a1e2 --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/q77.sql @@ -0,0 +1,111 @@ +--!syntax_pg +--TPC-DS Q77 + +-- start query 1 in stream 0 using template ../query_templates/query77.tpl +with ss as + (select s_store_sk, + sum(ss_ext_sales_price) as sales, + sum(ss_net_profit) as profit + from plato.store_sales, + plato.date_dim, + plato.store + where ss_sold_date_sk = d_date_sk + and d_date between cast('1998-08-04' as date) + and (cast('1998-08-04' as date) + interval '30' day)::date + and ss_store_sk = s_store_sk + group by s_store_sk) + , + sr as + (select s_store_sk, + sum(sr_return_amt) as returns, + sum(sr_net_loss) as profit_loss + from plato.store_returns, + plato.date_dim, + plato.store + where sr_returned_date_sk = d_date_sk + and d_date between cast('1998-08-04' as date) + and (cast('1998-08-04' as date) + interval '30' day)::date + and sr_store_sk = s_store_sk + group by s_store_sk), + cs as + (select cs_call_center_sk, + sum(cs_ext_sales_price) as sales, + sum(cs_net_profit) as profit + from plato.catalog_sales, + plato.date_dim + where cs_sold_date_sk = d_date_sk + and d_date between cast('1998-08-04' as date) + and (cast('1998-08-04' as date) + interval '30' day)::date + group by cs_call_center_sk + ), + cr as + (select cr_call_center_sk, + sum(cr_return_amount) as returns, + sum(cr_net_loss) as profit_loss + from plato.catalog_returns, + plato.date_dim + where cr_returned_date_sk = d_date_sk + and d_date between cast('1998-08-04' as date) + and (cast('1998-08-04' as date) + interval '30' day)::date + group by cr_call_center_sk + ), + ws as + ( select wp_web_page_sk, + sum(ws_ext_sales_price) as sales, + sum(ws_net_profit) as profit + from plato.web_sales, + plato.date_dim, + plato.web_page + where ws_sold_date_sk = d_date_sk + and d_date between cast('1998-08-04' as date) + and (cast('1998-08-04' as date) + interval '30' day)::date + and ws_web_page_sk = wp_web_page_sk + group by wp_web_page_sk), + wr as + (select wp_web_page_sk, + sum(wr_return_amt) as returns, + sum(wr_net_loss) as profit_loss + from plato.web_returns, + plato.date_dim, + plato.web_page + where wr_returned_date_sk = d_date_sk + and d_date between cast('1998-08-04' as date) + and (cast('1998-08-04' as date) + interval '30' day)::date + and wr_web_page_sk = wp_web_page_sk + group by wp_web_page_sk) + select channel + , id + , sum(sales) as sales + , sum(returns) as returns + , sum(profit) as profit + from + (select 'store channel' as channel + , ss.s_store_sk as id + , sales + , coalesce(returns, 0::numeric) as returns + , (profit - coalesce(profit_loss,0::numeric)) as profit + from ss left join sr + on ss.s_store_sk = sr.s_store_sk + union all + select 'catalog channel' as channel + , cs_call_center_sk as id + , sales + , returns + , (profit - profit_loss) as profit + from cs + , cr + union all + select 'web channel' as channel + , ws.wp_web_page_sk as id + , sales + , coalesce(returns, 0::numeric) returns + , (profit - coalesce(profit_loss,0::numeric)) as profit + from ws left join wr + on ws.wp_web_page_sk = wr.wp_web_page_sk + ) x + group by rollup (channel, id) + order by channel + ,id + limit 100; + +-- end query 1 in stream 0 using template ../query_templates/query77.tpl diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/q78.sql b/yql/essentials/tests/sql/suites/pg-tpcds/q78.sql new file mode 100644 index 0000000000..e9d81de782 --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/q78.sql @@ -0,0 +1,61 @@ +--!syntax_pg +--TPC-DS Q78 + +-- start query 1 in stream 0 using template ../query_templates/query78.tpl +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 plato.web_sales + left join plato.web_returns on wr_order_number=ws_order_number and ws_item_sk=wr_item_sk + join plato.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 plato.catalog_sales + left join plato.catalog_returns on cr_order_number=cs_order_number and cs_item_sk=cr_item_sk + join plato.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 plato.store_sales + left join plato.store_returns on sr_ticket_number=ss_ticket_number and ss_item_sk=sr_item_sk + join plato.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_sold_year, ss_item_sk, ss_customer_sk, +round((ss_qty/(coalesce(ws_qty,0::int8)+coalesce(cs_qty,0::int8)))::numeric,2) ratio, +ss_qty store_qty, ss_wc store_wholesale_cost, ss_sp store_sales_price, +coalesce(ws_qty,0::int8)+coalesce(cs_qty,0::int8) other_chan_qty, +coalesce(ws_wc,0::numeric)+coalesce(cs_wc,0::numeric) other_chan_wholesale_cost, +coalesce(ws_sp,0::numeric)+coalesce(cs_sp,0::numeric) 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::int8)>0::int8 or coalesce(cs_qty, 0::int8)>0::int8) and ss_sold_year=2000 +order by + ss_sold_year, ss_item_sk, ss_customer_sk, + ss_qty desc, ss_wc desc, ss_sp desc, + other_chan_qty, + other_chan_wholesale_cost, + other_chan_sales_price, + ratio +limit 100; + +-- end query 1 in stream 0 using template ../query_templates/query78.tpl diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/q79.sql b/yql/essentials/tests/sql/suites/pg-tpcds/q79.sql new file mode 100644 index 0000000000..106c147a1e --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/q79.sql @@ -0,0 +1,26 @@ +--!syntax_pg +--TPC-DS Q79 + +-- start query 1 in stream 0 using template ../query_templates/query79.tpl +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 plato.store_sales,plato.date_dim,plato.store,plato.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 = 8 or household_demographics.hd_vehicle_count > 0) + 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,plato.customer + where ss_customer_sk = c_customer_sk + order by c_last_name,c_first_name,substr(s_city,1,30), profit +limit 100; + +-- end query 1 in stream 0 using template ../query_templates/query79.tpl diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/q80.sql b/yql/essentials/tests/sql/suites/pg-tpcds/q80.sql new file mode 100644 index 0000000000..0ed10ead39 --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/q80.sql @@ -0,0 +1,99 @@ +--!syntax_pg +--TPC-DS Q80 + +-- start query 1 in stream 0 using template ../query_templates/query80.tpl +with ssr as + (select s_store_id as store_id, + sum(ss_ext_sales_price) as sales, + sum(coalesce(sr_return_amt, 0::numeric)) as returns, + sum(ss_net_profit - coalesce(sr_net_loss, 0::numeric)) as profit + from plato.store_sales left outer join plato.store_returns on + (ss_item_sk = sr_item_sk and ss_ticket_number = sr_ticket_number), + plato.date_dim, + plato.store, + plato.item, + plato.promotion + where ss_sold_date_sk = d_date_sk + and d_date between cast('1998-08-04' as date) + and (cast('1998-08-04' as date) + interval '30' day)::date + and ss_store_sk = s_store_sk + and ss_item_sk = i_item_sk + and i_current_price > 50::numeric + and ss_promo_sk = p_promo_sk + and p_channel_tv = 'N' + group by s_store_id) + , + csr as + (select cp_catalog_page_id as catalog_page_id, + sum(cs_ext_sales_price) as sales, + sum(coalesce(cr_return_amount, 0::numeric)) as returns, + sum(cs_net_profit - coalesce(cr_net_loss, 0::numeric)) as profit + from plato.catalog_sales left outer join plato.catalog_returns on + (cs_item_sk = cr_item_sk and cs_order_number = cr_order_number), + plato.date_dim, + plato.catalog_page, + plato.item, + plato.promotion + where cs_sold_date_sk = d_date_sk + and d_date between cast('1998-08-04' as date) + and (cast('1998-08-04' as date) + interval '30' day)::date + and cs_catalog_page_sk = cp_catalog_page_sk + and cs_item_sk = i_item_sk + and i_current_price > 50::numeric + and cs_promo_sk = p_promo_sk + and p_channel_tv = 'N' +group by cp_catalog_page_id) + , + wsr as + (select web_site_id, + sum(ws_ext_sales_price) as sales, + sum(coalesce(wr_return_amt, 0::numeric)) as returns, + sum(ws_net_profit - coalesce(wr_net_loss, 0::numeric)) as profit + from plato.web_sales left outer join plato.web_returns on + (ws_item_sk = wr_item_sk and ws_order_number = wr_order_number), + plato.date_dim, + plato.web_site, + plato.item, + plato.promotion + where ws_sold_date_sk = d_date_sk + and d_date between cast('1998-08-04' as date) + and (cast('1998-08-04' as date) + interval '30' day)::date + and ws_web_site_sk = web_site_sk + and ws_item_sk = i_item_sk + and i_current_price > 50::numeric + and ws_promo_sk = p_promo_sk + and p_channel_tv = 'N' +group by web_site_id) + select channel + , id + , sum(sales) as sales + , sum(returns) as returns + , sum(profit) as profit + from + (select 'store channel' as channel + , 'store' || store_id as id + , sales + , returns + , profit + from ssr + union all + select 'catalog channel' as channel + , 'catalog_page' || catalog_page_id as id + , sales + , returns + , profit + from csr + union all + select 'web channel' as channel + , 'web_site' || web_site_id as id + , sales + , returns + , profit + from wsr + ) x + group by rollup (channel, id) + order by channel + ,id + limit 100; + +-- end query 1 in stream 0 using template ../query_templates/query80.tpl diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/q81.sql b/yql/essentials/tests/sql/suites/pg-tpcds/q81.sql new file mode 100644 index 0000000000..e90c1f85ed --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/q81.sql @@ -0,0 +1,34 @@ +--!syntax_pg +--TPC-DS Q81 + +-- start query 1 in stream 0 using template ../query_templates/query81.tpl +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 plato.catalog_returns + ,plato.date_dim + ,plato.customer_address + where cr_returned_date_sk = d_date_sk + and d_year =1998 + 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 + ,plato.customer_address + ,plato.customer + where ctr1.ctr_total_return > (select avg(ctr_total_return)*1.2::numeric + from customer_total_return ctr2 + where ctr1.ctr_state = ctr2.ctr_state) + and ca_address_sk = c_current_addr_sk + and ca_state = 'IL' + 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; + +-- end query 1 in stream 0 using template ../query_templates/query81.tpl diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/q82.sql b/yql/essentials/tests/sql/suites/pg-tpcds/q82.sql new file mode 100644 index 0000000000..9d641268b6 --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/q82.sql @@ -0,0 +1,20 @@ +--!syntax_pg +--TPC-DS Q82 + +-- start query 1 in stream 0 using template ../query_templates/query82.tpl +select i_item_id + ,i_item_desc + ,i_current_price + from plato.item, plato.inventory, plato.date_dim, plato.store_sales + where i_current_price between 30::numeric and (30+30)::numeric + and inv_item_sk = i_item_sk + and d_date_sk=inv_date_sk + and d_date between cast('2002-05-30' as date) and (cast('2002-05-30' as date) + interval '60' day)::date + and i_manufact_id in (437,129,727,663) + 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; + +-- end query 1 in stream 0 using template ../query_templates/query82.tpl diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/q83.sql b/yql/essentials/tests/sql/suites/pg-tpcds/q83.sql new file mode 100644 index 0000000000..0801e9902c --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/q83.sql @@ -0,0 +1,70 @@ +--!syntax_pg +--TPC-DS Q83 + +-- start query 1 in stream 0 using template ../query_templates/query83.tpl +with sr_items as + (select i_item_id item_id, + sum(sr_return_quantity) sr_item_qty + from plato.store_returns, + plato.item, + plato.date_dim + where sr_item_sk = i_item_sk + and d_date in + (select d_date + from plato.date_dim + where d_week_seq in + (select d_week_seq + from plato.date_dim + where d_date in ('1998-01-02'::date,'1998-10-15'::date,'1998-11-10'::date))) + and sr_returned_date_sk = d_date_sk + group by i_item_id), + cr_items as + (select i_item_id item_id, + sum(cr_return_quantity) cr_item_qty + from plato.catalog_returns, + plato.item, + plato.date_dim + where cr_item_sk = i_item_sk + and d_date in + (select d_date + from plato.date_dim + where d_week_seq in + (select d_week_seq + from plato.date_dim + where d_date in ('1998-01-02'::date,'1998-10-15'::date,'1998-11-10'::date))) + and cr_returned_date_sk = d_date_sk + group by i_item_id), + wr_items as + (select i_item_id item_id, + sum(wr_return_quantity) wr_item_qty + from plato.web_returns, + plato.item, + plato.date_dim + where wr_item_sk = i_item_sk + and d_date in + (select d_date + from plato.date_dim + where d_week_seq in + (select d_week_seq + from plato.date_dim + where d_date in ('1998-01-02'::date,'1998-10-15'::date,'1998-11-10'::date))) + and wr_returned_date_sk = d_date_sk + group by i_item_id) + select sr_items.item_id + ,sr_item_qty + ,sr_item_qty::numeric/(sr_item_qty+cr_item_qty+wr_item_qty)::numeric/3.0::numeric * 100::numeric sr_dev + ,cr_item_qty + ,cr_item_qty::numeric/(sr_item_qty+cr_item_qty+wr_item_qty)::numeric/3.0::numeric * 100::numeric cr_dev + ,wr_item_qty + ,wr_item_qty::numeric/(sr_item_qty+cr_item_qty+wr_item_qty)::numeric/3.0::numeric * 100::numeric wr_dev + ,(sr_item_qty+cr_item_qty+wr_item_qty)::numeric/3.0::numeric average + from sr_items + ,cr_items + ,wr_items + where sr_items.item_id=cr_items.item_id + and sr_items.item_id=wr_items.item_id + order by sr_items.item_id + ,sr_item_qty + limit 100; + +-- end query 1 in stream 0 using template ../query_templates/query83.tpl diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/q84.sql b/yql/essentials/tests/sql/suites/pg-tpcds/q84.sql new file mode 100644 index 0000000000..edb7027691 --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/q84.sql @@ -0,0 +1,24 @@ +--!syntax_pg +--TPC-DS Q84 + +-- start query 1 in stream 0 using template ../query_templates/query84.tpl +select c_customer_id as customer_id + , coalesce(c_last_name,'') || ', ' || coalesce(c_first_name,'') as customername + from plato.customer + ,plato.customer_address + ,plato.customer_demographics + ,plato.household_demographics + ,plato.income_band + ,plato.store_returns + where ca_city = 'Hopewell' + and c_current_addr_sk = ca_address_sk + and ib_lower_bound >= 32287 + and ib_upper_bound <= 32287 + 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; + +-- end query 1 in stream 0 using template ../query_templates/query84.tpl diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/q85.sql b/yql/essentials/tests/sql/suites/pg-tpcds/q85.sql new file mode 100644 index 0000000000..b438fd07c9 --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/q85.sql @@ -0,0 +1,87 @@ +--!syntax_pg +--TPC-DS Q85 + +-- start query 1 in stream 0 using template ../query_templates/query85.tpl +select substr(r_reason_desc,1,20) reason + ,avg(ws_quantity) avg_ws_q + ,avg(wr_refunded_cash) avg_wr_r + ,avg(wr_fee) avg_wr_f + from plato.web_sales, plato.web_returns, plato.web_page, plato.customer_demographics cd1, + plato.customer_demographics cd2, plato.customer_address, plato.date_dim, plato.reason + where ws_web_page_sk = wp_web_page_sk + and ws_item_sk = wr_item_sk + and ws_order_number = wr_order_number + and ws_sold_date_sk = d_date_sk and d_year = 1998 + and cd1.cd_demo_sk = wr_refunded_cdemo_sk + and cd2.cd_demo_sk = wr_returning_cdemo_sk + and ca_address_sk = wr_refunded_addr_sk + and r_reason_sk = wr_reason_sk + and + ( + ( + cd1.cd_marital_status = 'M' + and + cd1.cd_marital_status = cd2.cd_marital_status + and + cd1.cd_education_status = '4 yr Degree' + and + cd1.cd_education_status = cd2.cd_education_status + and + ws_sales_price between 100.00::numeric and 150.00::numeric + ) + or + ( + cd1.cd_marital_status = 'D' + and + cd1.cd_marital_status = cd2.cd_marital_status + and + cd1.cd_education_status = 'Primary' + and + cd1.cd_education_status = cd2.cd_education_status + and + ws_sales_price between 50.00::numeric and 100.00::numeric + ) + or + ( + cd1.cd_marital_status = 'U' + and + cd1.cd_marital_status = cd2.cd_marital_status + and + cd1.cd_education_status = 'Advanced Degree' + and + cd1.cd_education_status = cd2.cd_education_status + and + ws_sales_price between 150.00::numeric and 200.00::numeric + ) + ) + and + ( + ( + ca_country = 'United States' + and + ca_state in ('KY', 'GA', 'NM') + and ws_net_profit between 100::numeric and 200::numeric + ) + or + ( + ca_country = 'United States' + and + ca_state in ('MT', 'OR', 'IN') + and ws_net_profit between 150::numeric and 300::numeric + ) + or + ( + ca_country = 'United States' + and + ca_state in ('WI', 'MO', 'WV') + and ws_net_profit between 50::numeric and 250::numeric + ) + ) +group by r_reason_desc +order by substr(r_reason_desc,1,20) + ,avg(ws_quantity) + ,avg(wr_refunded_cash) + ,avg(wr_fee) +limit 100; + +-- end query 1 in stream 0 using template ../query_templates/query85.tpl diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/q86.sql b/yql/essentials/tests/sql/suites/pg-tpcds/q86.sql new file mode 100644 index 0000000000..0d44f7482b --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/q86.sql @@ -0,0 +1,29 @@ +--!syntax_pg +--TPC-DS Q86 + +-- start query 1 in stream 0 using template ../query_templates/query86.tpl +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 + plato.web_sales + ,plato.date_dim d1 + ,plato.item + where + d1.d_month_seq between 1212 and 1212+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; + +-- end query 1 in stream 0 using template ../query_templates/query86.tpl diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/q87.sql b/yql/essentials/tests/sql/suites/pg-tpcds/q87.sql new file mode 100644 index 0000000000..e3ff56344c --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/q87.sql @@ -0,0 +1,26 @@ +--!syntax_pg +--TPC-DS Q87 + +-- start query 1 in stream 0 using template ../query_templates/query87.tpl +select count(*) +from ((select distinct c_last_name, c_first_name, d_date + from plato.store_sales, plato.date_dim, plato.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 1212 and 1212+11) + except + (select distinct c_last_name, c_first_name, d_date + from plato.catalog_sales, plato.date_dim, plato.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 1212 and 1212+11) + except + (select distinct c_last_name, c_first_name, d_date + from plato.web_sales, plato.date_dim, plato.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 1212 and 1212+11) +) cool_cust +; + +-- end query 1 in stream 0 using template ../query_templates/query87.tpl diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/q88.sql b/yql/essentials/tests/sql/suites/pg-tpcds/q88.sql new file mode 100644 index 0000000000..e2887788ed --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/q88.sql @@ -0,0 +1,97 @@ +--!syntax_pg +--TPC-DS Q88 + +-- start query 1 in stream 0 using template ../query_templates/query88.tpl +select * +from + (select count(*) h8_30_to_9 + from plato.store_sales, plato.household_demographics , plato.time_dim, plato.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 household_demographics.hd_vehicle_count<=3+2) or + (household_demographics.hd_dep_count = 0 and household_demographics.hd_vehicle_count<=0+2) or + (household_demographics.hd_dep_count = 1 and household_demographics.hd_vehicle_count<=1+2)) + and store.s_store_name = 'ese') s1, + (select count(*) h9_to_9_30 + from plato.store_sales, plato.household_demographics , plato.time_dim, plato.store + where ss_sold_time_sk = time_dim.t_time_sk + and ss_hdemo_sk = household_demographics.hd_demo_sk + and ss_store_sk = s_store_sk + and time_dim.t_hour = 9 + and time_dim.t_minute < 30 + and ((household_demographics.hd_dep_count = 3 and household_demographics.hd_vehicle_count<=3+2) or + (household_demographics.hd_dep_count = 0 and household_demographics.hd_vehicle_count<=0+2) or + (household_demographics.hd_dep_count = 1 and household_demographics.hd_vehicle_count<=1+2)) + and store.s_store_name = 'ese') s2, + (select count(*) h9_30_to_10 + from plato.store_sales, plato.household_demographics , plato.time_dim, plato.store + where ss_sold_time_sk = time_dim.t_time_sk + and ss_hdemo_sk = household_demographics.hd_demo_sk + and ss_store_sk = s_store_sk + and time_dim.t_hour = 9 + and time_dim.t_minute >= 30 + and ((household_demographics.hd_dep_count = 3 and household_demographics.hd_vehicle_count<=3+2) or + (household_demographics.hd_dep_count = 0 and household_demographics.hd_vehicle_count<=0+2) or + (household_demographics.hd_dep_count = 1 and household_demographics.hd_vehicle_count<=1+2)) + and store.s_store_name = 'ese') s3, + (select count(*) h10_to_10_30 + from plato.store_sales, plato.household_demographics , plato.time_dim, plato.store + where ss_sold_time_sk = time_dim.t_time_sk + and ss_hdemo_sk = household_demographics.hd_demo_sk + and ss_store_sk = s_store_sk + and time_dim.t_hour = 10 + and time_dim.t_minute < 30 + and ((household_demographics.hd_dep_count = 3 and household_demographics.hd_vehicle_count<=3+2) or + (household_demographics.hd_dep_count = 0 and household_demographics.hd_vehicle_count<=0+2) or + (household_demographics.hd_dep_count = 1 and household_demographics.hd_vehicle_count<=1+2)) + and store.s_store_name = 'ese') s4, + (select count(*) h10_30_to_11 + from plato.store_sales, plato.household_demographics , plato.time_dim, plato.store + where ss_sold_time_sk = time_dim.t_time_sk + and ss_hdemo_sk = household_demographics.hd_demo_sk + and ss_store_sk = s_store_sk + and time_dim.t_hour = 10 + and time_dim.t_minute >= 30 + and ((household_demographics.hd_dep_count = 3 and household_demographics.hd_vehicle_count<=3+2) or + (household_demographics.hd_dep_count = 0 and household_demographics.hd_vehicle_count<=0+2) or + (household_demographics.hd_dep_count = 1 and household_demographics.hd_vehicle_count<=1+2)) + and store.s_store_name = 'ese') s5, + (select count(*) h11_to_11_30 + from plato.store_sales, plato.household_demographics , plato.time_dim, plato.store + where ss_sold_time_sk = time_dim.t_time_sk + and ss_hdemo_sk = household_demographics.hd_demo_sk + and ss_store_sk = s_store_sk + and time_dim.t_hour = 11 + and time_dim.t_minute < 30 + and ((household_demographics.hd_dep_count = 3 and household_demographics.hd_vehicle_count<=3+2) or + (household_demographics.hd_dep_count = 0 and household_demographics.hd_vehicle_count<=0+2) or + (household_demographics.hd_dep_count = 1 and household_demographics.hd_vehicle_count<=1+2)) + and store.s_store_name = 'ese') s6, + (select count(*) h11_30_to_12 + from plato.store_sales, plato.household_demographics , plato.time_dim, plato.store + where ss_sold_time_sk = time_dim.t_time_sk + and ss_hdemo_sk = household_demographics.hd_demo_sk + and ss_store_sk = s_store_sk + and time_dim.t_hour = 11 + and time_dim.t_minute >= 30 + and ((household_demographics.hd_dep_count = 3 and household_demographics.hd_vehicle_count<=3+2) or + (household_demographics.hd_dep_count = 0 and household_demographics.hd_vehicle_count<=0+2) or + (household_demographics.hd_dep_count = 1 and household_demographics.hd_vehicle_count<=1+2)) + and store.s_store_name = 'ese') s7, + (select count(*) h12_to_12_30 + from plato.store_sales, plato.household_demographics , plato.time_dim, plato.store + where ss_sold_time_sk = time_dim.t_time_sk + and ss_hdemo_sk = household_demographics.hd_demo_sk + and ss_store_sk = s_store_sk + and time_dim.t_hour = 12 + and time_dim.t_minute < 30 + and ((household_demographics.hd_dep_count = 3 and household_demographics.hd_vehicle_count<=3+2) or + (household_demographics.hd_dep_count = 0 and household_demographics.hd_vehicle_count<=0+2) or + (household_demographics.hd_dep_count = 1 and household_demographics.hd_vehicle_count<=1+2)) + and store.s_store_name = 'ese') s8 +; + +-- end query 1 in stream 0 using template ../query_templates/query88.tpl diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/q89.sql b/yql/essentials/tests/sql/suites/pg-tpcds/q89.sql new file mode 100644 index 0000000000..7bc365056a --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/q89.sql @@ -0,0 +1,31 @@ +--!syntax_pg +--TPC-DS Q89 + +-- start query 1 in stream 0 using template ../query_templates/query89.tpl +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 plato.item, plato.store_sales, plato.date_dim, plato.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 (2000) and + ((i_category in ('Home','Books','Electronics') and + i_class in ('wallpaper','parenting','musical') + ) + or (i_category in ('Shoes','Jewelry','Men') and + i_class in ('womens','birdal','pants') + )) +group by i_category, i_class, i_brand, + s_store_name, s_company_name, d_moy) tmp1 +where case when (avg_monthly_sales <> 0::numeric) then (abs(sum_sales - avg_monthly_sales) / avg_monthly_sales) else null::numeric end > 0.1::numeric +order by sum_sales - avg_monthly_sales, s_store_name +limit 100; + +-- end query 1 in stream 0 using template ../query_templates/query89.tpl diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/q90.sql b/yql/essentials/tests/sql/suites/pg-tpcds/q90.sql new file mode 100644 index 0000000000..cf4342c67c --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/q90.sql @@ -0,0 +1,25 @@ +--!syntax_pg +--TPC-DS Q90 + +-- start query 1 in stream 0 using template ../query_templates/query90.tpl +select cast(amc as decimal(15,4))/cast(pmc as decimal(15,4)) am_pm_ratio + from ( select count(*) amc + from plato.web_sales, plato.household_demographics , plato.time_dim, plato.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 6 and 6+1 + and household_demographics.hd_dep_count = 8 + and web_page.wp_char_count between 5000 and 5200) at, + ( select 1 + count(*) pmc + from plato.web_sales, plato.household_demographics , plato.time_dim, plato.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 14 and 14+1 + and household_demographics.hd_dep_count = 8 + and web_page.wp_char_count between 5000 and 5200) pt + order by am_pm_ratio + limit 100; + +-- end query 1 in stream 0 using template ../query_templates/query90.tpl diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/q91.sql b/yql/essentials/tests/sql/suites/pg-tpcds/q91.sql new file mode 100644 index 0000000000..3fa68d2371 --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/q91.sql @@ -0,0 +1,34 @@ +--!syntax_pg +--TPC-DS Q91 + +-- start query 1 in stream 0 using template ../query_templates/query91.tpl +select + cc_call_center_id Call_Center, + cc_name Call_Center_Name, + cc_manager Manager, + sum(cr_net_loss) Returns_Loss +from + plato.call_center, + plato.catalog_returns, + plato.date_dim, + plato.customer, + plato.customer_address, + plato.customer_demographics, + plato.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 = 1999 +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 '0-500%' +and ca_gmt_offset = -7::numeric +group by cc_call_center_id,cc_name,cc_manager,cd_marital_status,cd_education_status +order by sum(cr_net_loss) desc; + +-- end query 1 in stream 0 using template ../query_templates/query91.tpl diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/q92.sql b/yql/essentials/tests/sql/suites/pg-tpcds/q92.sql new file mode 100644 index 0000000000..262bcdc718 --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/q92.sql @@ -0,0 +1,33 @@ +--!syntax_pg +--TPC-DS Q92 + +-- start query 1 in stream 0 using template ../query_templates/query92.tpl +select + sum(ws_ext_discount_amt) as "Excess Discount Amount" +from + plato.web_sales + ,plato.item + ,plato.date_dim +where +i_manufact_id = 269 +and i_item_sk = ws_item_sk +and d_date between '1998-03-18'::date and + (cast('1998-03-18' as date) + interval '90' day)::date +and d_date_sk = ws_sold_date_sk +and ws_ext_discount_amt + > ( + SELECT + 1.3::numeric * avg(ws_ext_discount_amt) + FROM + plato.web_sales + ,plato.date_dim + WHERE + ws_item_sk = i_item_sk + and d_date between '1998-03-18'::date and + (cast('1998-03-18' as date) + interval '90' day)::date + and d_date_sk = ws_sold_date_sk + ) +order by sum(ws_ext_discount_amt) +limit 100; + +-- end query 1 in stream 0 using template ../query_templates/query92.tpl diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/q93.sql b/yql/essentials/tests/sql/suites/pg-tpcds/q93.sql new file mode 100644 index 0000000000..4dadc188eb --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/q93.sql @@ -0,0 +1,21 @@ +--!syntax_pg +--TPC-DS Q93 + +-- start query 1 in stream 0 using template ../query_templates/query93.tpl +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)::numeric*ss_sales_price + else (ss_quantity::numeric*ss_sales_price) end act_sales + from plato.store_sales left outer join plato.store_returns on (sr_item_sk = ss_item_sk + and sr_ticket_number = ss_ticket_number) + ,plato.reason + where sr_reason_sk = r_reason_sk + and r_reason_desc = 'Did not like the warranty') t + group by ss_customer_sk + order by sumsales, ss_customer_sk +limit 100; + +-- end query 1 in stream 0 using template ../query_templates/query93.tpl diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/q94.sql b/yql/essentials/tests/sql/suites/pg-tpcds/q94.sql new file mode 100644 index 0000000000..daacc6aa7e --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/q94.sql @@ -0,0 +1,32 @@ +--!syntax_pg +--TPC-DS Q94 + +-- start query 1 in stream 0 using template ../query_templates/query94.tpl +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 + plato.web_sales ws1 + ,plato.date_dim + ,plato.customer_address + ,plato.web_site +where + d_date between '1999-5-01'::date and + (cast('1999-5-01' as date) + interval '60' day)::date +and ws1.ws_ship_date_sk = d_date_sk +and ws1.ws_ship_addr_sk = ca_address_sk +and ca_state = 'TX' +and ws1.ws_web_site_sk = web_site_sk +and web_company_name = 'pri' +and exists (select * + from plato.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 plato.web_returns wr1 + where ws1.ws_order_number = wr1.wr_order_number) +order by count(distinct ws_order_number) +limit 100; + +-- end query 1 in stream 0 using template ../query_templates/query94.tpl diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/q95.sql b/yql/essentials/tests/sql/suites/pg-tpcds/q95.sql new file mode 100644 index 0000000000..22bf4259f4 --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/q95.sql @@ -0,0 +1,35 @@ +--!syntax_pg +--TPC-DS Q95 + +-- start query 1 in stream 0 using template ../query_templates/query95.tpl +with ws_wh as +(select ws1.ws_order_number,ws1.ws_warehouse_sk wh1,ws2.ws_warehouse_sk wh2 + from plato.web_sales ws1,plato.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 + plato.web_sales ws1 + ,plato.date_dim + ,plato.customer_address + ,plato.web_site +where + d_date between '1999-5-01'::date and + (cast('1999-5-01' as date) + interval '60' day)::date +and ws1.ws_ship_date_sk = d_date_sk +and ws1.ws_ship_addr_sk = ca_address_sk +and ca_state = 'TX' +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 plato.web_returns,ws_wh + where wr_order_number = ws_wh.ws_order_number) +order by count(distinct ws_order_number) +limit 100; + +-- end query 1 in stream 0 using template ../query_templates/query95.tpl diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/q96.sql b/yql/essentials/tests/sql/suites/pg-tpcds/q96.sql new file mode 100644 index 0000000000..d7b1e2032b --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/q96.sql @@ -0,0 +1,19 @@ +--!syntax_pg +--TPC-DS Q96 + +-- start query 1 in stream 0 using template ../query_templates/query96.tpl +select count(*) +from plato.store_sales + ,plato.household_demographics + ,plato.time_dim, plato.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 = 5 + and store.s_store_name = 'ese' +order by count(*) +limit 100; + +-- end query 1 in stream 0 using template ../query_templates/query96.tpl diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/q97.sql b/yql/essentials/tests/sql/suites/pg-tpcds/q97.sql new file mode 100644 index 0000000000..6202209359 --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/q97.sql @@ -0,0 +1,28 @@ +--!syntax_pg +--TPC-DS Q97 + +-- start query 1 in stream 0 using template ../query_templates/query97.tpl +with ssci as ( +select ss_customer_sk customer_sk + ,ss_item_sk item_sk +from plato.store_sales,plato.date_dim +where ss_sold_date_sk = d_date_sk + and d_month_seq between 1212 and 1212 + 11 +group by ss_customer_sk + ,ss_item_sk), +csci as( + select cs_bill_customer_sk customer_sk + ,cs_item_sk item_sk +from plato.catalog_sales,plato.date_dim +where cs_sold_date_sk = d_date_sk + and d_month_seq between 1212 and 1212 + 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; + +-- end query 1 in stream 0 using template ../query_templates/query97.tpl diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/q98.sql b/yql/essentials/tests/sql/suites/pg-tpcds/q98.sql new file mode 100644 index 0000000000..a6342cfc08 --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/q98.sql @@ -0,0 +1,36 @@ +--!syntax_pg +--TPC-DS Q98 + +-- start query 1 in stream 0 using template ../query_templates/query98.tpl +select i_item_id + ,i_item_desc + ,i_category + ,i_class + ,i_current_price + ,sum(ss_ext_sales_price) as itemrevenue + ,sum(ss_ext_sales_price)*100::numeric/sum(sum(ss_ext_sales_price)) over + (partition by i_class) as revenueratio +from + plato.store_sales + ,plato.item + ,plato.date_dim +where + ss_item_sk = i_item_sk + and i_category in ('Jewelry', 'Sports', 'Books') + and ss_sold_date_sk = d_date_sk + and d_date between cast('2001-01-12' as date) + and (cast('2001-01-12' as date) + interval '30' day)::date +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; + +-- end query 1 in stream 0 using template ../query_templates/query98.tpl diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/q99.sql b/yql/essentials/tests/sql/suites/pg-tpcds/q99.sql new file mode 100644 index 0000000000..997a52b9c3 --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/q99.sql @@ -0,0 +1,38 @@ +--!syntax_pg +--TPC-DS Q99 + +-- start query 1 in stream 0 using template ../query_templates/query99.tpl +select + substr(w_warehouse_name,1,20) + ,sm_type + ,cc_name + ,sum(case when (cs_ship_date_sk - cs_sold_date_sk <= 30 ) then 1 else 0 end) as "30 days" + ,sum(case when (cs_ship_date_sk - cs_sold_date_sk > 30) and + (cs_ship_date_sk - cs_sold_date_sk <= 60) then 1 else 0 end ) as "31-60 days" + ,sum(case when (cs_ship_date_sk - cs_sold_date_sk > 60) and + (cs_ship_date_sk - cs_sold_date_sk <= 90) then 1 else 0 end) as "61-90 days" + ,sum(case when (cs_ship_date_sk - cs_sold_date_sk > 90) and + (cs_ship_date_sk - cs_sold_date_sk <= 120) then 1 else 0 end) as "91-120 days" + ,sum(case when (cs_ship_date_sk - cs_sold_date_sk > 120) then 1 else 0 end) as ">120 days" +from + plato.catalog_sales + ,plato.warehouse + ,plato.ship_mode + ,plato.call_center + ,plato.date_dim +where + d_month_seq between 1212 and 1212 + 11 +and cs_ship_date_sk = d_date_sk +and cs_warehouse_sk = w_warehouse_sk +and cs_ship_mode_sk = sm_ship_mode_sk +and cs_call_center_sk = cc_call_center_sk +group by + substr(w_warehouse_name,1,20) + ,sm_type + ,cc_name +order by substr(w_warehouse_name,1,20) + ,sm_type + ,cc_name +limit 100; + +-- end query 1 in stream 0 using template ../query_templates/query99.tpl diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/reason.txt b/yql/essentials/tests/sql/suites/pg-tpcds/reason.txt new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/reason.txt diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/reason.txt.attr b/yql/essentials/tests/sql/suites/pg-tpcds/reason.txt.attr new file mode 100644 index 0000000000..fd3f41bb77 --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/reason.txt.attr @@ -0,0 +1,9 @@ +{ + "_yql_row_spec"={ + "Type"=["StructType";[ + ["r_reason_sk";["PgType";"int4";];]; + ["r_reason_id";["PgType";"text";];]; + ["r_reason_desc";["PgType";"text";];]; + ];]; + } +} diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/ship_mode.txt b/yql/essentials/tests/sql/suites/pg-tpcds/ship_mode.txt new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/ship_mode.txt diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/ship_mode.txt.attr b/yql/essentials/tests/sql/suites/pg-tpcds/ship_mode.txt.attr new file mode 100644 index 0000000000..51e9bb003e --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/ship_mode.txt.attr @@ -0,0 +1,12 @@ +{ + "_yql_row_spec"={ + "Type"=["StructType";[ + ["sm_ship_mode_sk";["PgType";"int4";];]; + ["sm_ship_mode_id";["PgType";"text";];]; + ["sm_type";["PgType";"text";];]; + ["sm_code";["PgType";"text";];]; + ["sm_carrier";["PgType";"text";];]; + ["sm_contract";["PgType";"text";];]; + ];]; + } +} diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/store.txt b/yql/essentials/tests/sql/suites/pg-tpcds/store.txt new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/store.txt diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/store.txt.attr b/yql/essentials/tests/sql/suites/pg-tpcds/store.txt.attr new file mode 100644 index 0000000000..20fb103d16 --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/store.txt.attr @@ -0,0 +1,35 @@ +{ + "_yql_row_spec"={ + "Type"=["StructType";[ + ["s_store_sk";["PgType";"int4";];]; + ["s_store_id";["PgType";"text";];]; + ["s_rec_start_date";["PgType";"date";];]; + ["s_rec_end_date";["PgType";"date";];]; + ["s_closed_date_sk";["PgType";"int4";];]; + ["s_store_name";["PgType";"text";];]; + ["s_number_employees";["PgType";"int4";];]; + ["s_floor_space";["PgType";"int4";];]; + ["s_hours";["PgType";"text";];]; + ["s_manager";["PgType";"text";];]; + ["s_market_id";["PgType";"int4";];]; + ["s_geography_class";["PgType";"text";];]; + ["s_market_desc";["PgType";"text";];]; + ["s_market_manager";["PgType";"text";];]; + ["s_division_id";["PgType";"int4";];]; + ["s_division_name";["PgType";"text";];]; + ["s_company_id";["PgType";"int4";];]; + ["s_company_name";["PgType";"text";];]; + ["s_street_number";["PgType";"text";];]; + ["s_street_name";["PgType";"text";];]; + ["s_street_type";["PgType";"text";];]; + ["s_suite_number";["PgType";"text";];]; + ["s_city";["PgType";"text";];]; + ["s_county";["PgType";"text";];]; + ["s_state";["PgType";"text";];]; + ["s_zip";["PgType";"text";];]; + ["s_country";["PgType";"text";];]; + ["s_gmt_offset";["PgType";"numeric";];]; + ["s_tax_precentage";["PgType";"numeric";];]; + ];]; + } +} diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/store_returns.txt b/yql/essentials/tests/sql/suites/pg-tpcds/store_returns.txt new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/store_returns.txt diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/store_returns.txt.attr b/yql/essentials/tests/sql/suites/pg-tpcds/store_returns.txt.attr new file mode 100644 index 0000000000..19ce866250 --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/store_returns.txt.attr @@ -0,0 +1,26 @@ +{ + "_yql_row_spec"={ + "Type"=["StructType";[ + ["sr_returned_date_sk";["PgType";"int4";];]; + ["sr_return_time_sk";["PgType";"int4";];]; + ["sr_item_sk";["PgType";"int4";];]; + ["sr_customer_sk";["PgType";"int4";];]; + ["sr_cdemo_sk";["PgType";"int4";];]; + ["sr_hdemo_sk";["PgType";"int4";];]; + ["sr_addr_sk";["PgType";"int4";];]; + ["sr_store_sk";["PgType";"int4";];]; + ["sr_reason_sk";["PgType";"int4";];]; + ["sr_ticket_number";["PgType";"int4";];]; + ["sr_return_quantity";["PgType";"int4";];]; + ["sr_return_amt";["PgType";"numeric";];]; + ["sr_return_tax";["PgType";"numeric";];]; + ["sr_return_amt_inc_tax";["PgType";"numeric";];]; + ["sr_fee";["PgType";"numeric";];]; + ["sr_return_ship_cost";["PgType";"numeric";];]; + ["sr_refunded_cash";["PgType";"numeric";];]; + ["sr_reversed_charge";["PgType";"numeric";];]; + ["sr_store_credit";["PgType";"numeric";];]; + ["sr_net_loss";["PgType";"numeric";];]; + ];]; + } +} diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/store_sales.txt b/yql/essentials/tests/sql/suites/pg-tpcds/store_sales.txt new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/store_sales.txt diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/store_sales.txt.attr b/yql/essentials/tests/sql/suites/pg-tpcds/store_sales.txt.attr new file mode 100644 index 0000000000..16235a21fb --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/store_sales.txt.attr @@ -0,0 +1,29 @@ +{ + "_yql_row_spec"={ + "Type"=["StructType";[ + ["ss_sold_date_sk";["PgType";"int4";];]; + ["ss_sold_time_sk";["PgType";"int4";];]; + ["ss_item_sk";["PgType";"int4";];]; + ["ss_customer_sk";["PgType";"int4";];]; + ["ss_cdemo_sk";["PgType";"int4";];]; + ["ss_hdemo_sk";["PgType";"int4";];]; + ["ss_addr_sk";["PgType";"int4";];]; + ["ss_store_sk";["PgType";"int4";];]; + ["ss_promo_sk";["PgType";"int4";];]; + ["ss_ticket_number";["PgType";"int4";];]; + ["ss_quantity";["PgType";"int4";];]; + ["ss_wholesale_cost";["PgType";"numeric";];]; + ["ss_list_price";["PgType";"numeric";];]; + ["ss_sales_price";["PgType";"numeric";];]; + ["ss_ext_discount_amt";["PgType";"numeric";];]; + ["ss_ext_sales_price";["PgType";"numeric";];]; + ["ss_ext_wholesale_cost";["PgType";"numeric";];]; + ["ss_ext_list_price";["PgType";"numeric";];]; + ["ss_ext_tax";["PgType";"numeric";];]; + ["ss_coupon_amt";["PgType";"numeric";];]; + ["ss_net_paid";["PgType";"numeric";];]; + ["ss_net_paid_inc_tax";["PgType";"numeric";];]; + ["ss_net_profit";["PgType";"numeric";];]; + ];]; + } +} diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/time_dim.txt b/yql/essentials/tests/sql/suites/pg-tpcds/time_dim.txt new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/time_dim.txt diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/time_dim.txt.attr b/yql/essentials/tests/sql/suites/pg-tpcds/time_dim.txt.attr new file mode 100644 index 0000000000..4ce0b9f06d --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/time_dim.txt.attr @@ -0,0 +1,16 @@ +{ + "_yql_row_spec"={ + "Type"=["StructType";[ + ["t_time_sk";["PgType";"int4";];]; + ["t_time_id";["PgType";"text";];]; + ["t_time";["PgType";"int4";];]; + ["t_hour";["PgType";"int4";];]; + ["t_minute";["PgType";"int4";];]; + ["t_second";["PgType";"int4";];]; + ["t_am_pm";["PgType";"text";];]; + ["t_shift";["PgType";"text";];]; + ["t_sub_shift";["PgType";"text";];]; + ["t_meal_time";["PgType";"text";];]; + ];]; + } +} diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/warehouse.txt b/yql/essentials/tests/sql/suites/pg-tpcds/warehouse.txt new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/warehouse.txt diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/warehouse.txt.attr b/yql/essentials/tests/sql/suites/pg-tpcds/warehouse.txt.attr new file mode 100644 index 0000000000..1bb8d17441 --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/warehouse.txt.attr @@ -0,0 +1,20 @@ +{ + "_yql_row_spec"={ + "Type"=["StructType";[ + ["w_warehouse_sk";["PgType";"int4";];]; + ["w_warehouse_id";["PgType";"text";];]; + ["w_warehouse_name";["PgType";"text";];]; + ["w_warehouse_sq_ft";["PgType";"int4";];]; + ["w_street_number";["PgType";"text";];]; + ["w_street_name";["PgType";"text";];]; + ["w_street_type";["PgType";"text";];]; + ["w_suite_number";["PgType";"text";];]; + ["w_city";["PgType";"text";];]; + ["w_county";["PgType";"text";];]; + ["w_state";["PgType";"text";];]; + ["w_zip";["PgType";"text";];]; + ["w_country";["PgType";"text";];]; + ["w_gmt_offset";["PgType";"numeric";];]; + ];]; + } +} diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/web_page.txt b/yql/essentials/tests/sql/suites/pg-tpcds/web_page.txt new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/web_page.txt diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/web_page.txt.attr b/yql/essentials/tests/sql/suites/pg-tpcds/web_page.txt.attr new file mode 100644 index 0000000000..627f5e6b90 --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/web_page.txt.attr @@ -0,0 +1,20 @@ +{ + "_yql_row_spec"={ + "Type"=["StructType";[ + ["wp_web_page_sk";["PgType";"int4";];]; + ["wp_web_page_id";["PgType";"text";];]; + ["wp_rec_start_date";["PgType";"date";];]; + ["wp_rec_end_date";["PgType";"date";];]; + ["wp_creation_date_sk";["PgType";"int4";];]; + ["wp_access_date_sk";["PgType";"int4";];]; + ["wp_autogen_flag";["PgType";"text";];]; + ["wp_customer_sk";["PgType";"int4";];]; + ["wp_url";["PgType";"text";];]; + ["wp_type";["PgType";"text";];]; + ["wp_char_count";["PgType";"int4";];]; + ["wp_link_count";["PgType";"int4";];]; + ["wp_image_count";["PgType";"int4";];]; + ["wp_max_ad_count";["PgType";"int4";];]; + ];]; + } +} diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/web_returns.txt b/yql/essentials/tests/sql/suites/pg-tpcds/web_returns.txt new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/web_returns.txt diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/web_returns.txt.attr b/yql/essentials/tests/sql/suites/pg-tpcds/web_returns.txt.attr new file mode 100644 index 0000000000..591d69b136 --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/web_returns.txt.attr @@ -0,0 +1,30 @@ +{ + "_yql_row_spec"={ + "Type"=["StructType";[ + ["wr_returned_date_sk";["PgType";"int4";];]; + ["wr_returned_time_sk";["PgType";"int4";];]; + ["wr_item_sk";["PgType";"int4";];]; + ["wr_refunded_customer_sk";["PgType";"int4";];]; + ["wr_refunded_cdemo_sk";["PgType";"int4";];]; + ["wr_refunded_hdemo_sk";["PgType";"int4";];]; + ["wr_refunded_addr_sk";["PgType";"int4";];]; + ["wr_returning_customer_sk";["PgType";"int4";];]; + ["wr_returning_cdemo_sk";["PgType";"int4";];]; + ["wr_returning_hdemo_sk";["PgType";"int4";];]; + ["wr_returning_addr_sk";["PgType";"int4";];]; + ["wr_web_page_sk";["PgType";"int4";];]; + ["wr_reason_sk";["PgType";"int4";];]; + ["wr_order_number";["PgType";"int4";];]; + ["wr_return_quantity";["PgType";"int4";];]; + ["wr_return_amt";["PgType";"numeric";];]; + ["wr_return_tax";["PgType";"numeric";];]; + ["wr_return_amt_inc_tax";["PgType";"numeric";];]; + ["wr_fee";["PgType";"numeric";];]; + ["wr_return_ship_cost";["PgType";"numeric";];]; + ["wr_refunded_cash";["PgType";"numeric";];]; + ["wr_reversed_charge";["PgType";"numeric";];]; + ["wr_account_credit";["PgType";"numeric";];]; + ["wr_net_loss";["PgType";"numeric";];]; + ];]; + } +} diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/web_sales.txt b/yql/essentials/tests/sql/suites/pg-tpcds/web_sales.txt new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/web_sales.txt diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/web_sales.txt.attr b/yql/essentials/tests/sql/suites/pg-tpcds/web_sales.txt.attr new file mode 100644 index 0000000000..7a4c5dda75 --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/web_sales.txt.attr @@ -0,0 +1,40 @@ +{ + "_yql_row_spec"={ + "Type"=["StructType";[ + ["ws_sold_date_sk";["PgType";"int4";];]; + ["ws_sold_time_sk";["PgType";"int4";];]; + ["ws_ship_date_sk";["PgType";"int4";];]; + ["ws_item_sk";["PgType";"int4";];]; + ["ws_bill_customer_sk";["PgType";"int4";];]; + ["ws_bill_cdemo_sk";["PgType";"int4";];]; + ["ws_bill_hdemo_sk";["PgType";"int4";];]; + ["ws_bill_addr_sk";["PgType";"int4";];]; + ["ws_ship_customer_sk";["PgType";"int4";];]; + ["ws_ship_cdemo_sk";["PgType";"int4";];]; + ["ws_ship_hdemo_sk";["PgType";"int4";];]; + ["ws_ship_addr_sk";["PgType";"int4";];]; + ["ws_web_page_sk";["PgType";"int4";];]; + ["ws_web_site_sk";["PgType";"int4";];]; + ["ws_ship_mode_sk";["PgType";"int4";];]; + ["ws_warehouse_sk";["PgType";"int4";];]; + ["ws_promo_sk";["PgType";"int4";];]; + ["ws_order_number";["PgType";"int4";];]; + ["ws_quantity";["PgType";"int4";];]; + ["ws_wholesale_cost";["PgType";"numeric";];]; + ["ws_list_price";["PgType";"numeric";];]; + ["ws_sales_price";["PgType";"numeric";];]; + ["ws_ext_discount_amt";["PgType";"numeric";];]; + ["ws_ext_sales_price";["PgType";"numeric";];]; + ["ws_ext_wholesale_cost";["PgType";"numeric";];]; + ["ws_ext_list_price";["PgType";"numeric";];]; + ["ws_ext_tax";["PgType";"numeric";];]; + ["ws_coupon_amt";["PgType";"numeric";];]; + ["ws_ext_ship_cost";["PgType";"numeric";];]; + ["ws_net_paid";["PgType";"numeric";];]; + ["ws_net_paid_inc_tax";["PgType";"numeric";];]; + ["ws_net_paid_inc_ship";["PgType";"numeric";];]; + ["ws_net_paid_inc_ship_tax";["PgType";"numeric";];]; + ["ws_net_profit";["PgType";"numeric";];]; + ];]; + } +} diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/web_site.txt b/yql/essentials/tests/sql/suites/pg-tpcds/web_site.txt new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/web_site.txt diff --git a/yql/essentials/tests/sql/suites/pg-tpcds/web_site.txt.attr b/yql/essentials/tests/sql/suites/pg-tpcds/web_site.txt.attr new file mode 100644 index 0000000000..9244afbf49 --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg-tpcds/web_site.txt.attr @@ -0,0 +1,32 @@ +{ + "_yql_row_spec"={ + "Type"=["StructType";[ + ["web_site_sk";["PgType";"int4";];]; + ["web_site_id";["PgType";"text";];]; + ["web_rec_start_date";["PgType";"date";];]; + ["web_rec_end_date";["PgType";"date";];]; + ["web_name";["PgType";"text";];]; + ["web_open_date_sk";["PgType";"int4";];]; + ["web_close_date_sk";["PgType";"int4";];]; + ["web_class";["PgType";"text";];]; + ["web_manager";["PgType";"text";];]; + ["web_mkt_id";["PgType";"int4";];]; + ["web_mkt_class";["PgType";"text";];]; + ["web_mkt_desc";["PgType";"text";];]; + ["web_market_manager";["PgType";"text";];]; + ["web_company_id";["PgType";"int4";];]; + ["web_company_name";["PgType";"text";];]; + ["web_street_number";["PgType";"text";];]; + ["web_street_name";["PgType";"text";];]; + ["web_street_type";["PgType";"text";];]; + ["web_suite_number";["PgType";"text";];]; + ["web_city";["PgType";"text";];]; + ["web_county";["PgType";"text";];]; + ["web_state";["PgType";"text";];]; + ["web_zip";["PgType";"text";];]; + ["web_country";["PgType";"text";];]; + ["web_gmt_offset";["PgType";"numeric";];]; + ["web_tax_percentage";["PgType";"numeric";];]; + ];]; + } +} |