Skip to content

Commit

Permalink
Fix pg queries (duplicate column names) (#2057)
Browse files Browse the repository at this point in the history
  • Loading branch information
resetius authored Feb 19, 2024
1 parent b50baf6 commit 4edd4f8
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 25 deletions.
14 changes: 7 additions & 7 deletions ydb/library/benchmarks/queries/tpcds/pg/q02.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions ydb/library/benchmarks/queries/tpcds/pg/q13.sql
Original file line number Diff line number Diff line change
@@ -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}}
Expand Down
2 changes: 1 addition & 1 deletion ydb/library/benchmarks/queries/tpcds/pg/q14.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
18 changes: 9 additions & 9 deletions ydb/library/benchmarks/queries/tpcds/pg/q35.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions ydb/library/benchmarks/queries/tpcds/pg/q85.sql
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit 4edd4f8

Please sign in to comment.