khfaraaz82@gmail.com | a271613 | 2012-04-30 06:20:50 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Test case name : open-closed-19.aql |
| 3 | * Description : Insert into open type internal dataset by querying another internal dataset |
| 4 | * : In this case source dataset has (n+n) fields and the target dataset has only n fields |
| 5 | * Success : Yes |
| 6 | * Date : 29 April 2012 |
| 7 | */ |
| 8 | |
| 9 | |
| 10 | drop dataverse test if exists; |
| 11 | create dataverse test; |
| 12 | use dataverse test; |
| 13 | |
| 14 | create type TestType as open { |
| 15 | id:int32 |
| 16 | } |
| 17 | |
| 18 | create dataset dtst01(TestType) partitioned by key id; |
| 19 | |
| 20 | insert into dtst01({"id":137}); |
| 21 | insert into dtst01({"id":117}); |
| 22 | insert into dtst01({"id":127}); |
| 23 | insert into dtst01({"id":147}); |
| 24 | |
| 25 | create type Emp as open { |
| 26 | id:int32, |
| 27 | name:string, |
| 28 | age:int8, |
| 29 | sex:string, |
| 30 | dob:date |
| 31 | } |
| 32 | |
| 33 | create dataset employee(Emp) partitioned by key id; |
| 34 | |
| 35 | insert into dataset employee({"id":201,"name":"John Doe","age":32,"sex":"M","dob":"1-1-82"}); |
| 36 | insert into dataset employee({"id":202,"name":"John Smith","age":30,"sex":"M","dob":"1-1-82"}); |
| 37 | insert into dataset employee({"id":201,"name":"John Wayne","age":62,"sex":"M","dob":"1-1-82"}); |
| 38 | insert into dataset employee({"id":203,"name":"Roger Sanders","age":48,"sex":"M","dob":"1-1-82"}); |
| 39 | insert into dataset employee({"id":204,"name":"Raj Singh","age":37,"sex":"M","dob":"1-1-82"}); |
| 40 | insert into dataset employee({"id":205,"name":"Mike Tyson","age":44,"sex":"M","dob":"1-1-82"}); |
| 41 | insert into dataset employee({"id":206,"name":"Brett Lee","age":35,"sex":"M","dob":"1-1-82"}); |
| 42 | insert into dataset employee({"id":207,"name":"Chen Li","age":39,"sex":"M","dob":"1-1-82"}); |
| 43 | insert into dataset employee({"id":208,"name":"Mike Carey","age":42,"sex":"M","dob":"1-1-82"}); |
| 44 | insert into dataset employee({"id":209,"name":"Abdullah","age":29,"sex":"M","dob":"1-1-82"}); |
| 45 | insert into dataset employee({"id":221,"name":"Mariam","age":25,"sex":"F","dob":"1-1-82"}); |
| 46 | insert into dataset employee({"id":221,"name":"Mariam","age":25,"sex":"F","dob":"1-1-82","desgination":{{"dsg":"Department Manager"}}}); |
| 47 | |
| 48 | insert into dataset dtst01({for $l in dataset('employee') return $l}); |
| 49 | |
buyingyi | dd53f29 | 2012-05-20 23:40:25 +0000 | [diff] [blame] | 50 | write output to nc1:"rttest/open-closed_open-closed-19.adm"; |
khfaraaz82@gmail.com | a271613 | 2012-04-30 06:20:50 +0000 | [diff] [blame] | 51 | for $l in dataset('dtst01') |
| 52 | retunr $l |