From 4edd4f88c987e76c13912a61205a1fe002d4a6cb Mon Sep 17 00:00:00 2001 From: Alexey Ozeritskiy Date: Mon, 19 Feb 2024 13:31:04 +0100 Subject: [PATCH] Fix pg queries (duplicate column names) (#2057) --- .../benchmarks/queries/tpcds/pg/q02.sql | 14 +++++++------- .../benchmarks/queries/tpcds/pg/q13.sql | 8 ++++---- .../benchmarks/queries/tpcds/pg/q14.sql | 2 +- .../benchmarks/queries/tpcds/pg/q35.sql | 18 +++++++++--------- .../benchmarks/queries/tpcds/pg/q85.sql | 8 ++++---- 5 files changed, 25 insertions(+), 25 deletions(-) diff --git a/ydb/library/benchmarks/queries/tpcds/pg/q02.sql b/ydb/library/benchmarks/queries/tpcds/pg/q02.sql index 1146d4bbba1b..55ff154862ff 100644 --- a/ydb/library/benchmarks/queries/tpcds/pg/q02.sql +++ b/ydb/library/benchmarks/queries/tpcds/pg/q02.sql @@ -24,13 +24,13 @@ with wscs as where d_date_sk = sold_date_sk group by d_week_seq) select d_week_seq1 - ,round(sun_sales1/sun_sales2,2) - ,round(mon_sales1/mon_sales2,2) - ,round(tue_sales1/tue_sales2,2) - ,round(wed_sales1/wed_sales2,2) - ,round(thu_sales1/thu_sales2,2) - ,round(fri_sales1/fri_sales2,2) - ,round(sat_sales1/sat_sales2,2) + ,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 diff --git a/ydb/library/benchmarks/queries/tpcds/pg/q13.sql b/ydb/library/benchmarks/queries/tpcds/pg/q13.sql index 4b959376ef58..d115e7a752bf 100644 --- a/ydb/library/benchmarks/queries/tpcds/pg/q13.sql +++ b/ydb/library/benchmarks/queries/tpcds/pg/q13.sql @@ -1,9 +1,9 @@ {% include 'header.sql.jinja' %} -select avg(ss_quantity) - ,avg(ss_ext_sales_price) - ,avg(ss_ext_wholesale_cost) - ,sum(ss_ext_wholesale_cost) +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 {{store_sales}} ,{{store}} ,{{customer_demographics}} diff --git a/ydb/library/benchmarks/queries/tpcds/pg/q14.sql b/ydb/library/benchmarks/queries/tpcds/pg/q14.sql index ff56ff134a16..6e2b9e598fd0 100644 --- a/ydb/library/benchmarks/queries/tpcds/pg/q14.sql +++ b/ydb/library/benchmarks/queries/tpcds/pg/q14.sql @@ -58,7 +58,7 @@ with cross_items as ,{{date_dim}} where ws_sold_date_sk = d_date_sk and d_year between 2000 and 2000 + 2) x) - select channel, i_brand_id,i_class_id,i_category_id,sum(sales), sum(number_sales) + 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 diff --git a/ydb/library/benchmarks/queries/tpcds/pg/q35.sql b/ydb/library/benchmarks/queries/tpcds/pg/q35.sql index 981d45ed926f..7743aaacaa80 100644 --- a/ydb/library/benchmarks/queries/tpcds/pg/q35.sql +++ b/ydb/library/benchmarks/queries/tpcds/pg/q35.sql @@ -6,19 +6,19 @@ select cd_marital_status, cd_dep_count, count(*) cnt1, - avg(cd_dep_count), - max(cd_dep_count), - sum(cd_dep_count), + 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), - max(cd_dep_employed_count), - sum(cd_dep_employed_count), + 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), - max(cd_dep_college_count), - sum(cd_dep_college_count) + avg(cd_dep_college_count) a3, + max(cd_dep_college_count) x3, + sum(cd_dep_college_count) s3 from {{customer}} c,{{customer_address}} ca,{{customer_demographics}} where diff --git a/ydb/library/benchmarks/queries/tpcds/pg/q85.sql b/ydb/library/benchmarks/queries/tpcds/pg/q85.sql index daf099ee33bd..3c7088f20913 100644 --- a/ydb/library/benchmarks/queries/tpcds/pg/q85.sql +++ b/ydb/library/benchmarks/queries/tpcds/pg/q85.sql @@ -1,9 +1,9 @@ {% include 'header.sql.jinja' %} -select substr(r_reason_desc,1,20) - ,avg(ws_quantity) - ,avg(wr_refunded_cash) - ,avg(wr_fee) +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 {{web_sales}}, {{web_returns}}, {{web_page}}, {{customer_demographics}} cd1, {{customer_demographics}} cd2, {{customer_address}}, {{date_dim}}, {{reason}} where ws_web_page_sk = wp_web_page_sk