blob: 1015e82a4b224edbcf30996490e9da9fd7a8db27 [file] [log] [blame]
alexander.behm3caae9e2012-11-08 04:50:20 +00001/*
2 * Description : Equi joins two datasets, Customers and Orders, based on the customer id.
3 * Given the 'indexnl' hint we expect the join to be transformed
4 * into an indexed nested-loop join using Customers' primary index.
5 * Success : Yes
6 */
7
8drop dataverse test if exists;
9create dataverse test;
10use dataverse test;
11
12create type AddressType as open {
13 number: int32,
14 street: string,
15 city: string
16}
17
18create type CustomerType as closed {
19 cid: int32,
20 name: string,
21 cashBack: int32,
22 age: int32?,
23 address: AddressType?,
24 lastorder: {
25 oid: int32,
26 total: float
27 }
28}
29
30create type OrderType as open {
31 oid: int32,
32 cid: int32,
33 orderstatus: string,
34 orderpriority: string,
35 clerk: string,
36 total: float,
37 items: [int32]
38}
39
40create dataset Customers(CustomerType) partitioned by key cid;
41create dataset Orders(OrderType) partitioned by key oid;
42
43load dataset Customers
44using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
45(("path"="nc1://data/nontagged/customerData.json"),("format"="adm"));
46
47load dataset Orders
48using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
49(("path"="nc1://data/nontagged/orderData.json"),("format"="adm"));
50
51write output to nc1:"rttest/index-join_btree-primary-equi-join.adm";
52
53for $c in dataset('Customers')
54for $o in dataset('Orders')
55where $c.cid /*+ indexnl */ = $o.cid
56order by $c.cid, $o.oid
57return {"cid":$c.cid, "oid": $o.oid}