khfaraaz82@gmail.com | c26a698 | 2012-06-01 02:35:40 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Test case Name : open-closed-31.aql |
| 3 | * Description : |
| 4 | * Success : Yes |
| 5 | * Date : 31st May 2012 |
| 6 | */ |
| 7 | |
| 8 | drop dataverse testdv2 if exists; |
| 9 | create dataverse testdv2; |
| 10 | use dataverse testdv2; |
| 11 | |
| 12 | create type testtype01 as open { |
| 13 | id: string |
| 14 | } |
| 15 | |
| 16 | create type testtype02 as open { |
| 17 | id : string, |
| 18 | name : string |
| 19 | } |
| 20 | |
| 21 | create dataset testds01(testtype01) partitioned by key id; |
| 22 | |
| 23 | create dataset testds02(testtype02) partitioned by key id; |
| 24 | |
| 25 | insert into dataset testds02 ( |
| 26 | { "id": "011", "name": "John Doe", "hobbies": {{"scuba", "music"}}} |
| 27 | ); |
| 28 | |
| 29 | insert into dataset testds02 ( |
| 30 | { "id": "102", "name": "Roger Sanders", "hobbies": {{"fishing", "dance"}}} |
| 31 | ); |
| 32 | |
| 33 | |
| 34 | insert into dataset testds02 ( |
| 35 | { "id": "203", "name": "Phil Smith", "hobbies": {{"hiking", "surfing"}}} |
| 36 | ); |
| 37 | |
| 38 | insert into dataset testds01( |
| 39 | for $d in dataset("testds02") |
| 40 | return $d |
| 41 | ); |
| 42 | |
buyingyi | bc282ae | 2012-06-05 21:41:14 +0000 | [diff] [blame] | 43 | write output to nc1:"rttest/open-closed_open-closed-31.adm"; |
khfaraaz82@gmail.com | c26a698 | 2012-06-01 02:35:40 +0000 | [diff] [blame] | 44 | for $d in dataset('testds01') |
| 45 | where some $h in $d.hobbies satisfies $h='hiking' |
buyingyi | bc282ae | 2012-06-05 21:41:14 +0000 | [diff] [blame] | 46 | order by $d.id |
khfaraaz82@gmail.com | c26a698 | 2012-06-01 02:35:40 +0000 | [diff] [blame] | 47 | return $d.hobbies |
| 48 | |