Merge branch 'salsubaiee/asterix_lsm_stabilization_issue_266' into asterix_lsm_stabilization (Reviewed by Raman.)
diff --git a/asterix-app/src/test/resources/metadata/queries/exception/issue_255_create_dataset_error_1/issue_255_create_dataset_error_1.1.ddl.aql b/asterix-app/src/test/resources/metadata/queries/exception/issue_255_create_dataset_error_1/issue_255_create_dataset_error_1.1.ddl.aql
index 32ccf6d..132d63e 100644
--- a/asterix-app/src/test/resources/metadata/queries/exception/issue_255_create_dataset_error_1/issue_255_create_dataset_error_1.1.ddl.aql
+++ b/asterix-app/src/test/resources/metadata/queries/exception/issue_255_create_dataset_error_1/issue_255_create_dataset_error_1.1.ddl.aql
@@ -2,7 +2,7 @@
* Description : create a dataset partitioned on non-existent field
* Expected Res : Failure
* Date : 14 April 2013
- * Issue : 272
+ * Issue : 255
*/
drop dataverse test if exists;
diff --git a/asterix-app/src/test/resources/metadata/queries/exception/issue_255_create_dataset_error_2/issue_255_create_dataset_error_2.1.ddl.aql b/asterix-app/src/test/resources/metadata/queries/exception/issue_255_create_dataset_error_2/issue_255_create_dataset_error_2.1.ddl.aql
index add51df..e900e6d 100644
--- a/asterix-app/src/test/resources/metadata/queries/exception/issue_255_create_dataset_error_2/issue_255_create_dataset_error_2.1.ddl.aql
+++ b/asterix-app/src/test/resources/metadata/queries/exception/issue_255_create_dataset_error_2/issue_255_create_dataset_error_2.1.ddl.aql
@@ -2,7 +2,7 @@
* Description : create a dataset partitioned on ARecord type
* Expected Res : Failure
* Date : 14 April 2013
- * Issue : 272
+ * Issue : 255
*/
drop dataverse test if exists;
diff --git a/asterix-app/src/test/resources/metadata/queries/exception/issue_255_create_feed_error/issue_255_create_feed_error.1.ddl.aql b/asterix-app/src/test/resources/metadata/queries/exception/issue_255_create_feed_error/issue_255_create_feed_error.1.ddl.aql
index 647b93a..7576da7 100644
--- a/asterix-app/src/test/resources/metadata/queries/exception/issue_255_create_feed_error/issue_255_create_feed_error.1.ddl.aql
+++ b/asterix-app/src/test/resources/metadata/queries/exception/issue_255_create_feed_error/issue_255_create_feed_error.1.ddl.aql
@@ -2,7 +2,7 @@
* Description : create a dataset partitioned on non-existent field
* Expected Res : Failure
* Date : 14 April 2013
- * Issue : 272
+ * Issue : 255
*/
drop dataverse feeds if exists;
diff --git a/asterix-app/src/test/resources/metadata/queries/exception/issue_266_create_dataset_error_1/issue_266_create_dataset_error_1.1.ddl.aql b/asterix-app/src/test/resources/metadata/queries/exception/issue_266_create_dataset_error_1/issue_266_create_dataset_error_1.1.ddl.aql
new file mode 100644
index 0000000..717ba21
--- /dev/null
+++ b/asterix-app/src/test/resources/metadata/queries/exception/issue_266_create_dataset_error_1/issue_266_create_dataset_error_1.1.ddl.aql
@@ -0,0 +1,16 @@
+/*
+ * Description : create a dataset partitioned on unallowed key type
+ * Expected Res : Failure
+ * Date : 22 April 2013
+ * Issue : 266
+ */
+
+drop dataverse test if exists;
+create dataverse test;
+use dataverse test;
+
+create type opentype as open {
+loc:point
+}
+
+create dataset testds(opentype) primary key point;
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/metadata/queries/exception/issue_266_create_dataset_error_2/issue_266_create_dataset_error_2.1.ddl.aql b/asterix-app/src/test/resources/metadata/queries/exception/issue_266_create_dataset_error_2/issue_266_create_dataset_error_2.1.ddl.aql
new file mode 100644
index 0000000..cda7ae9
--- /dev/null
+++ b/asterix-app/src/test/resources/metadata/queries/exception/issue_266_create_dataset_error_2/issue_266_create_dataset_error_2.1.ddl.aql
@@ -0,0 +1,16 @@
+/*
+ * Description : create a dataset partitioned on nullable key type
+ * Expected Res : Failure
+ * Date : 22 April 2013
+ * Issue : 266
+ */
+
+drop dataverse test if exists;
+create dataverse test;
+use dataverse test;
+
+create type opentype as open {
+id:int32?
+}
+
+create dataset testds(opentype) primary key id;
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/metadata/testsuite.xml b/asterix-app/src/test/resources/metadata/testsuite.xml
index fb833b7..de671ba 100644
--- a/asterix-app/src/test/resources/metadata/testsuite.xml
+++ b/asterix-app/src/test/resources/metadata/testsuite.xml
@@ -242,6 +242,18 @@
<expected-error>edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException</expected-error>
</compilation-unit>
</test-case>
+ <test-case FilePath="exception">
+ <compilation-unit name="issue_266_create_dataset_error_1">
+ <output-dir compare="Text">none</output-dir>
+ <expected-error>edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException</expected-error>
+ </compilation-unit>
+ </test-case>
+ <test-case FilePath="exception">
+ <compilation-unit name="issue_266_create_dataset_error_2">
+ <output-dir compare="Text">none</output-dir>
+ <expected-error>edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException</expected-error>
+ </compilation-unit>
+ </test-case>
</test-group>
<test-group name="transaction">
<test-case FilePath="transaction">
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/types/ARecordType.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/types/ARecordType.java
index 788010b..e301cee 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/om/types/ARecordType.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/types/ARecordType.java
@@ -251,9 +251,19 @@
IAType fieldType = getFieldType(fieldName);
if (fieldType == null) {
throw new AlgebricksException("A field with this name \"" + fieldName + "\" could not be found.");
- } else if (fieldType.getTypeTag() == ATypeTag.RECORD) {
- throw new AlgebricksException("The partitioning key \"" + fieldName + "\" cannot be of type "
- + ATypeTag.RECORD + ".");
+ }
+ switch (fieldType.getTypeTag()) {
+ case INT32:
+ case INT64:
+ case FLOAT:
+ case DOUBLE:
+ case STRING:
+ break;
+ case UNION:
+ throw new AlgebricksException("The partitioning key \"" + fieldName + "\" cannot be nullable");
+ default:
+ throw new AlgebricksException("The partitioning key \"" + fieldName + "\" cannot be of type "
+ + fieldType.getTypeTag() + ".");
}
}
}