blob: c52344eea33ec98cc0e866fe26f34c65a9b68126 [file] [log] [blame]
khfaraaz82@gmail.coma2716132012-04-30 06:20:50 +00001/*
2 * Test case name : open-closed-21.aql
khfaraaz82@gmail.com923f12b2012-05-02 20:11:28 +00003 * 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.coma2716132012-04-30 06:20:50 +00005 * Success : Yes
6 * Date : 29 April 2012
7 */
8
khfaraaz82@gmail.coma2716132012-04-30 06:20:50 +00009drop dataverse test if exists;
10create dataverse test;
11use dataverse test;
12
13create type TestType as open {
14id:int32
15}
16
17create dataset dtst01(TestType) partitioned by key id;
18
khfaraaz82@gmail.com923f12b2012-05-02 20:11:28 +000019create type Emp as open {
khfaraaz82@gmail.coma2716132012-04-30 06:20:50 +000020id:int32,
21name:string,
22age:int8,
23sex:string,
24dob:date
25}
26
27create dataset employee(Emp) partitioned by key id;
28
khfaraaz82@gmail.com923f12b2012-05-02 20:11:28 +000029insert into dataset employee({"id":201,"name":"John Doe","age":32,"sex":"M","dob":date("1975-01-11")});
30insert into dataset employee({"id":202,"name":"John Smith","age":30,"sex":"M","dob":date("1982-07-12")});
31insert into dataset employee({"id":203,"name":"John Wayne","age":62,"sex":"M","dob":date("1950-01-08")});
32insert into dataset employee({"id":204,"name":"Roger Sanders","age":48,"sex":"M","dob":date("1972-11-12")});
33insert into dataset employee({"id":205,"name":"Raj Singh","age":37,"sex":"M","dob":date("1978-05-06")});
34insert into dataset employee({"id":206,"name":"Mike Tyson","age":44,"sex":"M","dob":date("1965-09-03")});
35insert into dataset employee({"id":227,"name":"Mariam","age":30,"sex":"F","dob":date("1982-11-01")});
khfaraaz82@gmail.coma2716132012-04-30 06:20:50 +000036
khfaraaz82@gmail.com923f12b2012-05-02 20:11:28 +000037insert into dataset employee({"id":228,"name":"Cathy","age":35,"sex":"F","dob":date("1976-06-11"),"desgination":{{"Department Manager"}}});
38
39insert into dataset dtst01(for $l in dataset('employee') return $l);
khfaraaz82@gmail.coma2716132012-04-30 06:20:50 +000040
buyingyidd53f292012-05-20 23:40:25 +000041write output to nc1:"rttest/open-closed_open-closed-21.adm";
khfaraaz82@gmail.coma2716132012-04-30 06:20:50 +000042for $l in dataset('dtst01')
khfaraaz82@gmail.com923f12b2012-05-02 20:11:28 +000043return $l