Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Tajo Wiki" for change 
notification.

The "TpchBenchmark" page has been changed by HyunsikChoi:
http://wiki.apache.org/tajo/TpchBenchmark?action=diff&rev1=3&rev2=4

Comment:
Fixed some query to use explicit join clauses

  === Q2 ===
  Tajo does not support sclar subquery yet. So, you should use multiple queries 
as follows:
  {{{#!SQL
+ create table nation_region as select n_regionkey, r_regionkey, n_nationkey, 
n_name, r_name from region join nation on n_regionkey = r_regionkey where 
r_name = 'EUROPE'
+ 
- create table r2_1 as select s_acctbal, s_name, n_name, p_partkey, p_mfgr, 
s_address, s_phone, s_comment, ps_supplycost from region join nation on 
n_regionkey = r_regionkey join supplier on s_nationkey = n_nationkey join 
partsupp on s_suppkey = ps_suppkey join part on p_partkey = ps_partkey  where 
p_size = 15 and p_type like '%BRASS' and r_name = 'EUROPE'
+ create table r2_1 as select s_acctbal, s_name, n_name, p_partkey, p_mfgr, 
s_address, s_phone, s_comment, ps_supplycost from nation_region join supplier 
on s_nationkey = n_nationkey join partsupp on s_suppkey = ps_suppkey join part 
on p_partkey = ps_partkey  where p_size = 15 and p_type like '%BRASS'
  
  create table r2_2 as select p_partkey, min(ps_supplycost) as 
min_ps_supplycost from r2_1 group by p_partkey
  
  select s_acctbal, s_name, n_name, r2_1.p_partkey, p_mfgr, s_address, s_phone, 
s_comment from r2_1 join r2_2 on r2_1.p_partkey = r2_2.p_partkey where 
ps_supplycost = min_ps_supplycost order by s_acctbal, n_name, s_name, 
r2_1.p_partkey
  }}}
  
- == Q3 ==
+ === Q3 ===
  {{{#!SQL
- select l_orderkey,  sum(l_extendedprice*(1-l_discount)) as revenue, 
o_orderdate, o_shippriority from customer, orders, lineitem where c_mktsegment 
= 'BUILDING' and c_custkey = o_custkey and l_orderkey = o_orderkey and 
o_orderdate < '1995-03-15' and l_shipdate > '1995-03-15' group by l_orderkey, 
o_orderdate, o_shippriority order by revenue desc, o_orderdate
+ select l_orderkey,  sum(l_extendedprice*(1-l_discount)) as revenue, 
o_orderdate, o_shippriority from customer as c join orders as o on 
c.c_mktsegment = 'BUILDING' and c.c_custkey = o.o_custkey join lineitem as l on 
l.l_orderkey = o.o_orderkey where o_orderdate < '1995-03-15' and l_shipdate > 
'1995-03-15' group by l_orderkey, o_orderdate, o_shippriority order by revenue 
desc, o_orderdate
  }}}
  
- == Q6 ==
+ === Q6 ===
  {{{#!SQL
  select sum(l_extendedprice*l_discount) as revenue from lineitem where 
l_shipdate >= '1994-01-01' and l_shipdate < '1995-01-01' and l_discount >= 0.05 
and l_discount <= 0.07 and l_quantity < 24;
  }}}
  
- == Q10 ==
+ === Q10 ===
  {{{#!SQL
- select c_custkey, c_name, sum(l_extendedprice * (1 - l_discount)) as revenue, 
c_acctbal, n_name, c_address, c_phone, c_comment from customer, orders, 
lineitem, nation where c_custkey = o_custkey and l_orderkey = o_orderkey and 
o_orderdate >= '1993-10-01' and o_orderdate < '1994-01-01' and l_returnflag = 
'R' and c_nationkey = n_nationkey group by c_custkey, c_name, c_acctbal, 
c_phone, n_name, c_address, c_comment order by c_custkey
+ select c_custkey, c_name, sum(l_extendedprice * (1 - l_discount)) as revenue, 
c_acctbal, n_name, c_address, c_phone, c_comment from customer_rc as c join 
nation_rc as n on c.c_nationkey = n.n_nationkey join orders as o on c.c_custkey 
= o.o_custkey and o.o_orderdate >= '1993-10-01' and o.o_orderdate < 
'1994-01-01' join lineitem_rc as l on l.l_orderkey = o.o_orderkey and 
l.l_returnflag = 'R' group by c_custkey, c_name, c_acctbal, c_phone, n_name, 
c_address, c_comment order by revenue desc
  }}}
  
- == Q12 ==
+ === Q12 ===
  {{{#!SQL
  select l_shipmode, sum(case when o_orderpriority ='1-URGENT' or 
o_orderpriority ='2-HIGH' then 1 else 0 end) as high_line_count, sum(case when 
o_orderpriority <> '1-URGENT' and o_orderpriority <> '2-HIGH' then 1 else 0 
end) as low_line_count from orders, lineitem where o_orderkey = l_orderkey and 
(l_shipmode = 'MAIL' or l_shipmode = 'SHIP') and l_commitdate < l_receiptdate 
and l_shipdate < l_commitdate and l_receiptdate >= '1994-01-01' and 
l_receiptdate < '1995-01-01' group by l_shipmode order by l_shipmode
  }}}
  
- == Q14 ==
+ === Q14 ===
  {{{#!SQL
  select 100.00 * sum(case when p_type like 'PROMO%' then 
l_extendedprice*(1-l_discount) else 0 end) / sum(l_extendedprice * (1 - 
l_discount)) as promo_revenue from lineitem, part where l_partkey = p_partkey 
and l_shipdate >= '1995-09-01' and l_shipdate < '1995-10-01'
  }}}

Reply via email to