blob: 7b72a808621079da0cb732676d40796f824df81b [file] [log] [blame]
alexander.behmaf5c4e92012-10-05 06:34:36 +00001/*
2 * Description : Test that multiple subtrees in the same query
3 * can be rewritten with secondary BTree indexes.
4 * Guards against regression to issue 204.
5 * Expected Result : Success
6 * Issue : Issue 204
7 */
8
9drop dataverse tpch if exists;
10create dataverse tpch;
11use dataverse tpch;
12
13create type OrderType as open {
14 o_orderkey: int32,
15 o_custkey: int32,
16 o_orderstatus: string,
17 o_totalprice: double,
18 o_orderdate: string,
19 o_orderpriority: string,
20 o_clerk: string,
21 o_shippriority: int32,
22 o_comment: string
23}
24
25create dataset Orders(OrderType) partitioned by key o_orderkey;
26
27load dataset Orders
28using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
29(("path"="nc1://data/tpch0.001/orders.tbl"),("format"="delimited-text"),("delimiter"="|")) pre-sorted;
30
31create index idx_Orders_Custkey on Orders(o_custkey);
32
33write output to nc1:"rttest/index-selection_btree-index-rewrite-multiple.adm";
34
35for $o in dataset('Orders')
36for $o2 in dataset('Orders')
37where $o.o_custkey = 20 and $o2.o_custkey = 10
38and $o.o_orderstatus < $o2.o_orderstatus
39order by $o.o_orderkey, $o2.o_orderkey
40return {
41 "o_orderkey": $o.o_orderkey,
42 "o_custkey": $o.o_custkey,
43 "o_orderstatus": $o.o_orderstatus,
44 "o_orderkey2": $o2.o_orderkey,
45 "o_custkey2": $o2.o_custkey,
46 "o_orderstatus2": $o2.o_orderstatus
47}
48