blob: f2352202906f316f4fb829192e2a1ccadaaa2f89 [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 * We expect the additional predicates to be put into a select above the
6 * primary index search.
7 * Success : Yes
8 */
9
10drop dataverse test if exists;
11create dataverse test;
12use dataverse test;
13
14create type AddressType as closed {
15 number: int32,
16 street: string,
17 city: string
18}
19
20create type CustomerType as closed {
21 cid: int32,
22 name: string,
23 age: int32?,
24 address: AddressType?,
25 lastorder: {
26 oid: int32,
27 total: float
28 }
29}
30
31create type OrderType as closed {
32 oid: int32,
33 cid: int32,
34 orderstatus: string,
35 orderpriority: string,
36 clerk: string,
37 total: float
38}
39
ramangrover29669d8f62013-02-11 06:03:32 +000040create dataset Customers(CustomerType) primary key cid;
41create dataset Orders(OrderType) primary key oid;
alexander.behm3caae9e2012-11-08 04:50:20 +000042
43write output to nc1:"rttest/btree-index-join_primary-equi-join-multipred.adm";
44
45for $c in dataset('Customers')
46for $o in dataset('Orders')
47where $c.cid /*+ indexnl */ = $o.cid and $c.name < $o.orderstatus and $c.age < $o.cid
48return {"customer":$c, "order": $o}