clean up list type computer and remove redudant/negative queries

git-svn-id: https://asterixdb.googlecode.com/svn/branches/asterix_opentype@325 eaa15691-b419-025a-1212-ee371bd00084
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
deleted file mode 100644
index e15577b..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-02.aql
+++ /dev/null
@@ -1,25 +0,0 @@
-/* 
- * 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});
-
-write output to nc1:"rttest/open-closed_open-closed-02.adm";
-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
deleted file mode 100644
index f028c89..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-03.aql
+++ /dev/null
@@ -1,24 +0,0 @@
-/* 
- * 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
deleted file mode 100644
index 82912bd..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-04.aql
+++ /dev/null
@@ -1,31 +0,0 @@
-/* 
- * 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
deleted file mode 100644
index 2bd18fe..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-05.aql
+++ /dev/null
@@ -1,30 +0,0 @@
-/* 
- * 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
deleted file mode 100644
index f6605a6..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-06.aql
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * 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
deleted file mode 100644
index 155f8bb..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-07.aql
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * 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
deleted file mode 100644
index 24423e8..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-08.aql
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * 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
deleted file mode 100644
index 63288d7..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-09.aql
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * 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
deleted file mode 100644
index cad1f12..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-10.aql
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * 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
deleted file mode 100644
index 50d52d2..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-11.aql
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * 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
index 2459fcc..49c8af0 100644
--- 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
@@ -43,6 +43,7 @@
 return $d
 );
 
+write output to nc1:"rttest/open-closed_open-closed-12.adm";
 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
deleted file mode 100644
index 379e282..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-13.aql
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * 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 dataset testds(testtype) partitioned by key id;
-
-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
index 03e6e33..d90bd1b 100644
--- 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
@@ -48,6 +48,7 @@
 return $d
 );
 
+write output to nc1:"rttest/open-closed_open-closed-14.adm";
 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
index 80cfa30..2ac2567 100644
--- 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
@@ -46,6 +46,7 @@
 }
 );
 
+write output to nc1:"rttest/open-closed_open-closed-15.adm";
 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
index c463cb0..5e1a591 100644
--- 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
@@ -46,6 +46,7 @@
 }
 );
 
+write output to nc1:"rttest/open-closed_open-closed-16.adm";
 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
index f1fe349..a590cf1 100644
--- 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
@@ -43,5 +43,6 @@
 }
 );
 
+write output to nc1:"rttest/open-closed_open-closed-17.adm";
 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
deleted file mode 100644
index 0da1474..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-18.aql
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * 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
index 3ff2d71..b406663 100644
--- 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
@@ -47,5 +47,6 @@
 
 insert into dataset dtst01({for $l in dataset('employee') return $l});
 
+write output to nc1:"rttest/open-closed_open-closed-19.adm";
 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
index d7ad173..29b4366 100644
--- 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
@@ -41,5 +41,6 @@
 
 insert into dataset dtst01(for $l in dataset('employee') return $l);
 
+write output to nc1:"rttest/open-closed_open-closed-20.adm";
 for $l in dataset('dtst01')
 return $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
index 71ce585..c52344e 100644
--- 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
@@ -38,5 +38,6 @@
 
 insert into dataset dtst01(for $l in dataset('employee') return $l);
 
+write output to nc1:"rttest/open-closed_open-closed-21.adm";
 for $l in dataset('dtst01')
 return $l 
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-22.aql b/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-22.aql
index 6e05f61..cd9ac44 100644
--- a/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-22.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/open-closed/open-closed-22.aql
@@ -39,5 +39,6 @@
 // missing dept field
 insert into dataset employee({"id":205,"name":"Mike Tyson","age":44,"sex":"M","dob":date("1970-12-22")});
 
+write output to nc1:"rttest/open-closed_open-closed-22.adm";
 for $l in dataset('employee')
 return $l 
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OrderedListConstructorResultType.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OrderedListConstructorResultType.java
index c4e35b6..84ac969 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OrderedListConstructorResultType.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OrderedListConstructorResultType.java
@@ -7,6 +7,7 @@
 import edu.uci.ics.asterix.om.types.AOrderedListType;
 import edu.uci.ics.asterix.om.types.ATypeTag;
 import edu.uci.ics.asterix.om.types.AUnionType;
+import edu.uci.ics.asterix.om.types.BuiltinType;
 import edu.uci.ics.asterix.om.types.IAType;
 import edu.uci.ics.asterix.om.util.NonTaggedFormatUtil;
 import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
@@ -43,7 +44,7 @@
         if (types.size() == 1) {
             return new AOrderedListType(types.get(0), null);
         } else {
-            throw new AlgebricksException("You can not construct a heterogenous list.");
+            return new AOrderedListType(BuiltinType.ANY, null);
         }
 
     }
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/UnorderedListConstructorResultType.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/UnorderedListConstructorResultType.java
index 21c473d..a4fd12a 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/UnorderedListConstructorResultType.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/UnorderedListConstructorResultType.java
@@ -7,6 +7,7 @@
 import edu.uci.ics.asterix.om.types.ATypeTag;
 import edu.uci.ics.asterix.om.types.AUnionType;
 import edu.uci.ics.asterix.om.types.AUnorderedListType;
+import edu.uci.ics.asterix.om.types.BuiltinType;
 import edu.uci.ics.asterix.om.types.IAType;
 import edu.uci.ics.asterix.om.util.NonTaggedFormatUtil;
 import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
@@ -43,7 +44,7 @@
         if (types.size() == 1) {
             return new AUnorderedListType(types.get(0), null);
         } else {
-            throw new AlgebricksException("You can not construct a heterogenous list.");
+            return new AUnorderedListType(BuiltinType.ANY, null);
         }
 
     }