blob: 7f1be2783d6a6d71e80f2fc073f647c0a4a9c062 [file] [log] [blame]
khfaraaz82@gmail.coma2716132012-04-30 06:20:50 +00001/*
2 * Test case name : open-closed-20.aql
khfaraaz82@gmail.com923f12b2012-05-02 20:11:28 +00003 * Description : Insert into open type internal dataset by querying another internal dataset which is of open type with nullable fields
khfaraaz82@gmail.coma2716132012-04-30 06:20:50 +00004 * : 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.com923f12b2012-05-02 20:11:28 +00005 * : In this scenario, the source dataset (open) has some optional fields
khfaraaz82@gmail.coma2716132012-04-30 06:20:50 +00006 * Success : Yes
khfaraaz82@gmail.com923f12b2012-05-02 20:11:28 +00007 * Date : May 01 2012
khfaraaz82@gmail.coma2716132012-04-30 06:20:50 +00008 */
9
10
11drop dataverse test if exists;
12create dataverse test;
13use dataverse test;
14
15create type TestType as open {
16id:int32
17}
18
ramangrover29669d8f62013-02-11 06:03:32 +000019create dataset dtst01(TestType) primary key id;
khfaraaz82@gmail.coma2716132012-04-30 06:20:50 +000020
21create type Emp as open {
22id:int32,
23name:string,
24age:int8,
khfaraaz82@gmail.com923f12b2012-05-02 20:11:28 +000025sex:string?,
26dob:date?
khfaraaz82@gmail.coma2716132012-04-30 06:20:50 +000027}
28
ramangrover29669d8f62013-02-11 06:03:32 +000029create dataset employee(Emp) primary key id;
khfaraaz82@gmail.coma2716132012-04-30 06:20:50 +000030
khfaraaz82@gmail.com923f12b2012-05-02 20:11:28 +000031insert into dataset employee({"id":201,"name":"John Doe","age":32,"sex":"M","dob":date("1975-01-11")});
32insert into dataset employee({"id":202,"name":"John Smith","age":30,date("1982-05-23")});
33insert into dataset employee({"id":201,"name":"John Wayne","age":62,"sex":"M"});
34insert into dataset employee({"id":203,"name":"Roger Sanders","age":48,"sex":"M","dob":date("1960-01-08")});
35insert into dataset employee({"id":204,"name":"Raj Singh","age":37,"sex":"M","dob":date("1975-01-08")});
36insert into dataset employee({"id":205,"name":"Mike Tyson","age":44,"dob":date("1969-11-02")});
37insert into dataset employee({"id":206,"name":"Brett Lee","age":35,"sex":"M","dob":date("1976-06-09")});
38insert into dataset employee({"id":207,"name":"Chen Li","age":39,"sex":"M"});
39insert into dataset employee({"id":208,"name":"Mike Carey","age":42});
40insert into dataset employee({"id":221,"name":"Mariam","age":40,"sex":"F","dob":date("1970-01-09"),"desgination":{{"dsg":"Department Manager"}}});
khfaraaz82@gmail.coma2716132012-04-30 06:20:50 +000041
khfaraaz82@gmail.com923f12b2012-05-02 20:11:28 +000042insert into dataset dtst01(for $l in dataset('employee') return $l);
khfaraaz82@gmail.coma2716132012-04-30 06:20:50 +000043
buyingyidd53f292012-05-20 23:40:25 +000044write output to nc1:"rttest/open-closed_open-closed-20.adm";
khfaraaz82@gmail.coma2716132012-04-30 06:20:50 +000045for $l in dataset('dtst01')
khfaraaz82@gmail.com923f12b2012-05-02 20:11:28 +000046return $l