blob: d7ad173bf994956b9242444c7d507586d926f376 [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
19create dataset dtst01(TestType) partitioned by key id;
20
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
29create dataset employee(Emp) partitioned by key id;
30
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
44for $l in dataset('dtst01')
khfaraaz82@gmail.com923f12b2012-05-02 20:11:28 +000045return $l