Added open closed type tests
git-svn-id: https://asterixdb.googlecode.com/svn/branches/asterix_stabilization@163 eaa15691-b419-025a-1212-ee371bd00084
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-closed/heterog-list01.aql b/asterix-app/src/test/resources/runtimets/queries/open-closed/heterog-list01.aql
new file mode 100644
index 0000000..c54d020
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-closed/heterog-list01.aql
@@ -0,0 +1,32 @@
+/*
+ * Test case Name : heterog-list01.aql
+ * Description : To test insertion of an array of objects into internal dataset.
+ * : Heterogenous list construction.
+ * Success : Yes
+ * Date : 14th April 2012
+ */
+
+drop dataverse test if exists;
+create dataverse test;
+use dataverse test;
+
+create type BatterType as {
+id:int32,
+descrpt:string
+}
+
+create type TestType as {
+id:int32,
+description:string,
+name:string,
+batters:[BatterType]
+}
+
+create dataset T1(TestType) partitioned by key id;
+
+insert into dataset T1({
+"id":1234,
+"description":"donut",
+"name":"Cake",
+"batters":[{"id":345,"descprt":"Regular"},{"id":445,"descprt":"Chocolate"}] }
+);
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-01.aql b/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-01.aql
new file mode 100644
index 0000000..0b6d0dd
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-01.aql
@@ -0,0 +1,24 @@
+/*
+ * Test case Name : open-closed-01.aql
+ * Description : This test is intended to test insertion of additional data into an open type
+ * Expected Result : Success
+ * Date : April 2 2012
+ */
+
+drop dataverse test if exists;
+
+create dataverse test;
+
+use dataverse test;
+
+create type testType as{
+id : int32,
+name : string
+}
+
+create dataset testds(testType) partitioned by key id;
+
+insert into dataset testds({"id": 123, "name": "John Doe", "hobbies": {{ "scuba", "music" }} }
+);
+
+for $l in dataset("testds") return $l
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-02.aql b/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-02.aql
new file mode 100644
index 0000000..6963bee
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-02.aql
@@ -0,0 +1,24 @@
+/*
+ * Test case Name : open-closed-02.aql
+ * Description : This test is intended to test insertion of additional data into a dataset of closed type
+ * Expected Result : This test should fail because closed type internal datasets can not ingest additional data.
+ *
+ */
+
+drop dataverse test if exists;
+
+create dataverse test;
+
+use dataverse test;
+
+// name field here is optional.
+create type testType as closed {
+id : int32,
+name : string?
+}
+
+create dataset testds(testType) partitioned by key id;
+
+insert into dataset testds({"id": 123, "name": "John Doe", "hobbies": {{ "scuba", "music" }} });
+
+for $l in dataset("testds") return $l
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-03.aql b/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-03.aql
new file mode 100644
index 0000000..f028c89
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-03.aql
@@ -0,0 +1,24 @@
+/*
+ * Test case Name : open-closed-03.aql
+ * Description : This test is intended to test insertion of additional data into a closed type
+ * Expected Result : Failure - This should NOT be allowed!
+ * Issue number : Issue 66
+ */
+
+drop dataverse test if exists;
+
+create dataverse test;
+
+use dataverse test;
+
+create type testType as closed {
+id : int32,
+name : string
+}
+
+create dataset testds(testType) partitioned by key id;
+
+insert into dataset testds({"id": 123, "name": "John Doe", "hobbies": {{ "scuba", "music" }} }
+);
+
+for $l in dataset("testds") return $l
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-04.aql b/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-04.aql
new file mode 100644
index 0000000..82912bd
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-04.aql
@@ -0,0 +1,31 @@
+/*
+ * Test case Name : open-closed-04.aql
+ * Description : This test is intended to test type in the Metdata for the dataset.
+ * : Verify if the type is open.
+ * Expected Result : Success - This should be allowed!
+ * Issue number : Issue 73
+ */
+
+drop dataverse test if exists;
+
+create dataverse test;
+
+use dataverse test;
+
+create type TestType as open {
+id : int32,
+name : string
+}
+
+create dataset testds(TestType) partitioned by key id;
+
+/*
+ * Connect to the Metadata dataverse and run the following commands.
+ */
+
+use dataverse Metadata;
+
+for $l in dataset('Datatype')
+let $x := $l.Derived
+where $l.DatatypeName="TestType"
+return $x.Record
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-05.aql b/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-05.aql
new file mode 100644
index 0000000..2bd18fe
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-05.aql
@@ -0,0 +1,30 @@
+/*
+ * Test case Name : open-closed-05.aql
+ * Description : Create internal dataset and verify if the type is marked as closed in metadata.
+ * Expected Result : Success
+ */
+
+drop dataverse test if exists;
+
+create dataverse test;
+
+use dataverse test;
+
+create type testType as closed {
+id : int32,
+name : string
+}
+
+create dataset testds(testType) partitioned by key id;
+
+/*
+ * Connect to the Metadata dataverse and run the following commands.
+ * Verify if the type is closed by querying Metadata.
+ */
+
+use dataverse Metadata;
+
+for $l in dataset('Datatype')
+let $x := $l.Derived
+where $l.DatatypeName="TestType"
+return $x.Record
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-06.aql b/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-06.aql
new file mode 100644
index 0000000..f6605a6
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-06.aql
@@ -0,0 +1,25 @@
+/*
+ * Test case Name : open-closed-06.aql
+ * Description : To test non nullable field types in closed type datasets.
+ * Success : Yes this test should Fail!
+ * Date : 03/26/2012
+ */
+
+drop dataverse test if exists;
+
+create dataverse test;
+
+use dataverse test;
+
+create type testType as closed {
+id : int32,
+name : string
+}
+
+create dataset testds(testType) partitioned by key id;
+
+// Missing name field this insert stmt should fail.
+
+insert into dataset testds({"id": 123});
+
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-07.aql b/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-07.aql
new file mode 100644
index 0000000..155f8bb
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-07.aql
@@ -0,0 +1,23 @@
+/*
+ * Test case Name : open-closed-07.aql
+ * Description : To test non nullable field types in datasets of type open.
+ * Success : Yes this test should Fail!
+ * Date : 03/26/2012
+ */
+
+drop dataverse test if exists;
+
+create dataverse test;
+
+use dataverse test;
+
+create type testType as open {
+id : int32,
+name : string
+}
+
+create dataset testds(testType) partitioned by key id;
+
+insert into dataset testds({"id": 123});
+
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-08.aql b/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-08.aql
new file mode 100644
index 0000000..24423e8
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-08.aql
@@ -0,0 +1,23 @@
+/*
+ * Test case Name : open-closed-08.aql
+ * Description : To test nullable and non nullable field types in datasets of type closed.
+ * Success : Yes this test should succeed!
+ * Date : 03/26/2012
+ */
+
+drop dataverse test if exists;
+
+create dataverse test;
+
+use dataverse test;
+
+create type testType as closed {
+id : int32,
+name : string?
+}
+
+create dataset testds(testType) partitioned by key id;
+
+insert into dataset testds({"id": 123});
+
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-09.aql b/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-09.aql
new file mode 100644
index 0000000..63288d7
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-09.aql
@@ -0,0 +1,24 @@
+/*
+ * Test case Name : open-closed-09.aql
+ * Description : To test nullable and non nullable field types in datasets of type open.
+ * : Missing value for nullable field and missing value for non-nullable field in insert statement.
+ * Success : This test should Fail!
+ * Date : 03/26/2012
+ */
+
+drop dataverse test if exists;
+
+create dataverse test;
+
+use dataverse test;
+
+create type testType as open {
+id : int32,
+name : string?
+}
+
+create dataset testds(testType) partitioned by key id;
+
+insert into dataset testds({ });
+
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-10.aql b/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-10.aql
new file mode 100644
index 0000000..cad1f12
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-10.aql
@@ -0,0 +1,24 @@
+/*
+ * Test case Name : open-closed-10.aql
+ * Description : To test nullable and non nullable field types in datasets of type open.
+ * : Missing value for nullable field in insert statement.
+ * Success : This test should succeed!
+ * Date : 03/26/2012
+ */
+
+drop dataverse test if exists;
+
+create dataverse test;
+
+use dataverse test;
+
+create type testType as open {
+id : int32,
+name : string?
+}
+
+create dataset testds(testType) partitioned by key id;
+
+insert into dataset testds({"id :" 32 });
+
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-11.aql b/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-11.aql
new file mode 100644
index 0000000..50d52d2
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-11.aql
@@ -0,0 +1,24 @@
+/*
+ * Test case Name : open-closed-11.aql
+ * Description : To test nullable and non nullable field types in datasets of type open.
+ * : No missing value for nullable field in insert statement.
+ * Success : This test should succeed!
+ * Date : 03/26/2012
+ */
+
+drop dataverse test if exists;
+
+create dataverse test;
+
+use dataverse test;
+
+create type testType as open {
+id : int32,
+name : string?
+}
+
+create dataset testds(testType) partitioned by key id;
+
+insert into dataset testds({"id :" 32,"name :" "UCI"});
+
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-12.aql b/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-12.aql
new file mode 100644
index 0000000..2459fcc
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-12.aql
@@ -0,0 +1,48 @@
+/*
+ * Test case name : open-closed-12.aql
+ * Description : Select from dataset two and insert into dataset one, both datasets are of open type.
+ * : In this case, both datasets are of same schema
+ * Success : Yes
+ * Date : 27 March 2012
+ */
+
+drop dataverse testdv2 if exists;
+
+create dataverse testdv2;
+
+use dataverse testdv2;
+
+create type testtype01 as open {
+ id: string,
+ name: string
+}
+
+create type testtype02 as open {
+id : string,
+name : string
+}
+
+create dataset testds01(testtype01) partitioned by key id;
+
+create dataset testds02(testtype02) partitioned by key id;
+
+insert into dataset testds02 (
+{ "id": "001", "name": "Person One", "hobbies": {{"scuba", "music"}}}
+);
+
+insert into dataset testds02 (
+{ "id": "002", "name": "Person Two", "hobbies": {{"fishing", "dance"}}}
+);
+
+insert into dataset testds02 (
+{ "id": "003", "name": "Person Three", "hobbies": {{"hiking", "surfing"}}}
+);
+
+insert into dataset testds01(
+for $d in dataset("testds02")
+return $d
+);
+
+for $d in dataset("testds01")
+return $d
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-13.aql b/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-13.aql
new file mode 100644
index 0000000..68d0b70
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-13.aql
@@ -0,0 +1,27 @@
+/*
+ * Testcase Name : open-closed-13.aql
+ * Description : Attempt to insert additional data into a dataset which is defined as closed type.
+ * Success : This test should fail! No additional data allowed in datasets of closed type.
+ * Date : March 27 2012
+ */
+
+
+create dataverse testdv2;
+use dataverse testdv2;
+
+create type testtype as closed {
+ id: string,
+ name: string
+}
+
+create nodegroup grouptest on nc1;
+
+create dataset testds(testtype) partitioned by key id on grouptest;
+
+insert into dataset testds (
+{ "id": "001", "name": "Person Three", "hobbies": {{"scuba", "music"}}}
+);
+
+for $d in dataset("testds")
+return $d
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-14.aql b/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-14.aql
new file mode 100644
index 0000000..03e6e33
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-14.aql
@@ -0,0 +1,53 @@
+/*
+ * Testcase name : open-closed-14.aql
+ * Description : insert into target dataset - select * from source dataset
+ * : in this case dataset1 and dataset2 are fo different schema.
+ * Success : This test should succeed.
+ * Date : March 27 2012
+ */
+
+drop dataverse testdv2 if exists;
+create dataverse testdv2;
+use dataverse testdv2;
+
+create type testtype01 as closed {
+ id: string,
+ name: string?
+}
+
+create type testtype02 as closed {
+ id: string
+}
+
+create dataset testds01(testtype01) partitioned by key id;
+
+create dataset testds02(testtype02) partitioned by key id;
+
+insert into dataset testds01 (
+{ "id": "001" }
+);
+
+insert into dataset testds01 (
+{ "id": "002", "name": "John Doe" }
+);
+
+insert into dataset testds02 (
+{ "id": "003" }
+);
+
+insert into dataset testds02 (
+{ "id": "004" }
+);
+
+insert into dataset testds02 (
+{ "id": "005" }
+);
+
+insert into dataset testds01(
+for $d in dataset("testds02")
+return $d
+);
+
+for $d in dataset("testds01")
+return $d
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-15.aql b/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-15.aql
new file mode 100644
index 0000000..80cfa30
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-15.aql
@@ -0,0 +1,51 @@
+/*
+ * Testcase Name : open-closed-15.aql
+ * Description : Test closed type dataset (with primitives).
+ * : Create Index on int 32 field
+ * : Insert data into primitives and retrieve data.
+ * Success : Yes this test should PASS!
+ * Date : March 30th 2012
+ */
+
+drop dataverse test if exists;
+
+create dataverse test;
+
+use dataverse test;
+
+create type Schema as closed{
+id_8: int8,
+id_16: int16,
+id_32: int32,
+id_64: int64,
+fp : float,
+name: string,
+dt: date,
+tm: time,
+dt_tm: datetime,
+lat_lon: point
+}
+
+create dataset tdtst(Schema) partitioned by key id_32;
+
+insert into dataset tdtst(
+let $f1:=time("10:50:56:200+05:00")
+let $f2:=datetime("2011-12-31T14:00:00-10:00")
+let $f3:=point("100.0,200.0")
+return {
+"id_8":100,
+"id_16":1011,
+"id_32":23455,
+"id_64":34567,
+"fp":87.61863f,
+"name":"John",
+"dt":"03-21-1982",
+"tm": $f1,
+"dt_tm": $f2,
+"lat_lon": $f3
+}
+);
+
+for $l in dataset('tdtst')
+return $l
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-16.aql b/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-16.aql
new file mode 100644
index 0000000..c463cb0
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-16.aql
@@ -0,0 +1,51 @@
+/*
+ * Testcase Name : open-closed-16.aql
+ * Description : Test open type dataset (with primitives).
+ * : Create Index on int 32 field
+ * : Insert data into primitives and retrieve data.
+ * Success : Yes this test should PASS!
+ * Date : March 30th 2012
+ */
+
+drop dataverse test if exists;
+
+create dataverse test;
+
+use dataverse test;
+
+create type Schema as open{
+id_8: int8,
+id_16: int16,
+id_32: int32,
+id_64: int64,
+fp : float,
+name: string,
+dt: date,
+tm: time,
+dt_tm: datetime,
+lat_lon: point
+}
+
+create dataset tdtst(Schema) partitioned by key id_32;
+
+insert into dataset tdtst(
+let $f1:=time("10:50:56:200+05:00")
+let $f2:=datetime("2011-12-31T14:00:00-10:00")
+let $f3:=point("100.0,200.0")
+return {
+"id_8":100,
+"id_16":1011,
+"id_32":23455,
+"id_64":34567,
+"fp":87.61863f,
+"name":"John",
+"dt":"03-21-1982",
+"tm": $f1,
+"dt_tm": $f2,
+"lat_lon": $f3
+}
+);
+
+for $l in dataset('tdtst')
+return $l
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-17.aql b/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-17.aql
new file mode 100644
index 0000000..f1fe349
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-17.aql
@@ -0,0 +1,47 @@
+/*
+ * Testcase Name : open-closed-17.aql
+ * Description : Test open type dataset by inserting additional data along with inserting data for existing fields.
+ * Success : Yes
+ * Date : March 30th 2012
+ */
+
+drop dataverse test if exists;
+create dataverse test;
+use dataverse test;
+
+create type Schema as open{
+id_8: int8,
+id_16: int16,
+id_32: int32,
+id_64: int64,
+fp : float,
+name: string,
+dt: date,
+tm: time,
+dt_tm: datetime,
+lat_lon: point
+}
+
+create dataset tdtst(Schema) partitioned by key id_32;
+
+insert into dataset tdtst(
+let $f1:=time("10:50:56:200+05:00")
+let $f2:=datetime("2011-12-31T14:00:00-10:00")
+let $f3:=point("100.0,200.0")
+return {
+"id_8":100,
+"id_16":1011,
+"id_32":23455,
+"id_64":34567,
+"fp":87.61863f,
+"name":"John",
+"dt":"03-21-1982",
+"tm": $f1,
+"dt_tm": $f2,
+"lat_lon": $f3,
+"mydata":{{"this is my additional data"}}
+}
+);
+
+for $l in dataset('tdtst')
+return $l
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-18.aql b/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-18.aql
new file mode 100644
index 0000000..0da1474
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-18.aql
@@ -0,0 +1,21 @@
+/*
+ * Test case name : open-closed-18.aql
+ * Description : Test insertion of additional data into an open type internal dataset.
+ * Success : Yes
+ * Date : 29 April 2012
+ */
+
+drop dataverse test if exists;
+create dataverse test;
+use dataverse test;
+
+create type TestType as open {
+id:int32
+}
+
+create dataset testds(TestType) partitioned by key id;
+
+insert into dataset testds( for $i in range(1,10) return { "id":$i,"name":"John Doe" });
+
+for $l in dataset('testds')
+return $l
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-19.aql b/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-19.aql
new file mode 100644
index 0000000..3ff2d71
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-19.aql
@@ -0,0 +1,51 @@
+/*
+ * Test case name : open-closed-19.aql
+ * Description : Insert into open type internal dataset by querying another internal dataset
+ * : In this case source dataset has (n+n) fields and the target dataset has only n fields
+ * Success : Yes
+ * Date : 29 April 2012
+ */
+
+
+drop dataverse test if exists;
+create dataverse test;
+use dataverse test;
+
+create type TestType as open {
+id:int32
+}
+
+create dataset dtst01(TestType) partitioned by key id;
+
+insert into dtst01({"id":137});
+insert into dtst01({"id":117});
+insert into dtst01({"id":127});
+insert into dtst01({"id":147});
+
+create type Emp as open {
+id:int32,
+name:string,
+age:int8,
+sex:string,
+dob:date
+}
+
+create dataset employee(Emp) partitioned by key id;
+
+insert into dataset employee({"id":201,"name":"John Doe","age":32,"sex":"M","dob":"1-1-82"});
+insert into dataset employee({"id":202,"name":"John Smith","age":30,"sex":"M","dob":"1-1-82"});
+insert into dataset employee({"id":201,"name":"John Wayne","age":62,"sex":"M","dob":"1-1-82"});
+insert into dataset employee({"id":203,"name":"Roger Sanders","age":48,"sex":"M","dob":"1-1-82"});
+insert into dataset employee({"id":204,"name":"Raj Singh","age":37,"sex":"M","dob":"1-1-82"});
+insert into dataset employee({"id":205,"name":"Mike Tyson","age":44,"sex":"M","dob":"1-1-82"});
+insert into dataset employee({"id":206,"name":"Brett Lee","age":35,"sex":"M","dob":"1-1-82"});
+insert into dataset employee({"id":207,"name":"Chen Li","age":39,"sex":"M","dob":"1-1-82"});
+insert into dataset employee({"id":208,"name":"Mike Carey","age":42,"sex":"M","dob":"1-1-82"});
+insert into dataset employee({"id":209,"name":"Abdullah","age":29,"sex":"M","dob":"1-1-82"});
+insert into dataset employee({"id":221,"name":"Mariam","age":25,"sex":"F","dob":"1-1-82"});
+insert into dataset employee({"id":221,"name":"Mariam","age":25,"sex":"F","dob":"1-1-82","desgination":{{"dsg":"Department Manager"}}});
+
+insert into dataset dtst01({for $l in dataset('employee') return $l});
+
+for $l in dataset('dtst01')
+retunr $l
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-20.aql b/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-20.aql
new file mode 100644
index 0000000..cc2513f
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-20.aql
@@ -0,0 +1,46 @@
+/*
+ * Test case name : open-closed-20.aql
+ * Description : Insert into open type internal dataset by querying another internal dataset
+ * : In this case source dataset has (n+n) fields and the target dataset has only n fields, but has no intial records in it.
+ * Success : Yes
+ * Date : 29 April 2012
+ */
+
+
+drop dataverse test if exists;
+create dataverse test;
+use dataverse test;
+
+create type TestType as open {
+id:int32
+}
+
+create dataset dtst01(TestType) partitioned by key id;
+
+create type Emp as open {
+id:int32,
+name:string,
+age:int8,
+sex:string,
+dob:date
+}
+
+create dataset employee(Emp) partitioned by key id;
+
+insert into dataset employee({"id":201,"name":"John Doe","age":32,"sex":"M","dob":"1-1-82"});
+insert into dataset employee({"id":202,"name":"John Smith","age":30,"sex":"M","dob":"1-1-82"});
+insert into dataset employee({"id":201,"name":"John Wayne","age":62,"sex":"M","dob":"1-1-82"});
+insert into dataset employee({"id":203,"name":"Roger Sanders","age":48,"sex":"M","dob":"1-1-82"});
+insert into dataset employee({"id":204,"name":"Raj Singh","age":37,"sex":"M","dob":"1-1-82"});
+insert into dataset employee({"id":205,"name":"Mike Tyson","age":44,"sex":"M","dob":"1-1-82"});
+insert into dataset employee({"id":206,"name":"Brett Lee","age":35,"sex":"M","dob":"1-1-82"});
+insert into dataset employee({"id":207,"name":"Chen Li","age":39,"sex":"M","dob":"1-1-82"});
+insert into dataset employee({"id":208,"name":"Mike Carey","age":42,"sex":"M","dob":"1-1-82"});
+insert into dataset employee({"id":209,"name":"Abdullah","age":29,"sex":"M","dob":"1-1-82"});
+insert into dataset employee({"id":221,"name":"Mariam","age":25,"sex":"F","dob":"1-1-82"});
+insert into dataset employee({"id":221,"name":"Mariam","age":25,"sex":"F","dob":"1-1-82","desgination":{{"dsg":"Department Manager"}}});
+
+insert into dataset dtst01({for $l in dataset('employee') return $l});
+
+for $l in dataset('dtst01')
+retunr $l
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-21.aql b/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-21.aql
new file mode 100644
index 0000000..c1c7ab2
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-21.aql
@@ -0,0 +1,45 @@
+/*
+ * Test case name : open-closed-21.aql
+ * Description : Insert into open type internal dataset by querying another closed type internal dataset
+ * : In this case source dataset has (n+n) fields and the target dataset has only n fields, but has no intial records in it.
+ * Success : Yes
+ * Date : 29 April 2012
+ */
+
+
+drop dataverse test if exists;
+create dataverse test;
+use dataverse test;
+
+create type TestType as open {
+id:int32
+}
+
+create dataset dtst01(TestType) partitioned by key id;
+
+create type Emp as closed {
+id:int32,
+name:string,
+age:int8,
+sex:string,
+dob:date
+}
+
+create dataset employee(Emp) partitioned by key id;
+
+insert into dataset employee({"id":201,"name":"John Doe","age":32,"sex":"M","dob":"1-1-82"});
+insert into dataset employee({"id":202,"name":"John Smith","age":30,"sex":"M","dob":"1-1-82"});
+insert into dataset employee({"id":201,"name":"John Wayne","age":62,"sex":"M","dob":"1-1-82"});
+insert into dataset employee({"id":203,"name":"Roger Sanders","age":48,"sex":"M","dob":"1-1-82"});
+insert into dataset employee({"id":204,"name":"Raj Singh","age":37,"sex":"M","dob":"1-1-82"});
+insert into dataset employee({"id":205,"name":"Mike Tyson","age":44,"sex":"M","dob":"1-1-82"});
+insert into dataset employee({"id":206,"name":"Brett Lee","age":35,"sex":"M","dob":"1-1-82"});
+insert into dataset employee({"id":207,"name":"Chen Li","age":39,"sex":"M","dob":"1-1-82"});
+insert into dataset employee({"id":208,"name":"Mike Carey","age":42,"sex":"M","dob":"1-1-82"});
+insert into dataset employee({"id":209,"name":"Abdullah","age":29,"sex":"M","dob":"1-1-82"});
+insert into dataset employee({"id":221,"name":"Mariam","age":25,"sex":"F","dob":"1-1-82"});
+
+insert into dataset dtst01({for $l in dataset('employee') return $l});
+
+for $l in dataset('dtst01')
+retunr $l