vinayakb | 38b7ca4 | 2012-03-05 05:44:15 +0000 | [diff] [blame^] | 1 | drop dataverse index_search if exists; |
| 2 | |
| 3 | create dataverse index_search; |
| 4 | |
| 5 | use dataverse index_search; |
| 6 | |
| 7 | create type OrderType as closed { |
| 8 | o_orderkey: int32, |
| 9 | o_custkey: int32, |
| 10 | o_orderstatus: string, |
| 11 | o_totalprice: double, |
| 12 | o_orderdate: string, |
| 13 | o_orderpriority: string, |
| 14 | o_clerk: string, |
| 15 | o_shippriority: int32, |
| 16 | o_comment: string |
| 17 | } |
| 18 | |
| 19 | |
| 20 | create nodegroup group1 if not exists on nc1, nc2; |
| 21 | |
| 22 | create dataset Orders(OrderType) |
| 23 | partitioned by key o_orderkey on group1; |
| 24 | |
| 25 | create index idx_Orders_Custkey on Orders(o_custkey); |
| 26 | |
| 27 | write output to nc1:"/tmp/index_search.adm"; |
| 28 | |
| 29 | for $o in dataset('Orders') |
| 30 | where |
| 31 | $o.o_custkey = 40 |
| 32 | return { |
| 33 | "o_orderkey": $o.o_orderkey, |
| 34 | "o_custkey": $o.o_custkey |
| 35 | } |