khfaraaz82@gmail.com | 6621b1d | 2012-05-25 07:26:35 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Testcase Name : c2c-w-optional.aql |
| 3 | * Description : Insert data into target datase by doing a select on source dataset. |
| 4 | * : Here both source and target datasets are internal datasets |
| 5 | * : The schema includes one optional field named optnl_fld. |
| 6 | * Success : Yes |
| 7 | * Date : 23rd May 2012 |
| 8 | */ |
| 9 | |
| 10 | drop dataverse test if exists; |
| 11 | create dataverse test; |
| 12 | use dataverse test; |
| 13 | |
| 14 | create type TestType as closed { |
| 15 | id:int32, |
| 16 | description:string, |
| 17 | name:string, |
| 18 | optnl_fld:string? |
| 19 | } |
| 20 | |
| 21 | create dataset T1(TestType) partitioned by key id; |
| 22 | |
| 23 | create dataset T2(TestType) partitioned by key id; |
| 24 | |
| 25 | insert into dataset T1({ |
| 26 | "id":1234, |
| 27 | "description":"donut", |
| 28 | "name":"Cake", |
| 29 | "optnl_fld":"optional data goes here" |
| 30 | } |
| 31 | ); |
| 32 | |
| 33 | insert into dataset T2(for $l in dataset("T1") return $l ); |
| 34 | |
| 35 | for $d in dataset("T2") |
| 36 | order by $d.id |
| 37 | return $d |