| /* |
| * Description : Self-equi joins a dataset, Customers, based on the customer id. |
| * Given the 'indexnl' hint we expect the join to be transformed |
| * into an indexed nested-loop join using Customers' primary index. |
| * Success : Yes |
| */ |
| |
| drop dataverse test if exists; |
| create dataverse test; |
| use dataverse test; |
| |
| create type AddressType as closed { |
| number: int32, |
| street: string, |
| city: string |
| } |
| |
| create type CustomerType as closed { |
| cid: int32, |
| name: string, |
| age: int32?, |
| address: AddressType?, |
| lastorder: { |
| oid: int32, |
| total: float |
| } |
| } |
| |
| create dataset Customers(CustomerType) partitioned by key cid; |
| |
| write output to nc1:"rttest/btree-index-join_primary-equi-join_06.adm"; |
| |
| for $c1 in dataset('Customers') |
| for $c2 in dataset('Customers') |
| where $c1.cid /*+ indexnl */ = $c2.cid |
| return {"customer1":$c1, "customer2":$c2} |