khfaraaz82@gmail.com | a271613 | 2012-04-30 06:20:50 +0000 | [diff] [blame^] | 1 | /* |
| 2 | * Test case name : open-closed-21.aql |
| 3 | * Description : Insert into open type internal dataset by querying another closed type internal dataset |
| 4 | * : In this case source dataset has (n+n) fields and the target dataset has only n fields, but has no intial records in it. |
| 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 | create type Emp as closed { |
| 21 | id:int32, |
| 22 | name:string, |
| 23 | age:int8, |
| 24 | sex:string, |
| 25 | dob:date |
| 26 | } |
| 27 | |
| 28 | create dataset employee(Emp) partitioned by key id; |
| 29 | |
| 30 | insert into dataset employee({"id":201,"name":"John Doe","age":32,"sex":"M","dob":"1-1-82"}); |
| 31 | insert into dataset employee({"id":202,"name":"John Smith","age":30,"sex":"M","dob":"1-1-82"}); |
| 32 | insert into dataset employee({"id":201,"name":"John Wayne","age":62,"sex":"M","dob":"1-1-82"}); |
| 33 | insert into dataset employee({"id":203,"name":"Roger Sanders","age":48,"sex":"M","dob":"1-1-82"}); |
| 34 | insert into dataset employee({"id":204,"name":"Raj Singh","age":37,"sex":"M","dob":"1-1-82"}); |
| 35 | insert into dataset employee({"id":205,"name":"Mike Tyson","age":44,"sex":"M","dob":"1-1-82"}); |
| 36 | insert into dataset employee({"id":206,"name":"Brett Lee","age":35,"sex":"M","dob":"1-1-82"}); |
| 37 | insert into dataset employee({"id":207,"name":"Chen Li","age":39,"sex":"M","dob":"1-1-82"}); |
| 38 | insert into dataset employee({"id":208,"name":"Mike Carey","age":42,"sex":"M","dob":"1-1-82"}); |
| 39 | insert into dataset employee({"id":209,"name":"Abdullah","age":29,"sex":"M","dob":"1-1-82"}); |
| 40 | insert into dataset employee({"id":221,"name":"Mariam","age":25,"sex":"F","dob":"1-1-82"}); |
| 41 | |
| 42 | insert into dataset dtst01({for $l in dataset('employee') return $l}); |
| 43 | |
| 44 | for $l in dataset('dtst01') |
| 45 | retunr $l |