khfaraaz82@gmail.com | a271613 | 2012-04-30 06:20:50 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Test case name : open-closed-21.aql |
khfaraaz82@gmail.com | 923f12b | 2012-05-02 20:11:28 +0000 | [diff] [blame] | 3 | * Description : Insert into open type internal dataset by querying another open type internal dataset |
| 4 | * : In this case source dataset has (n+n) fields and the target dataset has only 1 field, but has no intial records in it. |
khfaraaz82@gmail.com | a271613 | 2012-04-30 06:20:50 +0000 | [diff] [blame] | 5 | * Success : Yes |
| 6 | * Date : 29 April 2012 |
| 7 | */ |
| 8 | |
khfaraaz82@gmail.com | a271613 | 2012-04-30 06:20:50 +0000 | [diff] [blame] | 9 | drop dataverse test if exists; |
| 10 | create dataverse test; |
| 11 | use dataverse test; |
| 12 | |
| 13 | create type TestType as open { |
| 14 | id:int32 |
| 15 | } |
| 16 | |
| 17 | create dataset dtst01(TestType) partitioned by key id; |
| 18 | |
khfaraaz82@gmail.com | 923f12b | 2012-05-02 20:11:28 +0000 | [diff] [blame] | 19 | create type Emp as open { |
khfaraaz82@gmail.com | a271613 | 2012-04-30 06:20:50 +0000 | [diff] [blame] | 20 | id:int32, |
| 21 | name:string, |
| 22 | age:int8, |
| 23 | sex:string, |
| 24 | dob:date |
| 25 | } |
| 26 | |
| 27 | create dataset employee(Emp) partitioned by key id; |
| 28 | |
khfaraaz82@gmail.com | 923f12b | 2012-05-02 20:11:28 +0000 | [diff] [blame] | 29 | insert into dataset employee({"id":201,"name":"John Doe","age":32,"sex":"M","dob":date("1975-01-11")}); |
| 30 | insert into dataset employee({"id":202,"name":"John Smith","age":30,"sex":"M","dob":date("1982-07-12")}); |
| 31 | insert into dataset employee({"id":203,"name":"John Wayne","age":62,"sex":"M","dob":date("1950-01-08")}); |
| 32 | insert into dataset employee({"id":204,"name":"Roger Sanders","age":48,"sex":"M","dob":date("1972-11-12")}); |
| 33 | insert into dataset employee({"id":205,"name":"Raj Singh","age":37,"sex":"M","dob":date("1978-05-06")}); |
| 34 | insert into dataset employee({"id":206,"name":"Mike Tyson","age":44,"sex":"M","dob":date("1965-09-03")}); |
| 35 | insert into dataset employee({"id":227,"name":"Mariam","age":30,"sex":"F","dob":date("1982-11-01")}); |
khfaraaz82@gmail.com | a271613 | 2012-04-30 06:20:50 +0000 | [diff] [blame] | 36 | |
khfaraaz82@gmail.com | 923f12b | 2012-05-02 20:11:28 +0000 | [diff] [blame] | 37 | insert into dataset employee({"id":228,"name":"Cathy","age":35,"sex":"F","dob":date("1976-06-11"),"desgination":{{"Department Manager"}}}); |
| 38 | |
| 39 | insert into dataset dtst01(for $l in dataset('employee') return $l); |
khfaraaz82@gmail.com | a271613 | 2012-04-30 06:20:50 +0000 | [diff] [blame] | 40 | |
buyingyi | dd53f29 | 2012-05-20 23:40:25 +0000 | [diff] [blame] | 41 | write output to nc1:"rttest/open-closed_open-closed-21.adm"; |
khfaraaz82@gmail.com | a271613 | 2012-04-30 06:20:50 +0000 | [diff] [blame] | 42 | for $l in dataset('dtst01') |
khfaraaz82@gmail.com | 923f12b | 2012-05-02 20:11:28 +0000 | [diff] [blame] | 43 | return $l |