Tests to query undeclared data
git-svn-id: https://asterixdb.googlecode.com/svn/branches/asterix_opentype@360 eaa15691-b419-025a-1212-ee371bd00084
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-28.aql b/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-28.aql
new file mode 100644
index 0000000..864674b
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-28.aql
@@ -0,0 +1,49 @@
+/*
+ * Testcase Name : open-closed-28.aql
+ * Description : Query for undeclared data from an open type internal dataset
+ * : use the every keyword in the where clause
+ * Status : Yes
+ * Date : 31st May 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
+);
+
+// select all hobbies where hiking is one of the hobbies
+
+for $d in dataset('testds01')
+where every $h in $d.hobbies satisfies $h='hiking'
+return $d
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-29.aql b/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-29.aql
new file mode 100644
index 0000000..8b9a792
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-29.aql
@@ -0,0 +1,49 @@
+/*
+ * Testcase Name : open-closed-29.aql
+ * Description : Query for undeclared data from an open type internal dataset
+ * : use the some keyword in the where clause
+ * Status : Yes
+ * Date : 31st May 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
+);
+
+// select all hobbies where hiking is one of the hobbies
+
+for $d in dataset('testds01')
+where some $h in $d.hobbies satisfies $h='hiking'
+return $d
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-30.aql b/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-30.aql
new file mode 100644
index 0000000..10ee3ee
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-30.aql
@@ -0,0 +1,47 @@
+/*
+ * Test case Name : open-closed-30.aql
+ * Description : Query undeclared data using every in the WHERE clause
+ * : where every $h in $d.hobbies satisfies $h='hiking'
+ * Success : Yes
+ * Date : 31st May 2012
+ */
+
+drop dataverse testdv2 if exists;
+create dataverse testdv2;
+use dataverse testdv2;
+
+create type testtype01 as open {
+ id: 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": "011", "name": "John Doe", "hobbies": {{"scuba", "music"}}}
+);
+
+insert into dataset testds02 (
+{ "id": "102", "name": "Roger Sanders", "hobbies": {{"fishing", "dance"}}}
+);
+
+
+insert into dataset testds02 (
+{ "id": "203", "name": "Phil Smith", "hobbies": {{"hiking", "surfing"}}}
+);
+
+insert into dataset testds01(
+for $d in dataset("testds02")
+return $d
+);
+
+for $d in dataset('testds01')
+where every $h in $d.hobbies satisfies $h='hiking'
+return $d.hobbies
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-31.aql b/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-31.aql
new file mode 100644
index 0000000..403ca37
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-31.aql
@@ -0,0 +1,46 @@
+/*
+ * Test case Name : open-closed-31.aql
+ * Description :
+ * Success : Yes
+ * Date : 31st May 2012
+ */
+
+drop dataverse testdv2 if exists;
+create dataverse testdv2;
+use dataverse testdv2;
+
+create type testtype01 as open {
+ id: 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": "011", "name": "John Doe", "hobbies": {{"scuba", "music"}}}
+);
+
+insert into dataset testds02 (
+{ "id": "102", "name": "Roger Sanders", "hobbies": {{"fishing", "dance"}}}
+);
+
+
+insert into dataset testds02 (
+{ "id": "203", "name": "Phil Smith", "hobbies": {{"hiking", "surfing"}}}
+);
+
+insert into dataset testds01(
+for $d in dataset("testds02")
+return $d
+);
+
+for $d in dataset('testds01')
+where some $h in $d.hobbies satisfies $h='hiking'
+return $d.hobbies
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-32.aql b/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-32.aql
new file mode 100644
index 0000000..243e0b1
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-32.aql
@@ -0,0 +1,52 @@
+/*
+ * Test case Name : open-closed-32.aql
+ * Description : INSERT into target (closed type) internal dataset by doing SELECT on (closed type) source internal dataset
+ * : then query the target internal dataset for data enclosed within {{ }} braces, in this case interests field.
+ * Success : Yes
+ * Date : 31st May 2012
+ */
+
+drop dataverse testdv2 if exists;
+create dataverse testdv2;
+use dataverse testdv2;
+
+create type testtype01 as open {
+id: string
+}
+
+create type testtype02 as closed {
+id : string,
+name : string,
+sex : string,
+dept : string,
+salary : int32,
+interests : {{string}}
+}
+
+create dataset testds01(testtype01) partitioned by key id;
+
+create dataset testds02(testtype02) partitioned by key id;
+
+insert into dataset testds02 (
+{ "id": "011", "name": "John Doe", "sex":"Male", "dept":"HR", "salary":80000,"interests":{{"hiking","scuba","painting","biking"}}});
+
+insert into dataset testds02 (
+{ "id": "921", "name": "John Smith", "sex":"Male", "dept":"Sales", "salary":65000,"interests":{{"gardening","biking","reading","hiking","fishing"}}});
+
+insert into dataset testds02 (
+{ "id": "959", "name": "Susan Malaika", "sex":"Female", "dept":"XML Dev", "salary":200000,"interests":{{"XML","Web Services","Cloud","X-Forms","art","travelling"}}});
+
+insert into dataset testds02 (
+{ "id": "371", "name": "Tom Sawyer", "sex":"Male", "dept":"Well Being", "salary":90000,"interests":{{"tennis","scuba","running","biking"}}});
+
+// insert into open type target dataset by doing a select on the closed type (source) internal dataset
+
+insert into dataset testds01(
+for $d in dataset("testds02")
+return $d
+);
+
+for $d in dataset('testds01')
+where some $h in $d.interests satisfies $h='biking'
+return $d.interests
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-33.aql b/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-33.aql
new file mode 100644
index 0000000..b196a26
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-33.aql
@@ -0,0 +1,53 @@
+/*
+ * Test case Name : open-closed-33.aql
+ * Description : INSERT into target (closed type) internal dataset by doing SELECT on (closed type) source internal dataset
+ * : then query the target internal dataset for data enclosed within {{ }} braces, in this case interests field.
+ * : Here the interests field is optional.
+ * Success : Yes
+ * Date : 31st May 2012
+ */
+
+drop dataverse testdv2 if exists;
+create dataverse testdv2;
+use dataverse testdv2;
+
+create type testtype01 as open {
+id: string
+}
+
+create type testtype02 as closed {
+id : string,
+name : string,
+sex : string,
+dept : string,
+salary : int32,
+interests : {{string}}?
+}
+
+create dataset testds01(testtype01) partitioned by key id;
+
+create dataset testds02(testtype02) partitioned by key id;
+
+insert into dataset testds02 (
+{ "id": "011", "name": "John Doe", "sex":"Male", "dept":"HR", "salary":80000,"interests":{{"hiking","scuba","painting","biking"}}});
+
+insert into dataset testds02 (
+{ "id": "921", "name": "John Smith", "sex":"Male", "dept":"Sales", "salary":65000,"interests":{{"gardening","biking","reading","hiking","fishing"}}});
+
+insert into dataset testds02 (
+{ "id": "959", "name": "Susan Malaika", "sex":"Female", "dept":"XML Dev", "salary":200000,"interests":{{"XML","Web Services","Cloud","X-Forms","art","travelling"}}});
+
+insert into dataset testds02 (
+{ "id": "371", "name": "Tom Sawyer", "sex":"Male", "dept":"Well Being", "salary":90000,"interests":{{"tennis","scuba","running","biking"}}});
+
+// insert into open type target dataset by doing a select on the closed type (source) internal dataset
+
+insert into dataset testds01(
+for $d in dataset("testds02")
+return $d
+);
+
+for $d in dataset('testds01')
+where some $h in $d.interests satisfies $h='biking'
+return $d.interests
+