Skip to content

Commit

Permalink
add q21 q22 planner test
Browse files Browse the repository at this point in the history
  • Loading branch information
st1page committed May 3, 2022
1 parent d9a02a3 commit 9f945fa
Showing 1 changed file with 153 additions and 0 deletions.
153 changes: 153 additions & 0 deletions src/frontend/test_runner/tests/testdata/tpch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1256,6 +1256,52 @@
LogicalProject { exprs: [$0, ($1 * (1:Int32 - $2))], expr_alias: [ , ] }
LogicalFilter { predicate: ($3 >= '1993-01-01':Varchar::Date) AND ($3 < ('1993-01-01':Varchar::Date + '3 mons 00:00:00':Interval)) }
LogicalScan { table: lineitem, columns: [l_suppkey, l_extendedprice, l_discount, l_shipdate] }
- id: tpch_q16
before:
- create_tables
sql: |
select
p_brand,
p_type,
p_size,
count(distinct ps_suppkey) as supplier_cnt
from
partsupp,
part
where
p_partkey = ps_partkey
and p_brand <> 'Brand#45'
and p_type not like 'SMALL PLATED%'
and p_size in (19, 17, 16, 23, 10, 4, 38, 11)
and ps_suppkey not in (
select
s_suppkey
from
supplier
where
s_comment like '%Customer%Complaints%'
)
group by
p_brand,
p_type,
p_size
order by
supplier_cnt desc,
p_brand,
p_type,
p_size;
logical_plan: |
LogicalProject { exprs: [$0, $1, $2, $3], expr_alias: [p_brand, p_type, p_size, supplier_cnt] }
LogicalAgg { group_keys: [0, 1, 2], agg_calls: [count($3)] }
LogicalProject { exprs: [$10, $11, $12, $2], expr_alias: [ , , , ] }
LogicalFilter { predicate: ($7 = $1) AND ($10 <> 'Brand#45':Varchar) AND Not(Like($11, 'SMALL PLATED%':Varchar)) AND In($12, 19:Int32, 17:Int32, 16:Int32, 23:Int32, 10:Int32, 4:Int32, 38:Int32, 11:Int32) }
LogicalJoin { type: LeftAnti, on: ($2 = $16) }
LogicalJoin { type: Inner, on: always }
LogicalScan { table: partsupp, columns: [_row_id#0, ps_partkey, ps_suppkey, ps_availqty, ps_supplycost, ps_comment] }
LogicalScan { table: part, columns: [_row_id#0, p_partkey, p_name, p_mfgr, p_brand, p_type, p_size, p_container, p_retailprice, p_comment] }
LogicalProject { exprs: [$1], expr_alias: [s_suppkey] }
LogicalFilter { predicate: Like($7, '%Customer%Complaints%':Varchar) }
LogicalScan { table: supplier, columns: [_row_id#0, s_suppkey, s_name, s_address, s_nationkey, s_phone, s_acctbal, s_comment] }
- id: tpch_q17
before:
- create_tables
Expand Down Expand Up @@ -1583,3 +1629,110 @@
StreamExchange { dist: HashShard([0, 1]) }
StreamFilter { predicate: ($3 >= '1994-01-01':Varchar::Date) AND ($3 < ('1994-01-01':Varchar::Date + '1 year 00:00:00':Interval)) }
StreamTableScan { table: lineitem, columns: [l_partkey, l_suppkey, l_quantity, l_shipdate, _row_id#0], pk_indices: [4] }
- id: tpch_q21
before:
- create_tables
sql: |
select
s_name,
count(*) as numwait
from
supplier,
lineitem l1,
orders,
nation
where
s_suppkey = l1.l_suppkey
and o_orderkey = l1.l_orderkey
and o_orderstatus = 'F'
and l1.l_receiptdate > l1.l_commitdate
and exists (
select
*
from
lineitem l2
where
l2.l_orderkey = l1.l_orderkey
and l2.l_suppkey <> l1.l_suppkey
)
and not exists (
select
*
from
lineitem l3
where
l3.l_orderkey = l1.l_orderkey
and l3.l_suppkey <> l1.l_suppkey
and l3.l_receiptdate > l3.l_commitdate
)
and s_nationkey = n_nationkey
and n_name = 'GERMANY'
group by
s_name
order by
numwait desc,
s_name
LIMIT 100;
logical_plan: |
LogicalTopN { order: [$1 DESC, $0 ASC], limit: 100, offset: 0 }
LogicalProject { exprs: [$0, $1], expr_alias: [s_name, numwait] }
LogicalAgg { group_keys: [0], agg_calls: [count] }
LogicalProject { exprs: [$2], expr_alias: [ ] }
LogicalFilter { predicate: ($1 = $11) AND ($26 = $9) AND ($28 = 'F':Varchar) AND ($21 > $20) AND ($4 = $36) AND ($37 = 'GERMANY':Varchar) }
LogicalApply { type: LeftAnti, on: always }
LogicalApply { type: LeftSemi, on: always }
LogicalJoin { type: Inner, on: always }
LogicalJoin { type: Inner, on: always }
LogicalJoin { type: Inner, on: always }
LogicalScan { table: supplier, columns: [_row_id#0, s_suppkey, s_name, s_address, s_nationkey, s_phone, s_acctbal, s_comment] }
LogicalScan { table: lineitem, columns: [_row_id#0, l_orderkey, l_partkey, l_suppkey, l_linenumber, l_quantity, l_extendedprice, l_discount, l_tax, l_returnflag, l_linestatus, l_shipdate, l_commitdate, l_receiptdate, l_shipinstruct, l_shipmode, l_comment] }
LogicalScan { table: orders, columns: [_row_id#0, o_orderkey, o_custkey, o_orderstatus, o_totalprice, o_orderdate, o_orderpriority, o_clerk, o_shippriority, o_comment] }
LogicalScan { table: nation, columns: [_row_id#0, n_nationkey, n_name, n_regionkey, n_comment] }
LogicalProject { exprs: [$1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16], expr_alias: [l_orderkey, l_partkey, l_suppkey, l_linenumber, l_quantity, l_extendedprice, l_discount, l_tax, l_returnflag, l_linestatus, l_shipdate, l_commitdate, l_receiptdate, l_shipinstruct, l_shipmode, l_comment] }
LogicalFilter { predicate: ($1 = CorrelatedInputRef { index: 9, depth: 1 }) AND ($3 <> CorrelatedInputRef { index: 11, depth: 1 }) }
LogicalScan { table: lineitem, columns: [_row_id#0, l_orderkey, l_partkey, l_suppkey, l_linenumber, l_quantity, l_extendedprice, l_discount, l_tax, l_returnflag, l_linestatus, l_shipdate, l_commitdate, l_receiptdate, l_shipinstruct, l_shipmode, l_comment] }
LogicalProject { exprs: [$1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16], expr_alias: [l_orderkey, l_partkey, l_suppkey, l_linenumber, l_quantity, l_extendedprice, l_discount, l_tax, l_returnflag, l_linestatus, l_shipdate, l_commitdate, l_receiptdate, l_shipinstruct, l_shipmode, l_comment] }
LogicalFilter { predicate: ($1 = CorrelatedInputRef { index: 9, depth: 1 }) AND ($3 <> CorrelatedInputRef { index: 11, depth: 1 }) AND ($13 > $12) }
LogicalScan { table: lineitem, columns: [_row_id#0, l_orderkey, l_partkey, l_suppkey, l_linenumber, l_quantity, l_extendedprice, l_discount, l_tax, l_returnflag, l_linestatus, l_shipdate, l_commitdate, l_receiptdate, l_shipinstruct, l_shipmode, l_comment] }
- id: tpch_q22
before:
- create_tables
sql: |
select
cntrycode,
count(*) as numcust,
sum(c_acctbal) as totacctbal
from
(
select
substring(c_phone from 1 for 2) as cntrycode,
c_acctbal
from
customer
where
substring(c_phone from 1 for 2) in
('30', '24', '31', '38', '25', '34', '37')
and c_acctbal > (
select
avg(c_acctbal)
from
customer
where
c_acctbal > 0.00::numeric
and substring(c_phone from 1 for 2) in
('30', '24', '31', '38', '25', '34', '37')
)
and not exists (
select
*
from
orders
where
o_custkey = c_custkey
)
) as custsale
group by
cntrycode
order by
cntrycode;
binder_error: 'Feature is not yet implemented: unsupported expression Substring { expr: Identifier(Ident { value: "c_phone", quote_style: None }), substring_from: Some(Value(Number("1", false))), substring_for: Some(Value(Number("2", false))) }, Tracking issue: https://github.com/singularity-data/risingwave/issues/112'

0 comments on commit 9f945fa

Please sign in to comment.