Murtadha Hubail has uploaded this change for review. (
https://asterix-gerrit.ics.uci.edu/3382
Change subject: [NO ISSUE][FAIL] Cast Exception Clean Up
......................................................................
[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
---
M asterixdb/asterix-app/src/test/resources/runtimets/testsuite.xml
M asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
M asterixdb/asterix-common/src/main/resources/asx_errormsg/en.properties
M
asterixdb/asterix-om/src/main/java/org/apache/asterix/om/pointables/cast/ARecordCaster.java
4 files changed, 5 insertions(+), 4 deletions(-)
git pull ssh://asterix-gerrit.ics.uci.edu:29418/asterixdb
refs/changes/82/3382/1
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 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 @@
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++;
--
To view, visit https://asterix-gerrit.ics.uci.edu/3382
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I07c6c3c344b930ecbfaf6111a89c62b5d13868d9
Gerrit-Change-Number: 3382
Gerrit-PatchSet: 1
Gerrit-Owner: Murtadha Hubail <[email protected]>