vinayakb | 38b7ca4 | 2012-03-05 05:44:15 +0000 | [diff] [blame] | 1 | drop dataverse gby-using-orderby-desc if exists; |
| 2 | |
| 3 | create dataverse gby-using-orderby-desc; |
| 4 | |
| 5 | use dataverse gby-using-orderby-desc; |
| 6 | |
| 7 | create type AddressType as closed { |
| 8 | number: int32, |
| 9 | street: string, |
| 10 | city: string |
| 11 | } |
| 12 | |
| 13 | create type CustomerType as closed { |
| 14 | cid: int32, |
| 15 | name: string, |
| 16 | age: int32?, |
| 17 | address: AddressType?, |
| 18 | lastorder: { |
| 19 | oid: int32, |
| 20 | total: float |
| 21 | } |
| 22 | } |
| 23 | |
| 24 | create nodegroup group1 if not exists on nc1, nc2; |
| 25 | |
| 26 | create dataset Customers(CustomerType) |
| 27 | partitioned by key cid on group1; |
| 28 | |
| 29 | write output to nc1:"rttest/gby-using-orderby-desc.adm"; |
| 30 | |
| 31 | for $c in dataset('Customers') |
| 32 | group by $name := $c.name decor $age := $c.age with $c |
| 33 | order by $name desc, $age asc |
| 34 | return { "name": $name, "age": $age } |
| 35 | |