Skip to content

Commit cb0a353

Browse files
authored
TPC-DS queries as in specification about qualification (#11172)
1 parent dc81222 commit cb0a353

File tree

200 files changed

+1131
-1132
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

200 files changed

+1131
-1132
lines changed

ydb/library/benchmarks/gen_queries/consts.yql

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ $z0_1_35 = 0.1;
1212
$z1_2_35 = 1.2;
1313
$z0_05_35 = 0.05;
1414
$z0_9_35 = 0.9;
15-
$z0_95_35 = 0.95;
1615
$z1_1_35 = 1.1;
1716
$z0_5_35 = 0.5;
1817
$z100_35 = 100.;

ydb/library/benchmarks/gen_queries/consts_decimal.yql

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ $z0_1_35 = cast("0.1" as decimal(35,2));
1212
$z1_2_35 = cast("1.2" as decimal(35,2));
1313
$z0_05_35 = cast("0.05" as decimal(35,2));
1414
$z0_9_35 = cast("0.9" as decimal(35,2));
15-
$z0_95_35 = cast("0.95" as decimal(35,2));
1615
$z1_1_35 = cast("1.1" as decimal(35,2));
1716
$z0_5_35 = cast("0.5" as decimal(35,2));
1817
$z100_35 = cast(100 as decimal(35,2));

ydb/library/benchmarks/queries/tpcds/pg/q01.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
with customer_total_return as
44
(select sr_customer_sk as ctr_customer_sk
55
,sr_store_sk as ctr_store_sk
6-
,sum(sr_fee) as ctr_total_return
6+
,sum(sr_return_amt) as ctr_total_return
77
from {{store_returns}}
88
,{{date_dim}}
99
where sr_returned_date_sk = d_date_sk
@@ -18,7 +18,7 @@ where ctr1.ctr_total_return > (select avg(ctr_total_return)*1.2
1818
from customer_total_return ctr2
1919
where ctr1.ctr_store_sk = ctr2.ctr_store_sk)
2020
and s_store_sk = ctr1.ctr_store_sk
21-
and s_state = 'NM'
21+
and s_state = 'TN'
2222
and ctr1.ctr_customer_sk = c_customer_sk
2323
order by c_customer_id
2424
limit 100;

ydb/library/benchmarks/queries/tpcds/pg/q02.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ with wscs as
4242
,sat_sales sat_sales1
4343
from wswscs,{{date_dim}}
4444
where date_dim.d_week_seq = wswscs.d_week_seq and
45-
d_year = 1998) y,
45+
d_year = 2001) y,
4646
(select wswscs.d_week_seq d_week_seq2
4747
,sun_sales sun_sales2
4848
,mon_sales mon_sales2
@@ -54,7 +54,7 @@ with wscs as
5454
from wswscs
5555
,{{date_dim}}
5656
where date_dim.d_week_seq = wswscs.d_week_seq and
57-
d_year = 1998+1) z
57+
d_year = 2001+1) z
5858
where d_week_seq1=d_week_seq2-53
5959
order by d_week_seq1;
6060

ydb/library/benchmarks/queries/tpcds/pg/q03.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
select dt.d_year
44
,item.i_brand_id brand_id
55
,item.i_brand brand
6-
,sum(ss_sales_price) sum_agg
6+
,sum(ss_ext_sales_price) sum_agg
77
from {{date_dim}} dt
88
,{{store_sales}}
99
,{{item}}
1010
where dt.d_date_sk = store_sales.ss_sold_date_sk
1111
and store_sales.ss_item_sk = item.i_item_sk
12-
and item.i_manufact_id = 816
12+
and item.i_manufact_id = 128
1313
and dt.d_moy=11
1414
group by dt.d_year
1515
,item.i_brand

ydb/library/benchmarks/queries/tpcds/pg/q04.sql

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ union all
7777
t_s_secyear.customer_id
7878
,t_s_secyear.customer_first_name
7979
,t_s_secyear.customer_last_name
80-
,t_s_secyear.customer_birth_country
80+
,t_s_secyear.customer_preferred_cust_flag
8181
from year_total t_s_firstyear
8282
,year_total t_s_secyear
8383
,year_total t_c_firstyear
@@ -95,12 +95,12 @@ union all
9595
and t_s_secyear.sale_type = 's'
9696
and t_c_secyear.sale_type = 'c'
9797
and t_w_secyear.sale_type = 'w'
98-
and t_s_firstyear.dyear = 1999
99-
and t_s_secyear.dyear = 1999+1
100-
and t_c_firstyear.dyear = 1999
101-
and t_c_secyear.dyear = 1999+1
102-
and t_w_firstyear.dyear = 1999
103-
and t_w_secyear.dyear = 1999+1
98+
and t_s_firstyear.dyear = 2001
99+
and t_s_secyear.dyear = 2001+1
100+
and t_c_firstyear.dyear = 2001
101+
and t_c_secyear.dyear = 2001+1
102+
and t_w_firstyear.dyear = 2001
103+
and t_w_secyear.dyear = 2001+1
104104
and t_s_firstyear.year_total > 0
105105
and t_c_firstyear.year_total > 0
106106
and t_w_firstyear.year_total > 0
@@ -111,7 +111,7 @@ union all
111111
order by t_s_secyear.customer_id
112112
,t_s_secyear.customer_first_name
113113
,t_s_secyear.customer_last_name
114-
,t_s_secyear.customer_birth_country
114+
,t_s_secyear.customer_preferred_cust_flag
115115
limit 100;
116116

117117
-- end query 1 in stream 0 using template ../query_templates/query4.tpl

ydb/library/benchmarks/queries/tpcds/pg/q05.sql

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ with ssr as
2626
{{date_dim}},
2727
{{store}}
2828
where date_sk = d_date_sk
29-
and d_date between cast('2000-08-19' as date)
30-
and (cast('2000-08-19' as date) + interval '14' day)::date
29+
and d_date between cast('2000-08-23' as date)
30+
and (cast('2000-08-23' as date) + interval '14' day)::date
3131
and store_sk = s_store_sk
3232
group by s_store_id)
3333
,
@@ -57,8 +57,8 @@ with ssr as
5757
{{date_dim}},
5858
{{catalog_page}}
5959
where date_sk = d_date_sk
60-
and d_date between cast('2000-08-19' as date)
61-
and (cast('2000-08-19' as date) + interval '14' day)::date
60+
and d_date between cast('2000-08-23' as date)
61+
and (cast('2000-08-23' as date) + interval '14' day)::date
6262
and page_sk = cp_catalog_page_sk
6363
group by cp_catalog_page_id)
6464
,
@@ -90,8 +90,8 @@ with ssr as
9090
{{date_dim}},
9191
{{web_site}}
9292
where date_sk = d_date_sk
93-
and d_date between cast('2000-08-19' as date)
94-
and (cast('2000-08-19' as date) + interval '14' day)::date
93+
and d_date between cast('2000-08-23' as date)
94+
and (cast('2000-08-23' as date) + interval '14' day)::date
9595
and wsr_web_site_sk = web_site_sk
9696
group by web_site_id)
9797
select channel

ydb/library/benchmarks/queries/tpcds/pg/q06.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ select a.ca_state state, count(*) cnt
1313
and d.d_month_seq =
1414
(select distinct (d_month_seq)
1515
from {{date_dim}}
16-
where d_year = 2002
17-
and d_moy = 3 )
16+
where d_year = 2001
17+
and d_moy = 1 )
1818
and i.i_current_price > 1.2 *
1919
(select avg(j.i_current_price)
2020
from {{item}} j

ydb/library/benchmarks/queries/tpcds/pg/q07.sql

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ select i_item_id,
1010
ss_item_sk = i_item_sk and
1111
ss_cdemo_sk = cd_demo_sk and
1212
ss_promo_sk = p_promo_sk and
13-
cd_gender = 'F' and
14-
cd_marital_status = 'W' and
13+
cd_gender = 'M' and
14+
cd_marital_status = 'S' and
1515
cd_education_status = 'College' and
1616
(p_channel_email = 'N' or p_channel_event = 'N') and
17-
d_year = 2001
17+
d_year = 2000
1818
group by i_item_id
1919
order by i_item_id
2020
limit 100;

ydb/library/benchmarks/queries/tpcds/pg/q08.sql

Lines changed: 80 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -10,86 +10,86 @@ select s_store_name
1010
SELECT substr(ca_zip,1,5) ca_zip
1111
FROM {{customer_address}}
1212
WHERE substr(ca_zip,1,5) IN (
13-
'47602','16704','35863','28577','83910','36201',
14-
'58412','48162','28055','41419','80332',
15-
'38607','77817','24891','16226','18410',
16-
'21231','59345','13918','51089','20317',
17-
'17167','54585','67881','78366','47770',
18-
'18360','51717','73108','14440','21800',
19-
'89338','45859','65501','34948','25973',
20-
'73219','25333','17291','10374','18829',
21-
'60736','82620','41351','52094','19326',
22-
'25214','54207','40936','21814','79077',
23-
'25178','75742','77454','30621','89193',
24-
'27369','41232','48567','83041','71948',
25-
'37119','68341','14073','16891','62878',
26-
'49130','19833','24286','27700','40979',
27-
'50412','81504','94835','84844','71954',
28-
'39503','57649','18434','24987','12350',
29-
'86379','27413','44529','98569','16515',
30-
'27287','24255','21094','16005','56436',
31-
'91110','68293','56455','54558','10298',
32-
'83647','32754','27052','51766','19444',
33-
'13869','45645','94791','57631','20712',
34-
'37788','41807','46507','21727','71836',
35-
'81070','50632','88086','63991','20244',
36-
'31655','51782','29818','63792','68605',
37-
'94898','36430','57025','20601','82080',
38-
'33869','22728','35834','29086','92645',
39-
'98584','98072','11652','78093','57553',
40-
'43830','71144','53565','18700','90209',
41-
'71256','38353','54364','28571','96560',
42-
'57839','56355','50679','45266','84680',
43-
'34306','34972','48530','30106','15371',
44-
'92380','84247','92292','68852','13338',
45-
'34594','82602','70073','98069','85066',
46-
'47289','11686','98862','26217','47529',
47-
'63294','51793','35926','24227','14196',
48-
'24594','32489','99060','49472','43432',
49-
'49211','14312','88137','47369','56877',
50-
'20534','81755','15794','12318','21060',
51-
'73134','41255','63073','81003','73873',
52-
'66057','51184','51195','45676','92696',
53-
'70450','90669','98338','25264','38919',
54-
'59226','58581','60298','17895','19489',
55-
'52301','80846','95464','68770','51634',
56-
'19988','18367','18421','11618','67975',
57-
'25494','41352','95430','15734','62585',
58-
'97173','33773','10425','75675','53535',
59-
'17879','41967','12197','67998','79658',
60-
'59130','72592','14851','43933','68101',
61-
'50636','25717','71286','24660','58058',
62-
'72991','95042','15543','33122','69280',
63-
'11912','59386','27642','65177','17672',
64-
'33467','64592','36335','54010','18767',
65-
'63193','42361','49254','33113','33159',
66-
'36479','59080','11855','81963','31016',
67-
'49140','29392','41836','32958','53163',
68-
'13844','73146','23952','65148','93498',
69-
'14530','46131','58454','13376','13378',
70-
'83986','12320','17193','59852','46081',
71-
'98533','52389','13086','68843','31013',
72-
'13261','60560','13443','45533','83583',
73-
'11489','58218','19753','22911','25115',
74-
'86709','27156','32669','13123','51933',
75-
'39214','41331','66943','14155','69998',
76-
'49101','70070','35076','14242','73021',
77-
'59494','15782','29752','37914','74686',
78-
'83086','34473','15751','81084','49230',
79-
'91894','60624','17819','28810','63180',
80-
'56224','39459','55233','75752','43639',
81-
'55349','86057','62361','50788','31830',
82-
'58062','18218','85761','60083','45484',
83-
'21204','90229','70041','41162','35390',
84-
'16364','39500','68908','26689','52868',
85-
'81335','40146','11340','61527','61794',
86-
'71997','30415','59004','29450','58117',
87-
'69952','33562','83833','27385','61860',
88-
'96435','48333','23065','32961','84919',
89-
'61997','99132','22815','56600','68730',
90-
'48017','95694','32919','88217','27116',
91-
'28239','58032','18884','16791','21343',
92-
'97462','18569','75660','15475')
13+
'24128', '57834', '13354', '15734', '78668',
14+
'76232', '62878', '45375', '63435', '22245',
15+
'65084', '49130', '40558', '25733', '15798',
16+
'87816', '81096', '56458', '35474', '27156',
17+
'83926', '18840', '28286', '24676', '37930',
18+
'77556', '27700', '45266', '94627', '62971',
19+
'20548', '23470', '47305', '53535', '21337',
20+
'26231', '50412', '69399', '17879', '51622',
21+
'43848', '21195', '83921', '15559', '67853',
22+
'15126', '16021', '26233', '53268', '10567',
23+
'91137', '76107', '11101', '59166', '38415',
24+
'61265', '71954', '15371', '11928', '15455',
25+
'98294', '68309', '69913', '59402', '58263',
26+
'25782', '18119', '35942', '33282', '42029',
27+
'17920', '98359', '15882', '45721', '60279',
28+
'18426', '64544', '25631', '43933', '37125',
29+
'98235', '10336', '24610', '68101', '56240',
30+
'40081', '86379', '44165', '33515', '88190',
31+
'84093', '27068', '99076', '36634', '50308',
32+
'28577', '39736', '33786', '71286', '26859',
33+
'55565', '98569', '70738', '19736', '64457',
34+
'17183', '28915', '26653', '58058', '89091',
35+
'54601', '24206', '14328', '55253', '82136',
36+
'67897', '56529', '72305', '67473', '62377',
37+
'22752', '57647', '62496', '41918', '36233',
38+
'86284', '54917', '22152', '19515', '63837',
39+
'18376', '42961', '10144', '36495', '58078',
40+
'38607', '91110', '64147', '19430', '17043',
41+
'45200', '63981', '48425', '22351', '30010',
42+
'21756', '14922', '14663', '77191', '60099',
43+
'29741', '36420', '21076', '91393', '28810',
44+
'96765', '23006', '18799', '49156', '98025',
45+
'23932', '67467', '30450', '50298', '29178',
46+
'89360', '32754', '63089', '87501', '87343',
47+
'29839', '30903', '81019', '18652', '73273',
48+
'25989', '20260', '68893', '53179', '30469',
49+
'28898', '31671', '24996', '18767', '64034',
50+
'91068', '51798', '51200', '63193', '39516',
51+
'72550', '72325', '51211', '23968', '86057',
52+
'10390', '85816', '45692', '65164', '21309',
53+
'18845', '68621', '92712', '68880', '90257',
54+
'47770', '13955', '70466', '21286', '67875',
55+
'82636', '36446', '79994', '72823', '40162',
56+
'41367', '41766', '22437', '58470', '11356',
57+
'76638', '68806', '25280', '67301', '73650',
58+
'86198', '16725', '38935', '13394', '61810',
59+
'81312', '15146', '71791', '31016', '72013',
60+
'37126', '22744', '73134', '70372', '30431',
61+
'39192', '35850', '56571', '67030', '22461',
62+
'88424', '88086', '14060', '40604', '19512',
63+
'72175', '51649', '19505', '24317', '13375',
64+
'81426', '18270', '72425', '45748', '55307',
65+
'53672', '52867', '56575', '39127', '30625',
66+
'10445', '39972', '74351', '26065', '83849',
67+
'42666', '96976', '68786', '77721', '68908',
68+
'66864', '63792', '51650', '31029', '26689',
69+
'66708', '11376', '20004', '31880', '96451',
70+
'41248', '94898', '18383', '60576', '38193',
71+
'48583', '13595', '76614', '24671', '46820',
72+
'82276', '10516', '11634', '45549', '88885',
73+
'18842', '90225', '18906', '13376', '84935',
74+
'78890', '58943', '15765', '50016', '69035',
75+
'49448', '39371', '41368', '33123', '83144',
76+
'14089', '94945', '73241', '19769', '47537',
77+
'38122', '28587', '76698', '22927', '56616',
78+
'34425', '96576', '78567', '97789', '94983',
79+
'79077', '57855', '97189', '46081', '48033',
80+
'19849', '28488', '28545', '72151', '69952',
81+
'43285', '26105', '76231', '15723', '25486',
82+
'39861', '83933', '75691', '46136', '61547',
83+
'66162', '25858', '22246', '51949', '27385',
84+
'77610', '34322', '51061', '68100', '61860',
85+
'13695', '44438', '90578', '96888', '58048',
86+
'99543', '73171', '56691', '64528', '56910',
87+
'83444', '30122', '68014', '14171', '16807',
88+
'83041', '34102', '51103', '79777', '17871',
89+
'12305', '22685', '94167', '28709', '35258',
90+
'57665', '71256', '57047', '11489', '31387',
91+
'68341', '78451', '14867', '25103', '35458',
92+
'25003', '54364', '73520', '32213', '35576')
9393
intersect
9494
select ca_zip
9595
from (SELECT substr(ca_zip,1,5) ca_zip,count(*) cnt

0 commit comments

Comments
 (0)