You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@asterixdb.apache.org by mh...@apache.org on 2019/05/07 23:50:40 UTC
[asterixdb] branch master updated: [NO ISSUE][FAIL] Cast Exception
Clean Up
This is an automated email from the ASF dual-hosted git repository.
mhubail pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/asterixdb.git
The following commit(s) were added to refs/heads/master by this push:
new dd0c3d2 [NO ISSUE][FAIL] Cast Exception Clean Up
dd0c3d2 is described below
commit dd0c3d27343c61ea10263c9d62936cd1e6c1b37c
Author: Murtadha Hubail <mh...@apache.org>
AuthorDate: Sun May 5 21:25:56 2019 +0300
[NO ISSUE][FAIL] Cast Exception Clean Up
- user model changes: no
- storage format changes: no
- interface changes: no
Details:
- Use proper exception type for cast exception.
- Move cast exception message to error properties file.
- Improve cast exception message.
- Update test cases to new error message.
Change-Id: I07c6c3c344b930ecbfaf6111a89c62b5d13868d9
Reviewed-on: https://asterix-gerrit.ics.uci.edu/3382
Contrib: Jenkins <je...@fulliautomatix.ics.uci.edu>
Sonar-Qube: Jenkins <je...@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <je...@fulliautomatix.ics.uci.edu>
Integration-Tests: Jenkins <je...@fulliautomatix.ics.uci.edu>
Reviewed-by: Ian Maxon <im...@uci.edu>
---
asterixdb/asterix-app/src/test/resources/runtimets/testsuite.xml | 2 +-
.../asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml | 2 +-
.../asterix-common/src/main/resources/asx_errormsg/en.properties | 1 +
.../java/org/apache/asterix/om/pointables/cast/ARecordCaster.java | 4 ++--
4 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/testsuite.xml b/asterixdb/asterix-app/src/test/resources/runtimets/testsuite.xml
index 8725af0..f16b187 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/testsuite.xml
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/testsuite.xml
@@ -1466,7 +1466,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>Field type double can't be promoted to type string</expected-error>
+ <expected-error>Field type double cannot be promoted to type string</expected-error>
</compilation-unit>
</test-case>
<test-case FilePath="open-closed"><!-- Exception is never thrown. Commenting it -->
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml b/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
index 1f093d7..baeb7c5 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
@@ -7429,7 +7429,7 @@
<test-case FilePath="open-closed">
<compilation-unit name="query-issue410">
<output-dir compare="Text">query-issue410</output-dir>
- <expected-error>Field type double can't be promoted to type string</expected-error>
+ <expected-error>Field type double cannot be promoted to type string</expected-error>
<source-location>false</source-location>
</compilation-unit>
</test-case>
diff --git a/asterixdb/asterix-common/src/main/resources/asx_errormsg/en.properties b/asterixdb/asterix-common/src/main/resources/asx_errormsg/en.properties
index a69a6cf..4243837 100644
--- a/asterixdb/asterix-common/src/main/resources/asx_errormsg/en.properties
+++ b/asterixdb/asterix-common/src/main/resources/asx_errormsg/en.properties
@@ -32,6 +32,7 @@
4005 = Unsupported replication strategy %1$s
# Type errors
+1 = Field type %1$s cannot be promoted to type %2$s
2,1002 = Type mismatch: function %1$s expects its %2$s input parameter to be of type %3$s, but the actual input type is %4$s
3,1003 = Type incompatibility: function %1$s gets incompatible input values: %2$s and %3$s
4,1004 = Unsupported type: %1$s cannot process input type %2$s
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/pointables/cast/ARecordCaster.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/pointables/cast/ARecordCaster.java
index 96433ac..56bdfc5 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/pointables/cast/ARecordCaster.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/pointables/cast/ARecordCaster.java
@@ -29,6 +29,7 @@ import java.util.List;
import org.apache.asterix.builders.RecordBuilder;
import org.apache.asterix.common.exceptions.ErrorCode;
+import org.apache.asterix.common.exceptions.RuntimeDataException;
import org.apache.asterix.om.pointables.ARecordVisitablePointable;
import org.apache.asterix.om.pointables.PointableAllocator;
import org.apache.asterix.om.pointables.base.DefaultOpenFieldType;
@@ -222,8 +223,7 @@ class ARecordCaster {
fieldPermutation[reqFnPos] = fnPos;
openFields[fnPos] = false;
} else {
- throw new HyracksDataException(ErrorCode.ASTERIX, ErrorCode.CASTING_FIELD,
- "Field type %1$s can't be promoted to type %2$s", inputTypeTag, requiredTypeTag);
+ throw new RuntimeDataException(ErrorCode.CASTING_FIELD, inputTypeTag, requiredTypeTag);
}
}
fnStart++;