Skip to content

Commit

Permalink
e2e(tpch): open some tpch with changing query workaround (#2262)
Browse files Browse the repository at this point in the history
* join reorder by changing query in manual

* open tpch q2 q8 q9 e2e test

* remove planner test todo for topN

* open tpch q12 for batch

* delta join tpch q8 q9 file name

* planner test batch/stream plan for q18 & q20

* fix typo

* open e2e batch q18 q20

* fix comments

* add q21 q22 planner test
  • Loading branch information
st1page authored May 3, 2022
1 parent 822d7b3 commit adc8cc4
Show file tree
Hide file tree
Showing 13 changed files with 797 additions and 120 deletions.
49 changes: 49 additions & 0 deletions e2e_test/batch/tpch/q2.join_reorder.workaround.slt.part
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# TODO(#1866): here changing tables' order in query, now our rust fe without join reorder avoiding cross join
query RTTITTTT
select
s_acctbal,
s_name,
n_name,
p_partkey,
p_mfgr,
s_address,
s_phone,
s_comment
from
partsupp,
part,
supplier,
nation,
region
where
p_partkey = ps_partkey
and s_suppkey = ps_suppkey
and p_size = 4
and p_type like '%TIN'
and s_nationkey = n_nationkey
and n_regionkey = r_regionkey
and r_name = 'AFRICA'
and ps_supplycost = (
select
min(ps_supplycost)
from
partsupp,
supplier,
nation,
region
where
p_partkey = ps_partkey
and s_suppkey = ps_suppkey
and s_nationkey = n_nationkey
and n_regionkey = r_regionkey
and r_name = 'AFRICA'
)
order by
s_acctbal desc,
n_name,
s_name,
p_partkey
limit 100;
----
4641.08 Supplier#000000004 MOROCCO 100 Manufacturer#3 Bk7ah4CK8SYQTepEmvMkkgMwg 25-843-787-7479 riously even requests above the exp
1365.79 Supplier#000000006 KENYA 185 Manufacturer#4 tQxuVm7s7CnK 24-696-997-4969 final accounts. regular dolphins use against the furiously ironic decoys.
44 changes: 44 additions & 0 deletions e2e_test/batch/tpch/q8.join_reorder.workaround.slt.part
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# TODO(#1866): here changing tables' order in query, now our rust fe without join reorder avoiding cross join
query TR
select
o_year,
round(sum(case
when nation = 'IRAN' then volume
else 0
end) / sum(volume), 6) as mkt_share
from
(
select
extract(year from o_orderdate) as o_year,
l_extendedprice * (1 - l_discount) as volume,
n2.n_name as nation
from
lineitem,
part,
supplier,
orders,
customer,
nation n1,
nation n2,
region
where
p_partkey = l_partkey
and s_suppkey = l_suppkey
and l_orderkey = o_orderkey
and o_custkey = c_custkey
and c_nationkey = n1.n_nationkey
and n1.n_regionkey = r_regionkey
and r_name = 'ASIA'
and s_nationkey = n2.n_nationkey
and o_orderdate between date '1995-01-01' and date '1996-12-31'
and p_type = 'PROMO ANODIZED STEEL'
) as all_nations
group by
o_year
order by
o_year;
----
1995 0.157661
1996 0.576635


98 changes: 98 additions & 0 deletions e2e_test/batch/tpch/q9.join_reorder.workaround.slt.part
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
# TODO(#1866): here changing tables' order in query, now our rust fe without join reorder avoiding cross join
query TRR
select
nation,
o_year,
round(sum(amount), 2) as sum_profit
from
(
select
n_name as nation,
extract(year from o_orderdate) as o_year,
l_extendedprice * (1 - l_discount) - ps_supplycost * l_quantity as amount
from
lineitem,
part,
supplier,
partsupp,
orders,
nation
where
s_suppkey = l_suppkey
and ps_suppkey = l_suppkey
and ps_partkey = l_partkey
and p_partkey = l_partkey
and o_orderkey = l_orderkey
and s_nationkey = n_nationkey
and p_name like '%yellow%'
) as profit
group by
nation,
o_year
order by
nation,
o_year desc;
----
ARGENTINA 1998 17702.73
ARGENTINA 1997 36930.35
ARGENTINA 1996 47578.21
ARGENTINA 1995 22721.98
ARGENTINA 1994 124668.02
ARGENTINA 1993 16836.47
ARGENTINA 1992 64482.53
ETHIOPIA 1998 12131.22
ETHIOPIA 1997 64632.50
ETHIOPIA 1996 53934.34
ETHIOPIA 1995 85465.81
ETHIOPIA 1994 34909.05
ETHIOPIA 1993 31486.65
ETHIOPIA 1992 31517.77
IRAN 1998 129127.65
IRAN 1997 241048.32
IRAN 1996 146418.41
IRAN 1995 124277.67
IRAN 1994 48054.39
IRAN 1993 205033.11
IRAN 1992 7877.70
IRAQ 1998 44838.65
IRAQ 1997 136849.98
IRAQ 1996 14714.79
IRAQ 1995 38901.46
IRAQ 1994 47418.84
IRAQ 1993 66470.31
IRAQ 1992 19538.72
KENYA 1998 74017.95
KENYA 1996 125975.94
KENYA 1995 126080.69
KENYA 1994 84763.53
KENYA 1993 59241.21
KENYA 1992 41107.38
MOROCCO 1998 9866.13
MOROCCO 1997 26329.79
MOROCCO 1996 5685.95
MOROCCO 1995 7136.46
MOROCCO 1993 18644.56
MOROCCO 1992 7595.75
PERU 1998 87426.11
PERU 1997 182190.68
PERU 1996 151040.18
PERU 1995 128684.42
PERU 1994 143664.16
PERU 1993 174091.66
PERU 1992 151399.17
UNITED KINGDOM 1998 43670.78
UNITED KINGDOM 1997 123308.05
UNITED KINGDOM 1996 126535.39
UNITED KINGDOM 1995 119817.01
UNITED KINGDOM 1994 46739.96
UNITED KINGDOM 1993 135827.18
UNITED KINGDOM 1992 190399.46
UNITED STATES 1998 3284.50
UNITED STATES 1997 94912.29
UNITED STATES 1996 136645.10
UNITED STATES 1995 47310.21
UNITED STATES 1994 62865.10
UNITED STATES 1993 87610.25
UNITED STATES 1992 54695.19


47 changes: 47 additions & 0 deletions e2e_test/streaming/tpch/views/q2.join_reorder.workaround.slt.part
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# TODO(#1866): here changing tables' order in query, now our rust fe without join reorder avoiding cross join
statement ok
create materialized view tpch_q2 as
select
s_acctbal,
s_name,
n_name,
p_partkey,
p_mfgr,
s_address,
s_phone,
s_comment
from
partsupp,
part,
supplier,
nation,
region
where
p_partkey = ps_partkey
and s_suppkey = ps_suppkey
and p_size = 4
and p_type like '%TIN'
and s_nationkey = n_nationkey
and n_regionkey = r_regionkey
and r_name = 'AFRICA'
and ps_supplycost = (
select
min(ps_supplycost)
from
partsupp,
supplier,
nation,
region
where
p_partkey = ps_partkey
and s_suppkey = ps_suppkey
and s_nationkey = n_nationkey
and n_regionkey = r_regionkey
and r_name = 'AFRICA'
)
order by
s_acctbal desc,
n_name,
s_name,
p_partkey
limit 100;
40 changes: 40 additions & 0 deletions e2e_test/streaming/tpch/views/q8.join_reorder.workaround.slt.part
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# TODO(#1866): here changing tables' order in query, now our rust fe without join reorder avoiding cross join
statement ok
create materialized view tpch_q8 as
select
o_year,
round(sum(case
when nation = 'IRAN' then volume
else 0
end) / sum(volume), 6) as mkt_share
from
(
select
extract(year from o_orderdate) as o_year,
l_extendedprice * (1 - l_discount) as volume,
n2.n_name as nation
from
lineitem,
part,
supplier,
orders,
customer,
nation n1,
nation n2,
region
where
p_partkey = l_partkey
and s_suppkey = l_suppkey
and l_orderkey = o_orderkey
and o_custkey = c_custkey
and c_nationkey = n1.n_nationkey
and n1.n_regionkey = r_regionkey
and r_name = 'ASIA'
and s_nationkey = n2.n_nationkey
and o_orderdate between date '1995-01-01' and date '1996-12-31'
and p_type = 'PROMO ANODIZED STEEL'
) as all_nations
group by
o_year
order by
o_year;
3 changes: 1 addition & 2 deletions e2e_test/streaming/tpch/views/q8.slt.part
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# TODO: Swap `lineitem` table with `supplier` to test join reorder (#1866).
statement ok
create materialized view tpch_q8 as
select
Expand All @@ -15,8 +14,8 @@ from
n2.n_name as nation
from
part,
lineitem,
supplier,
lineitem,
orders,
customer,
nation n1,
Expand Down
35 changes: 35 additions & 0 deletions e2e_test/streaming/tpch/views/q9.join_reorder.workaround.slt.part
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# TODO(#1866): here changing tables' order in query, now our rust fe without join reorder avoiding cross join
statement ok
create materialized view tpch_q9 as
select
nation,
o_year,
round(sum(amount), 2) as sum_profit
from
(
select
n_name as nation,
extract(year from o_orderdate) as o_year,
l_extendedprice * (1 - l_discount) - ps_supplycost * l_quantity as amount
from
lineitem,
part,
supplier,
partsupp,
orders,
nation
where
s_suppkey = l_suppkey
and ps_suppkey = l_suppkey
and ps_partkey = l_partkey
and p_partkey = l_partkey
and o_orderkey = l_orderkey
and s_nationkey = n_nationkey
and p_name like '%yellow%'
) as profit
group by
nation,
o_year
order by
nation,
o_year desc;
3 changes: 1 addition & 2 deletions e2e_test/streaming/tpch/views/q9.slt.part
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# TODO: Swap `lineitem` table with `supplier` to test join reorder (#1866).
statement ok
create materialized view tpch_q9 as
select
Expand All @@ -13,8 +12,8 @@ from
l_extendedprice * (1 - l_discount) - ps_supplycost * l_quantity as amount
from
part,
lineitem,
supplier,
lineitem,
partsupp,
orders,
nation
Expand Down
5 changes: 5 additions & 0 deletions e2e_test/v2/batch/tpch.slt
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,17 @@ include ../../tpch/insert_supplier.slt.part
include ../../tpch/insert_region.slt.part

include ../../batch/tpch/q1.slt.part
include ../../batch/tpch/q2.join_reorder.workaround.slt.part
include ../../batch/tpch/q3.slt.part
include ../../batch/tpch/q4.slt.part
include ../../batch/tpch/q5.slt.part
include ../../batch/tpch/q6.slt.part
include ../../batch/tpch/q7.slt.part
include ../../batch/tpch/q8.join_reorder.workaround.slt.part
include ../../batch/tpch/q9.join_reorder.workaround.slt.part
include ../../batch/tpch/q10.slt.part
# include ../../batch/tpch/q11.slt.part
include ../../batch/tpch/q12.slt.part
include ../../batch/tpch/q13.slt.part

include ../../tpch/drop_tables.slt.part
Loading

0 comments on commit adc8cc4

Please sign in to comment.