Skip to content

Commit

Permalink
test: add all the tpch and derived table queries to e2e test
Browse files Browse the repository at this point in the history
Signed-off-by: Manan Gupta <manan@planetscale.com>
  • Loading branch information
GuptaManan100 committed May 2, 2024
1 parent 9ca82d4 commit abc27fd
Showing 1 changed file with 76 additions and 0 deletions.
76 changes: 76 additions & 0 deletions go/test/endtoend/vtgate/queries/tpch/tpch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,82 @@ where l_partkey = p_partkey
and l_shipdate >= '1996-12-01'
and l_shipdate < date_add('1996-12-01', interval '1' month);`,
},
{
name: "Q7",
query: `select supp_nation, cust_nation, l_year, sum(volume) as revenue
from (select n1.n_name as supp_nation,
n2.n_name as cust_nation,
extract(year from l_shipdate) as l_year,
l_extendedprice * (1 - l_discount) as volume
from supplier,
lineitem,
orders,
customer,
nation n1,
nation n2
where s_suppkey = l_suppkey
and o_orderkey = l_orderkey
and c_custkey = o_custkey
and s_nationkey = n1.n_nationkey
and c_nationkey = n2.n_nationkey
and ((n1.n_name = 'FRANCE' and n2.n_name = 'GERMANY') or (n1.n_name = 'GERMANY' and n2.n_name = 'FRANCE'))
and l_shipdate between date ('1995-01-01') and date('1996-12-31')) as shipping
group by supp_nation, cust_nation, l_year
order by supp_nation, cust_nation, l_year`,
},
{
name: "Q8",
query: `select o_year, sum(case when nation = 'BRAZIL' then volume else 0 end) / sum(volume) 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 part,
supplier,
lineitem,
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 = 'AMERICA'
and s_nationkey = n2.n_nationkey
and o_orderdate between date '1995-01-01' and date ('1996-12-31') and p_type = 'ECONOMY ANODIZED STEEL' ) as all_nations
group by o_year
order by o_year`,
},
{
name: "Q9",
query: `select nation, o_year, sum(amount) 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 part,
supplier,
lineitem,
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 '%green%') as profit
group by nation, o_year
order by nation, o_year desc`,
},
{
name: "simple derived table",
query: `select *
from (select l.l_extendedprice * o.o_totalprice
from lineitem l
join orders o) as dt`,
},
}

for _, testcase := range testcases {
Expand Down

0 comments on commit abc27fd

Please sign in to comment.