Skip to content

Commit 8bf30fe

Browse files
authored
Fix arithmetic in tpcds queries and switch on checking answers for tpcds s1 (#11425)
1 parent bf2057f commit 8bf30fe

File tree

7 files changed

+9
-8
lines changed

7 files changed

+9
-8
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ select *
2121
and (cast ('2000-03-11' as date) + interval '30' day)::date
2222
group by w_warehouse_name, i_item_id) x
2323
where (case when inv_before > 0
24-
then inv_after / inv_before
24+
then cast(inv_after as double) / inv_before
2525
else null
2626
end) between (2.0/3.0)::numeric and (3.0/2.0)::numeric
2727
order by w_warehouse_name

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ select c_last_name
1818
household_demographics.hd_buy_potential = 'Unknown')
1919
and household_demographics.hd_vehicle_count > 0
2020
and (case when household_demographics.hd_vehicle_count > 0
21-
then household_demographics.hd_dep_count/ household_demographics.hd_vehicle_count
21+
then cast(household_demographics.hd_dep_count as double)/ household_demographics.hd_vehicle_count
2222
else null::int4
2323
end) > 1.2
2424
and date_dim.d_year in (1999,1999+1,1999+2)
@@ -27,6 +27,6 @@ select c_last_name
2727
group by ss_ticket_number,ss_customer_sk) dn,{{customer}}
2828
where ss_customer_sk = c_customer_sk
2929
and cnt between 15::int8 and 20::int8
30-
order by c_last_name,c_first_name,c_salutation,c_preferred_cust_flag desc, ss_ticket_number;
30+
order by c_last_name,c_first_name,c_salutation,c_preferred_cust_flag desc nulls first, ss_ticket_number;
3131

3232
-- end query 1 in stream 0 using template ../query_templates/query34.tpl

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ select c_last_name
1818
household_demographics.hd_buy_potential = 'Unknown')
1919
and household_demographics.hd_vehicle_count > 0
2020
and case when household_demographics.hd_vehicle_count > 0 then
21-
household_demographics.hd_dep_count/ household_demographics.hd_vehicle_count else null::int4 end > 1
21+
cast(household_demographics.hd_dep_count as double)/ household_demographics.hd_vehicle_count else null::int4 end > 1
2222
and date_dim.d_year in (1999,1999+1,1999+2)
2323
and store.s_county in ('Williamson County','Franklin County','Bronx County','Orange County')
2424
group by ss_ticket_number,ss_customer_sk) dj,{{customer}}

ydb/library/benchmarks/queries/tpcds/yql/q21.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ select *
2323
and (cast ('2000-03-11' as date) + DateTime::IntervalFromDays(30))
2424
group by warehouse.w_warehouse_name, item.i_item_id) x
2525
where (case when inv_before > 0
26-
then inv_after / inv_before
26+
then cast(inv_after as double) / inv_before
2727
else null
2828
end) between 2.0/3.0 and 3.0/2.0
2929
order by w_warehouse_name

ydb/library/benchmarks/queries/tpcds/yql/q34.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@ select c_last_name
2222
and (household_demographics.hd_buy_potential = '>10000' or
2323
household_demographics.hd_buy_potential = 'Unknown')
2424
and household_demographics.hd_vehicle_count > 0
25-
and (case when household_demographics.hd_vehicle_count > 0 then household_demographics.hd_dep_count / household_demographics.hd_vehicle_count else null end) > 1.2
25+
and (case when household_demographics.hd_vehicle_count > 0 then cast(household_demographics.hd_dep_count as double) / household_demographics.hd_vehicle_count else null end) > 1.2
2626
and date_dim.d_year in (1999,1999+1,1999+2)
2727
and store.s_county in ('Williamson County','Williamson County','Williamson County','Williamson County',
2828
'Williamson County','Williamson County','Williamson County','Williamson County')
2929
group by store_sales.ss_ticket_number,store_sales.ss_customer_sk) dn
3030
cross join {{customer}} as customer
3131
where ss_customer_sk = c_customer_sk
3232
and cnt between 15 and 20
33-
order by c_last_name,c_first_name,c_salutation,c_preferred_cust_flag desc, ss_ticket_number;
33+
order by c_last_name,c_first_name,c_salutation,coalesce(c_preferred_cust_flag, 'Z') desc, ss_ticket_number;
3434

3535
-- end query 1 in stream 0 using template query34.tpl

ydb/library/benchmarks/queries/tpcds/yql/q73.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ select c_last_name
2222
and (household_demographics.hd_buy_potential = '>10000' or
2323
household_demographics.hd_buy_potential = 'Unknown')
2424
and household_demographics.hd_vehicle_count > 0
25-
and (case when household_demographics.hd_vehicle_count > 0 then household_demographics.hd_dep_count/ household_demographics.hd_vehicle_count else null end) > 1
25+
and (case when household_demographics.hd_vehicle_count > 0 then cast(household_demographics.hd_dep_count as double)/ household_demographics.hd_vehicle_count else null end) > 1
2626
and date_dim.d_year in (1999,1999+1,1999+2)
2727
and store.s_county in ('Williamson County','Franklin County','Bronx County','Orange County')
2828
group by store_sales.ss_ticket_number,store_sales.ss_customer_sk) dj cross join {{customer}} as customer

ydb/tests/olap/load/test_tpcds.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ def test_tpcds(self, query_num: int):
4646

4747
class TestTpcds1(TpcdsSuiteBase):
4848
scale: int = 1
49+
check_canonical: bool = True
4950
tables_size: dict[str, int] = {
5051
'call_center': 6,
5152
'catalog_page': 11718,

0 commit comments

Comments
 (0)