khfaraaz82@gmail.com | a271613 | 2012-04-30 06:20:50 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Test case name : open-closed-20.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 internal dataset which is of open type with nullable fields |
khfaraaz82@gmail.com | a271613 | 2012-04-30 06:20:50 +0000 | [diff] [blame] | 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. |
khfaraaz82@gmail.com | 923f12b | 2012-05-02 20:11:28 +0000 | [diff] [blame] | 5 | * : In this scenario, the source dataset (open) has some optional fields |
khfaraaz82@gmail.com | a271613 | 2012-04-30 06:20:50 +0000 | [diff] [blame] | 6 | * Success : Yes |
khfaraaz82@gmail.com | 923f12b | 2012-05-02 20:11:28 +0000 | [diff] [blame] | 7 | * Date : May 01 2012 |
khfaraaz82@gmail.com | a271613 | 2012-04-30 06:20:50 +0000 | [diff] [blame] | 8 | */ |
| 9 | |
| 10 | |
| 11 | drop dataverse test if exists; |
| 12 | create dataverse test; |
| 13 | use dataverse test; |
| 14 | |
| 15 | create type TestType as open { |
| 16 | id:int32 |
| 17 | } |
| 18 | |
ramangrover29 | 669d8f6 | 2013-02-11 06:03:32 +0000 | [diff] [blame^] | 19 | create dataset dtst01(TestType) primary key id; |
khfaraaz82@gmail.com | a271613 | 2012-04-30 06:20:50 +0000 | [diff] [blame] | 20 | |
| 21 | create type Emp as open { |
| 22 | id:int32, |
| 23 | name:string, |
| 24 | age:int8, |
khfaraaz82@gmail.com | 923f12b | 2012-05-02 20:11:28 +0000 | [diff] [blame] | 25 | sex:string?, |
| 26 | dob:date? |
khfaraaz82@gmail.com | a271613 | 2012-04-30 06:20:50 +0000 | [diff] [blame] | 27 | } |
| 28 | |
ramangrover29 | 669d8f6 | 2013-02-11 06:03:32 +0000 | [diff] [blame^] | 29 | create dataset employee(Emp) primary key id; |
khfaraaz82@gmail.com | a271613 | 2012-04-30 06:20:50 +0000 | [diff] [blame] | 30 | |
khfaraaz82@gmail.com | 923f12b | 2012-05-02 20:11:28 +0000 | [diff] [blame] | 31 | insert into dataset employee({"id":201,"name":"John Doe","age":32,"sex":"M","dob":date("1975-01-11")}); |
| 32 | insert into dataset employee({"id":202,"name":"John Smith","age":30,date("1982-05-23")}); |
| 33 | insert into dataset employee({"id":201,"name":"John Wayne","age":62,"sex":"M"}); |
| 34 | insert into dataset employee({"id":203,"name":"Roger Sanders","age":48,"sex":"M","dob":date("1960-01-08")}); |
| 35 | insert into dataset employee({"id":204,"name":"Raj Singh","age":37,"sex":"M","dob":date("1975-01-08")}); |
| 36 | insert into dataset employee({"id":205,"name":"Mike Tyson","age":44,"dob":date("1969-11-02")}); |
| 37 | insert into dataset employee({"id":206,"name":"Brett Lee","age":35,"sex":"M","dob":date("1976-06-09")}); |
| 38 | insert into dataset employee({"id":207,"name":"Chen Li","age":39,"sex":"M"}); |
| 39 | insert into dataset employee({"id":208,"name":"Mike Carey","age":42}); |
| 40 | insert into dataset employee({"id":221,"name":"Mariam","age":40,"sex":"F","dob":date("1970-01-09"),"desgination":{{"dsg":"Department Manager"}}}); |
khfaraaz82@gmail.com | a271613 | 2012-04-30 06:20:50 +0000 | [diff] [blame] | 41 | |
khfaraaz82@gmail.com | 923f12b | 2012-05-02 20:11:28 +0000 | [diff] [blame] | 42 | insert into dataset dtst01(for $l in dataset('employee') return $l); |
khfaraaz82@gmail.com | a271613 | 2012-04-30 06:20:50 +0000 | [diff] [blame] | 43 | |
buyingyi | dd53f29 | 2012-05-20 23:40:25 +0000 | [diff] [blame] | 44 | write output to nc1:"rttest/open-closed_open-closed-20.adm"; |
khfaraaz82@gmail.com | a271613 | 2012-04-30 06:20:50 +0000 | [diff] [blame] | 45 | for $l in dataset('dtst01') |
khfaraaz82@gmail.com | 923f12b | 2012-05-02 20:11:28 +0000 | [diff] [blame] | 46 | return $l |