blob: cd9ac446f28b0509f62194f5f31f9254935f8309 [file] [log] [blame]
khfaraaz82@gmail.com1a300b22012-04-30 19:18:14 +00001/*
2 * Test case name : open-closed-22.aql
khfaraaz82@gmail.com923f12b2012-05-02 20:11:28 +00003 * Description : Insert into a closed type dataset which has nullable(optional) and non-nullable fields
khfaraaz82@gmail.com1a300b22012-04-30 19:18:14 +00004 * Success : Yes
5 * Date : 30 April 2012
6 */
7
8drop dataverse test if exists;
9create dataverse test;
10use dataverse test;
11
12write output to nc1:"rttest/open-closed-22.adm";
13
14create type Emp as closed {
15id:int32,
16name:string,
17age:int8?,
18dept:string?,
19sex:string,
20dob:date?
21}
22
23create dataset employee(Emp) partitioned by key id;
24
25//date("YYYY-MM-DD")
26insert into dataset employee({"id":201,"name":"John Doe","age":37,"dept":"HR","sex":"M","dob":date("1975-11-02")});
27
28insert into dataset employee({"id":202,"name":"John Smith","age":30,"dept":"Sales","sex":"M","dob":date("1982-12-12")});
29
30// all optional fields missing
31insert into dataset employee({"id":201,"name":"John Wayne","age":62,"sex":"M"});
32
33// missing age field
34insert into dataset employee({"id":203,"name":"Roger Sanders","dept":"Technology","sex":"M","dob":date("1970-03-12")});
35
36// all optional fields missing!
37insert into dataset employee({"id":204,"name":"Raj Singh","sex":"M"});
38
39// missing dept field
40insert into dataset employee({"id":205,"name":"Mike Tyson","age":44,"sex":"M","dob":date("1970-12-22")});
41
buyingyidd53f292012-05-20 23:40:25 +000042write output to nc1:"rttest/open-closed_open-closed-22.adm";
khfaraaz82@gmail.com1a300b22012-04-30 19:18:14 +000043for $l in dataset('employee')
44return $l