blob: 1d93992933edf2167296292948a83861de5017b0 [file] [log] [blame]
khfaraaz82@gmail.coma2716132012-04-30 06:20:50 +00001/*
2 * Test case name : open-closed-19.aql
3 * Description : Insert into open type internal dataset by querying another internal dataset
4 * : In this case source dataset has (n+n) fields and the target dataset has only n fields
5 * Success : Yes
6 * Date : 29 April 2012
7 */
8
9
10drop dataverse test if exists;
11create dataverse test;
12use dataverse test;
13
14create type TestType as open {
15id:int32
16}
17
ramangrover29669d8f62013-02-11 06:03:32 +000018create dataset dtst01(TestType) primary key id;
khfaraaz82@gmail.coma2716132012-04-30 06:20:50 +000019
20insert into dtst01({"id":137});
21insert into dtst01({"id":117});
22insert into dtst01({"id":127});
23insert into dtst01({"id":147});
24
25create type Emp as open {
26id:int32,
27name:string,
28age:int8,
29sex:string,
30dob:date
31}
32
ramangrover29669d8f62013-02-11 06:03:32 +000033create dataset employee(Emp) primary key id;
khfaraaz82@gmail.coma2716132012-04-30 06:20:50 +000034
35insert into dataset employee({"id":201,"name":"John Doe","age":32,"sex":"M","dob":"1-1-82"});
36insert into dataset employee({"id":202,"name":"John Smith","age":30,"sex":"M","dob":"1-1-82"});
37insert into dataset employee({"id":201,"name":"John Wayne","age":62,"sex":"M","dob":"1-1-82"});
38insert into dataset employee({"id":203,"name":"Roger Sanders","age":48,"sex":"M","dob":"1-1-82"});
39insert into dataset employee({"id":204,"name":"Raj Singh","age":37,"sex":"M","dob":"1-1-82"});
40insert into dataset employee({"id":205,"name":"Mike Tyson","age":44,"sex":"M","dob":"1-1-82"});
41insert into dataset employee({"id":206,"name":"Brett Lee","age":35,"sex":"M","dob":"1-1-82"});
42insert into dataset employee({"id":207,"name":"Chen Li","age":39,"sex":"M","dob":"1-1-82"});
43insert into dataset employee({"id":208,"name":"Mike Carey","age":42,"sex":"M","dob":"1-1-82"});
44insert into dataset employee({"id":209,"name":"Abdullah","age":29,"sex":"M","dob":"1-1-82"});
45insert into dataset employee({"id":221,"name":"Mariam","age":25,"sex":"F","dob":"1-1-82"});
46insert into dataset employee({"id":221,"name":"Mariam","age":25,"sex":"F","dob":"1-1-82","desgination":{{"dsg":"Department Manager"}}});
47
48insert into dataset dtst01({for $l in dataset('employee') return $l});
49
buyingyidd53f292012-05-20 23:40:25 +000050write output to nc1:"rttest/open-closed_open-closed-19.adm";
khfaraaz82@gmail.coma2716132012-04-30 06:20:50 +000051for $l in dataset('dtst01')
52retunr $l