vinayakb | 38b7ca4 | 2012-03-05 05:44:15 +0000 | [diff] [blame^] | 1 | use dataverse demo1112; |
| 2 | |
| 3 | declare type CustomerType as open { |
| 4 | cid: int32, |
| 5 | name: string, |
| 6 | age: int32?, |
| 7 | address: AddressType?, |
| 8 | lastorder: { |
| 9 | oid: int32, |
| 10 | total: float |
| 11 | } |
| 12 | } |
| 13 | |
| 14 | declare type AddressType as open { |
| 15 | number: int32, |
| 16 | street: string, |
| 17 | city: string |
| 18 | } |
| 19 | |
| 20 | |
| 21 | declare type OrderType as open { |
| 22 | oid: int32, |
| 23 | cid: int32, |
| 24 | orderstatus: string, |
| 25 | orderpriority: string, |
| 26 | clerk: string, |
| 27 | total: float |
| 28 | } |
| 29 | |
| 30 | declare nodegroup group1 on nc1, nc2; |
| 31 | |
| 32 | declare dataset Customers(CustomerType) |
| 33 | partitioned by key cid on group1; |
| 34 | declare dataset Orders(OrderType) |
| 35 | partitioned by key oid on group1; |
| 36 | |
| 37 | write output to nc1:"/tmp/split01.adm"; |
| 38 | |
| 39 | let $os := for $o in dataset('Orders') return $o |
| 40 | for $o1 in $os |
| 41 | for $o2 in $os |
| 42 | where $o1.cid = $o2.cid |
| 43 | return { "o1": $o1.oid, "o2": $o2.oid, "cid": $o1.cid } |