Unify runtime type exceptions by using error code and message template.
-- fixed string_join to be able to handle self-described list;
-- fixed the input arity of day_of_week;
-- added tests for exceptions.
RuntimeDataException is a newly added super class for errors in the data in the runtime.
It has the following subclasses:
-- IncompatibleTypeException, e.g., 1 + "2"
-- InvalidDataFormatException, e.g., boolean(1)
-- OverflowException, e.g., int8(1024)
-- TypeMismatchException, e.g., substr(1, 2)
-- UnderflowException, e.g., int8(-1024)
-- UnsupportedItemTypeException, e.g., string_concat(["a", 1, "c"])
-- UnsupportedTypeException, e.g., rectangle("1,2 3,4") + rectangle("2,5 7,8")
All "root-cause" exceptions thrown from runtime functions have an error code.
Going forward, all "root-cause" exceptions thrown from asterixdb
should have an error code.
Change-Id: Ie4fff8f5e64ffb027910a4899c0246b37ed5bce7
Reviewed-on: https://asterix-gerrit.ics.uci.edu/1313
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Integration-Tests: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: abdullah alamoudi <bamousaa@gmail.com>
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/testsuite.xml b/asterixdb/asterix-app/src/test/resources/runtimets/testsuite.xml
index 942b546..dd859c4 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/testsuite.xml
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/testsuite.xml
@@ -452,19 +452,19 @@
<test-case FilePath="aggregate">
<compilation-unit name="avg_mixed">
<output-dir compare="Text">avg_mixed</output-dir>
- <expected-error>org.apache.hyracks.algebricks.common.exceptions.AlgebricksException: Unexpected type STRING</expected-error>
+ <expected-error>Type incompatibility: function agg-avg gets incompatible input values: string and float</expected-error>
</compilation-unit>
</test-case>
<test-case FilePath="aggregate">
<compilation-unit name="sum_mixed">
<output-dir compare="Text">sum_mixed</output-dir>
- <expected-error>org.apache.hyracks.algebricks.common.exceptions.AlgebricksException: Unexpected type STRING</expected-error>
+ <expected-error>Type incompatibility: function agg-sum gets incompatible input values: string and float</expected-error>
</compilation-unit>
</test-case>
<test-case FilePath="aggregate">
<compilation-unit name="min_mixed">
<output-dir compare="Text">min_mixed</output-dir>
- <expected-error>org.apache.hyracks.algebricks.common.exceptions.AlgebricksException: Unexpected type STRING</expected-error>
+ <expected-error>Type incompatibility: function min/max gets incompatible input values: string and float</expected-error>
</compilation-unit>
</test-case>
<test-case FilePath="aggregate">
@@ -913,19 +913,19 @@
<test-case FilePath="aggregate-sql">
<compilation-unit name="avg_mixed">
<output-dir compare="Text">avg_mixed</output-dir>
- <expected-error>org.apache.hyracks.algebricks.common.exceptions.AlgebricksException: Unexpected type STRING</expected-error>
+ <expected-error>Type incompatibility: function agg-avg gets incompatible input values: string and float</expected-error>
</compilation-unit>
</test-case>
<test-case FilePath="aggregate-sql">
<compilation-unit name="sum_mixed">
<output-dir compare="Text">sum_mixed</output-dir>
- <expected-error>org.apache.hyracks.algebricks.common.exceptions.AlgebricksException: Unexpected type STRING</expected-error>
+ <expected-error>Type incompatibility: function agg-sum gets incompatible input values: string and float</expected-error>
</compilation-unit>
</test-case>
<test-case FilePath="aggregate-sql">
<compilation-unit name="min_mixed">
<output-dir compare="Text">min_mixed</output-dir>
- <expected-error>org.apache.hyracks.algebricks.common.exceptions.AlgebricksException: Unexpected type STRING</expected-error>
+ <expected-error>Type incompatibility: function min/max gets incompatible input values: string and float</expected-error>
</compilation-unit>
</test-case>
<test-case FilePath="aggregate-sql">
@@ -1560,7 +1560,7 @@
<test-case FilePath="dml">
<compilation-unit name="insert-duplicated-keys-from-query">
<output-dir compare="Text">insert-duplicated-keys-from-query</output-dir>
- <expected-error>org.apache.hyracks.storage.am.common.exceptions.TreeIndexDuplicateKeyException: Failed to insert key since key already exists</expected-error>
+ <expected-error>Failed to insert key since key already exists</expected-error>
</compilation-unit>
</test-case>
<test-case FilePath="dml">
@@ -1755,7 +1755,7 @@
<test-case FilePath="dml">
<compilation-unit name="insert-with-autogenerated-pk_adm_02">
<output-dir compare="Text">insert-with-autogenerated-pk_adm_02</output-dir>
- <expected-error>org.apache.hyracks.algebricks.common.exceptions.AlgebricksException: Duplicate field id encountered</expected-error>
+ <expected-error>Duplicate field id encountered</expected-error>
</compilation-unit>
</test-case>
<test-case FilePath="dml">
@@ -2566,7 +2566,7 @@
<test-case FilePath="fuzzyjoin">
<compilation-unit name="dblp-aqlplus_2">
<output-dir compare="Text">dblp-aqlplus_2</output-dir>
- <expected-error>org.apache.hyracks.algebricks.common.exceptions.AlgebricksException: Invalid types STRING given as arguments to jaccard</expected-error>
+ <expected-error>Type mismatch: function similarity-jaccard expects its 1st input parameter to be type orderedlist or unorderedlist, but the actual input type is string</expected-error>
</compilation-unit>
</test-case>
<test-case FilePath="fuzzyjoin">
@@ -3215,7 +3215,7 @@
<test-case FilePath="meta">
<compilation-unit name="query_dataset_with_meta_failure">
<output-dir compare="Text">query_dataset_with_meta_failure</output-dir>
- <expected-error>org.apache.hyracks.algebricks.common.exceptions.AlgebricksException: Cannot resolve to ambiguity on the meta function call -- there are more than once dataset choices!</expected-error>
+ <expected-error>Cannot resolve to ambiguity on the meta function call -- there are more than one dataset choices!</expected-error>
</compilation-unit>
</test-case>
</test-group>
@@ -3224,8 +3224,8 @@
<compilation-unit name="partition-by-nonexistent-field"> <!-- Seriously?? 3 expected errors -->
<output-dir compare="Text">partition-by-nonexistent-field</output-dir>
<expected-error>Type not found for partitioning key [id]</expected-error>
- <expected-error>org.apache.hyracks.algebricks.common.exceptions.AlgebricksException: Cannot find dataset</expected-error>
- <expected-error>org.apache.hyracks.algebricks.common.exceptions.AlgebricksException: Could not find dataset</expected-error>
+ <expected-error>Cannot find dataset</expected-error>
+ <expected-error>Could not find dataset</expected-error>
</compilation-unit>
</test-case>
<test-case FilePath="misc">
@@ -3338,25 +3338,25 @@
<test-case FilePath="open-index-enforced/error-checking">
<compilation-unit name="index-on-closed-type">
<output-dir compare="Text">index-on-closed-type</output-dir>
- <expected-error>org.apache.hyracks.algebricks.common.exceptions.AlgebricksException: Typed index on "[value]" field could be created only for open datatype</expected-error>
+ <expected-error>Typed index on "[value]" field could be created only for open datatype</expected-error>
</compilation-unit>
</test-case>
<test-case FilePath="open-index-enforced/error-checking">
<compilation-unit name="index-type-collision">
<output-dir compare="Text">index-type-collision</output-dir>
- <expected-error>org.apache.asterix.common.exceptions.AsterixException: Cannot create index testIdx2 , enforced index testIdx1 on field "[value]" is already defined with type "[INT32]"</expected-error>
+ <expected-error>org.apache.asterix.common.exceptions.AsterixException: Cannot create index testIdx2 , enforced index testIdx1 on field "[value]" is already defined with type "[int32]"</expected-error>
</compilation-unit>
</test-case>
<test-case FilePath="open-index-enforced/error-checking">
<compilation-unit name="index-type-promotion-collision">
<output-dir compare="Text">index-type-promotion-collision</output-dir>
- <expected-error>org.apache.asterix.common.exceptions.AsterixException: Cannot create index testIdx2 , enforced index testIdx1 on field "[value]" is already defined with type "[INT64]"</expected-error>
+ <expected-error>org.apache.asterix.common.exceptions.AsterixException: Cannot create index testIdx2 , enforced index testIdx1 on field "[value]" is already defined with type "[int64]"</expected-error>
</compilation-unit>
</test-case>
<test-case FilePath="open-index-enforced/error-checking">
<compilation-unit name="missing-enforce-statement">
<output-dir compare="Text">missing-enforce-statement</output-dir>
- <expected-error>org.apache.hyracks.algebricks.common.exceptions.AlgebricksException: Cannot create typed index on "[value]" field without enforcing it's type</expected-error>
+ <expected-error>Cannot create typed index on "[value]" field without enforcing it's type</expected-error>
</compilation-unit>
</test-case>
<test-case FilePath="open-index-enforced/error-checking">
@@ -3368,7 +3368,7 @@
<test-case FilePath="open-index-enforced/error-checking">
<compilation-unit name="object-type-collision">
<output-dir compare="Text">object-type-collision</output-dir>
- <expected-error>org.apache.asterix.common.exceptions.AsterixException: A field "[value]" is already defined with the type "STRING"</expected-error>
+ <expected-error>org.apache.asterix.common.exceptions.AsterixException: A field "[value]" is already defined with the type "string"</expected-error>
</compilation-unit>
</test-case>
</test-group>
@@ -4689,7 +4689,7 @@
<test-case FilePath="open-closed"><!-- Throws two exceptions. need to be checked. proposal: (fixed expected results) -->
<compilation-unit name="query-issue410">
<output-dir compare="Text">query-issue410</output-dir>
- <expected-error>HyracksDataException: ASX0000: Field type DOUBLE can't be promoted to type STRING</expected-error>
+ <expected-error>Field type double can't be promoted to type string</expected-error>
</compilation-unit>
</test-case>
<test-case FilePath="open-closed">
@@ -6589,7 +6589,7 @@
<test-case FilePath="load">
<compilation-unit name="issue650_query">
<output-dir compare="Text">none</output-dir>
- <expected-error>org.apache.hyracks.algebricks.common.exceptions.AlgebricksException: Unable to load dataset Users since it does not exist</expected-error>
+ <expected-error>Unable to load dataset Users since it does not exist</expected-error>
</compilation-unit>
</test-case>
<test-case FilePath="load">