asterixdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From buyin...@apache.org
Subject [22/22] asterixdb git commit: Unify runtime type exceptions by using error code and message template.
Date Tue, 01 Nov 2016 03:08:31 GMT
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>


Project: http://git-wip-us.apache.org/repos/asf/asterixdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/asterixdb/commit/52671a2c
Tree: http://git-wip-us.apache.org/repos/asf/asterixdb/tree/52671a2c
Diff: http://git-wip-us.apache.org/repos/asf/asterixdb/diff/52671a2c

Branch: refs/heads/master
Commit: 52671a2c86fd8fc9714b576b3039a91f83e0be98
Parents: 7b14477
Author: Yingyi Bu <yingyi@couchbase.com>
Authored: Mon Oct 31 10:48:33 2016 -0700
Committer: Yingyi Bu <buyingyi@gmail.com>
Committed: Mon Oct 31 20:07:32 2016 -0700

----------------------------------------------------------------------
 .../physical/CommitRuntimeFactory.java          |   4 +-
 .../optimizer/rules/ConstantFoldingRule.java    |  22 +-
 .../rules/MetaFunctionToMetaVariableRule.java   |   2 +-
 .../app/cc/CompilerExtensionManager.java        |  15 +-
 .../asterix/app/nc/NCExtensionManager.java      |   6 +-
 .../apache/asterix/runtime/ExceptionTest.java   | 115 ++++
 .../apache/asterix/runtime/NullMissingTest.java |  19 +-
 .../src/test/resources/metadata/testsuite.xml   |  14 +-
 .../queries/comparison/ComparisonQueries.xml    |  14 +-
 .../src/test/resources/runtimets/testsuite.xml  |  38 +-
 .../resources/runtimets/testsuite_sqlpp.xml     |  34 +-
 .../asterix/common/exceptions/ErrorCode.java    |  85 ++-
 .../common/exceptions/RuntimeDataException.java |  36 ++
 .../external/library/ExternalFunction.java      |   5 +-
 .../library/ExternalFunctionProvider.java       |  28 +-
 .../ExternalScalarFunctionEvaluatorFactory.java |   3 +-
 .../external/library/JavaFunctionHelper.java    |   2 +-
 .../asterix/external/classad/ClassAd.java       |   2 +-
 .../serde/ACircleSerializerDeserializer.java    |   2 +-
 .../ADayTimeDurationSerializerDeserializer.java |   2 +-
 .../serde/ALineSerializerDeserializer.java      |   2 +-
 .../serde/ARectangleSerializerDeserializer.java |   2 +-
 ...YearMonthDurationSerializerDeserializer.java |   2 +-
 .../nontagged/AqlBinaryIntegerInspector.java    |   2 +-
 .../AsterixTemporalTypeParseException.java      |   8 -
 .../om/functions/AsterixBuiltinFunctions.java   |   2 +-
 .../org/apache/asterix/om/types/ATypeTag.java   |   7 +
 .../om/types/hierachy/ATypeHierarchy.java       | 113 ++--
 .../FirstElementAggregateDescriptor.java        |   5 +-
 .../collections/FirstElementEvalFactory.java    |  15 +-
 .../collections/ListifyAggregateDescriptor.java |   5 +-
 .../ListifyAggregateFunctionEvalFactory.java    |  17 +-
 .../LocalFirstElementAggregateDescriptor.java   |   5 +-
 .../AbstractScalarAggregateDescriptor.java      |   4 +-
 .../scalar/GenericScalarAggregateFunction.java  |   6 +-
 ...bstractSerializableAvgAggregateFunction.java |  48 +-
 ...tractSerializableCountAggregateFunction.java |  16 +-
 ...bstractSerializableSumAggregateFunction.java |  33 +-
 .../std/SerializableAvgAggregateDescriptor.java |   3 +-
 .../std/SerializableAvgAggregateFunction.java   |  10 +-
 .../SerializableCountAggregateDescriptor.java   |   6 +-
 .../std/SerializableCountAggregateFunction.java |   4 +-
 ...erializableGlobalAvgAggregateDescriptor.java |   6 +-
 .../SerializableGlobalAvgAggregateFunction.java |  10 +-
 ...alizableGlobalSqlAvgAggregateDescriptor.java |   6 +-
 ...rializableGlobalSqlAvgAggregateFunction.java |  10 +-
 ...zableIntermediateAvgAggregateDescriptor.java |   6 +-
 ...lizableIntermediateAvgAggregateFunction.java |  10 +-
 ...leIntermediateSqlAvgAggregateDescriptor.java |   6 +-
 ...ableIntermediateSqlAvgAggregateFunction.java |  10 +-
 ...SerializableLocalAvgAggregateDescriptor.java |   6 +-
 .../SerializableLocalAvgAggregateFunction.java  |  10 +-
 ...ializableLocalSqlAvgAggregateDescriptor.java |   6 +-
 ...erializableLocalSqlAvgAggregateFunction.java |  10 +-
 ...ializableLocalSqlSumAggregateDescriptor.java |   6 +-
 ...SerializableLocalSumAggregateDescriptor.java |   6 +-
 .../SerializableSqlAvgAggregateDescriptor.java  |   6 +-
 .../SerializableSqlAvgAggregateFunction.java    |  10 +-
 ...SerializableSqlCountAggregateDescriptor.java |   6 +-
 .../SerializableSqlCountAggregateFunction.java  |   4 +-
 .../SerializableSqlSumAggregateDescriptor.java  |   6 +-
 .../SerializableSqlSumAggregateFunction.java    |  11 +-
 .../std/SerializableSumAggregateDescriptor.java |   6 +-
 .../std/SerializableSumAggregateFunction.java   |  11 +-
 .../std/AbstractAvgAggregateFunction.java       |  37 +-
 .../std/AbstractCountAggregateFunction.java     |  14 +-
 .../std/AbstractMinMaxAggregateFunction.java    |  55 +-
 .../std/AbstractSumAggregateFunction.java       |  28 +-
 .../aggregates/std/AvgAggregateDescriptor.java  |   7 +-
 .../aggregates/std/AvgAggregateFunction.java    |  10 +-
 .../std/CountAggregateDescriptor.java           |   8 +-
 .../aggregates/std/CountAggregateFunction.java  |   4 +-
 .../std/GlobalAvgAggregateDescriptor.java       |   7 +-
 .../std/GlobalAvgAggregateFunction.java         |  10 +-
 .../std/GlobalSqlAvgAggregateDescriptor.java    |   7 +-
 .../std/GlobalSqlAvgAggregateFunction.java      |  10 +-
 .../std/IntermediateAvgAggregateDescriptor.java |   7 +-
 .../std/IntermediateAvgAggregateFunction.java   |  10 +-
 .../IntermediateSqlAvgAggregateDescriptor.java  |   7 +-
 .../IntermediateSqlAvgAggregateFunction.java    |  10 +-
 .../std/LocalAvgAggregateDescriptor.java        |   7 +-
 .../std/LocalAvgAggregateFunction.java          |  10 +-
 .../std/LocalMaxAggregateDescriptor.java        |   7 +-
 .../std/LocalMinAggregateDescriptor.java        |   7 +-
 .../std/LocalSqlAvgAggregateDescriptor.java     |   7 +-
 .../std/LocalSqlAvgAggregateFunction.java       |  10 +-
 .../std/LocalSqlMaxAggregateDescriptor.java     |   7 +-
 .../std/LocalSqlMinAggregateDescriptor.java     |   7 +-
 .../std/LocalSqlSumAggregateDescriptor.java     |   7 +-
 .../std/LocalSumAggregateDescriptor.java        |   7 +-
 .../aggregates/std/MaxAggregateDescriptor.java  |   7 +-
 .../aggregates/std/MinAggregateDescriptor.java  |   7 +-
 .../aggregates/std/MinMaxAggregateFunction.java |   9 +-
 .../std/SqlAvgAggregateDescriptor.java          |   7 +-
 .../aggregates/std/SqlAvgAggregateFunction.java |  10 +-
 .../std/SqlCountAggregateDescriptor.java        |   7 +-
 .../std/SqlCountAggregateFunction.java          |   4 +-
 .../std/SqlMaxAggregateDescriptor.java          |   7 +-
 .../std/SqlMinAggregateDescriptor.java          |   7 +-
 .../std/SqlMinMaxAggregateFunction.java         |   9 +-
 .../std/SqlSumAggregateDescriptor.java          |   7 +-
 .../aggregates/std/SqlSumAggregateFunction.java |  11 +-
 .../aggregates/std/SumAggregateDescriptor.java  |   7 +-
 .../aggregates/std/SumAggregateFunction.java    |  11 +-
 .../stream/EmptyStreamAggregateDescriptor.java  |  20 +-
 .../NonEmptyStreamAggregateDescriptor.java      |  21 +-
 .../runtime/base/AsterixTupleFilter.java        |   6 +-
 .../accessors/CircleCenterAccessor.java         |  16 +-
 .../accessors/CircleRadiusAccessor.java         |  16 +-
 .../accessors/LineRectanglePolygonAccessor.java |  22 +-
 .../accessors/PointXCoordinateAccessor.java     |  17 +-
 .../accessors/PointYCoordinateAccessor.java     |  16 +-
 .../accessors/TemporalDayAccessor.java          |  18 +-
 .../accessors/TemporalHourAccessor.java         |  17 +-
 .../accessors/TemporalIntervalEndAccessor.java  |  22 +-
 .../TemporalIntervalEndDateAccessor.java        |  24 +-
 .../TemporalIntervalEndDatetimeAccessor.java    |  24 +-
 .../TemporalIntervalEndTimeAccessor.java        |  25 +-
 .../TemporalIntervalStartAccessor.java          |  21 +-
 .../TemporalIntervalStartDateAccessor.java      |  28 +-
 .../TemporalIntervalStartDatetimeAccessor.java  |  25 +-
 .../TemporalIntervalStartTimeAccessor.java      |  24 +-
 .../accessors/TemporalMillisecondAccessor.java  |  18 +-
 .../accessors/TemporalMinuteAccessor.java       |  18 +-
 .../accessors/TemporalMonthAccessor.java        |  18 +-
 .../accessors/TemporalSecondAccessor.java       |  20 +-
 .../accessors/TemporalYearAccessor.java         |  20 +-
 .../common/AbstractTypeCheckEvaluator.java      |  13 +-
 .../common/AccessibleByteArrayEval.java         |   8 +-
 .../evaluators/common/AsterixListAccessor.java  |  15 +-
 .../ClosedRecordConstructorEvalFactory.java     |  31 +-
 .../evaluators/common/CreateMBREvalFactory.java |  37 +-
 .../common/EditDistanceCheckEvaluator.java      |  18 +-
 .../common/EditDistanceContainsEvaluator.java   |  20 +-
 .../common/EditDistanceEvaluator.java           |  46 +-
 .../evaluators/common/GramTokensEvaluator.java  |  17 +-
 .../common/SimilarityFiltersCache.java          |  10 +-
 .../common/SimilarityJaccardCheckEvaluator.java |   9 +-
 .../common/SimilarityJaccardEvaluator.java      |  49 +-
 .../SimilarityJaccardPrefixEvaluator.java       |  86 +--
 .../SimilarityJaccardSortedCheckEvaluator.java  |  11 +-
 .../SimilarityJaccardSortedEvaluator.java       |  11 +-
 .../evaluators/common/WordTokensEvaluator.java  |   8 +-
 .../AbstractComparisonEvaluator.java            |  33 +-
 .../comparisons/ComparisonHelper.java           | 302 ++++------
 .../comparisons/DeepEqualAssessor.java          |  17 +-
 .../comparisons/EqualsDescriptor.java           |   6 +-
 .../comparisons/GreaterThanDescriptor.java      |   6 +-
 .../GreaterThanOrEqualsDescriptor.java          |   6 +-
 .../comparisons/LessThanDescriptor.java         |   6 +-
 .../comparisons/LessThanOrEqualsDescriptor.java |   6 +-
 .../comparisons/NotEqualsDescriptor.java        |   6 +-
 ...BinaryBase64StringConstructorDescriptor.java |   7 +-
 .../ABinaryHexStringConstructorDescriptor.java  |  25 +-
 .../ABooleanConstructorDescriptor.java          |  20 +-
 .../ACircleConstructorDescriptor.java           |  17 +-
 .../ADateConstructorDescriptor.java             |  19 +-
 .../ADateTimeConstructorDescriptor.java         |  25 +-
 .../ADayTimeDurationConstructorDescriptor.java  |  17 +-
 .../ADoubleConstructorDescriptor.java           |  17 +-
 .../ADurationConstructorDescriptor.java         |  18 +-
 .../AFloatConstructorDescriptor.java            |  30 +-
 .../AInt16ConstructorDescriptor.java            |  23 +-
 .../AInt32ConstructorDescriptor.java            |  23 +-
 .../AInt64ConstructorDescriptor.java            |  24 +-
 .../AInt8ConstructorDescriptor.java             |  20 +-
 .../AIntervalConstructorDescriptor.java         |  30 +-
 ...ervalStartFromDateConstructorDescriptor.java |  34 +-
 ...lStartFromDateTimeConstructorDescriptor.java |  37 +-
 ...ervalStartFromTimeConstructorDescriptor.java |  42 +-
 .../ALineConstructorDescriptor.java             |  17 +-
 .../ANullConstructorDescriptor.java             |  19 +-
 .../APoint3DConstructorDescriptor.java          |  17 +-
 .../APointConstructorDescriptor.java            |  17 +-
 .../APolygonConstructorDescriptor.java          |  21 +-
 .../ARectangleConstructorDescriptor.java        |  22 +-
 .../AStringConstructorDescriptor.java           |  13 +-
 .../ATimeConstructorDescriptor.java             |  23 +-
 .../AUUIDFromStringConstructorDescriptor.java   |  16 +-
 ...AYearMonthDurationConstructorDescriptor.java |  17 +-
 .../OpenRecordConstructorDescriptor.java        |  45 +-
 .../functions/AbstractBinaryStringBoolEval.java |   4 +-
 .../functions/AbstractBinaryStringEval.java     |  20 +-
 .../functions/AbstractBinaryStringIntEval.java  |   4 +-
 .../AbstractBinaryStringStringEval.java         |   6 +-
 .../AbstractNumericArithmeticEval.java          | 311 +++++-----
 .../functions/AbstractQuadStringStringEval.java |  59 +-
 .../functions/AbstractTripleStringBoolEval.java |   4 +-
 .../functions/AbstractTripleStringEval.java     |  26 +-
 .../functions/AbstractTripleStringIntEval.java  |   7 +-
 .../AbstractTripleStringStringEval.java         |   4 +-
 .../AbstractUnaryNumericDoubleFunctionEval.java |  16 +-
 .../AbstractUnaryNumericFunctionEval.java       |  30 +-
 .../AbstractUnaryStringStringEval.java          |  13 +-
 .../evaluators/functions/AndDescriptor.java     |  98 ++-
 .../AnyCollectionMemberDescriptor.java          |  35 +-
 .../evaluators/functions/BinaryHashMap.java     |   1 -
 .../functions/CastTypeDescriptor.java           |  12 +-
 .../functions/CheckUnknownDescriptor.java       |  11 +-
 .../functions/CodePointToStringDescriptor.java  |  28 +-
 .../CountHashedGramTokensDescriptor.java        |   3 +-
 .../CountHashedWordTokensDescriptor.java        |   7 +-
 .../functions/CreateCircleDescriptor.java       |  26 +-
 .../functions/CreateLineDescriptor.java         |  26 +-
 .../functions/CreateMBRDescriptor.java          |   3 +-
 .../functions/CreatePointDescriptor.java        |  26 +-
 .../functions/CreatePolygonDescriptor.java      |  48 +-
 .../functions/CreateQueryUIDDescriptor.java     |   8 +-
 .../functions/CreateRectangleDescriptor.java    |  26 +-
 .../functions/CreateUUIDDescriptor.java         |  17 +-
 .../functions/DeepEqualityDescriptor.java       |   8 +-
 .../functions/EditDistanceCheckDescriptor.java  |   7 +-
 .../EditDistanceContainsDescriptor.java         |   7 +-
 .../functions/EditDistanceDescriptor.java       |   7 +-
 .../EditDistanceListIsFilterableDescriptor.java |  28 +-
 ...ditDistanceStringIsFilterableDescriptor.java |   7 +-
 ...EditDistanceStringIsFilterableEvaluator.java |  45 +-
 .../evaluators/functions/GetItemDescriptor.java |  23 +-
 .../functions/GramTokensDescriptor.java         |   7 +-
 .../functions/HashedGramTokensDescriptor.java   |   7 +-
 .../functions/HashedWordTokensDescriptor.java   |   7 +-
 .../functions/InjectFailureDescriptor.java      |  15 +-
 .../evaluators/functions/IsArrayDescriptor.java |   7 +-
 .../functions/IsBooleanDescriptor.java          |   7 +-
 .../functions/IsMissingDescriptor.java          |   7 +-
 .../evaluators/functions/IsNullDescriptor.java  |   7 +-
 .../functions/IsNumberDescriptor.java           |   7 +-
 .../functions/IsObjectDescriptor.java           |   7 +-
 .../functions/IsStringDescriptor.java           |   7 +-
 .../functions/IsSystemNullDescriptor.java       |  14 +-
 .../functions/IsUnknownDescriptor.java          |   7 +-
 .../evaluators/functions/LenDescriptor.java     |  20 +-
 .../evaluators/functions/NotDescriptor.java     |  29 +-
 .../functions/NumericACosDescriptor.java        |   8 +-
 .../functions/NumericASinDescriptor.java        |   8 +-
 .../functions/NumericATan2Descriptor.java       |  34 +-
 .../functions/NumericATanDescriptor.java        |   8 +-
 .../functions/NumericAbsDescriptor.java         |  18 +-
 .../functions/NumericAddDescriptor.java         |   5 +-
 .../functions/NumericCaretDescriptor.java       |  10 +-
 .../functions/NumericCeilingDescriptor.java     |  18 +-
 .../functions/NumericCosDescriptor.java         |   8 +-
 .../functions/NumericDivideDescriptor.java      |   4 +-
 .../functions/NumericExpDescriptor.java         |   8 +-
 .../functions/NumericFloorDescriptor.java       |  18 +-
 .../functions/NumericLnDescriptor.java          |   8 +-
 .../functions/NumericLogDescriptor.java         |   8 +-
 .../functions/NumericModuloDescriptor.java      |   7 +-
 .../functions/NumericMultiplyDescriptor.java    |   8 +-
 .../functions/NumericRoundDescriptor.java       |  97 ++-
 .../NumericRoundHalfToEven2Descriptor.java      | 127 ++--
 .../NumericRoundHalfToEvenDescriptor.java       |  96 ++-
 .../functions/NumericSignDescriptor.java        |  18 +-
 .../functions/NumericSinDescriptor.java         |   8 +-
 .../functions/NumericSqrtDescriptor.java        |   8 +-
 .../functions/NumericSubtractDescriptor.java    | 164 +++--
 .../functions/NumericTanDescriptor.java         |   8 +-
 .../functions/NumericTruncDescriptor.java       | 114 ++--
 .../functions/NumericUnaryMinusDescriptor.java  |  18 +-
 .../evaluators/functions/OrDescriptor.java      |  88 ++-
 .../OrderedListConstructorDescriptor.java       |  16 +-
 .../evaluators/functions/PointableHelper.java   |   2 -
 .../functions/PrefixLenDescriptor.java          |  29 +-
 .../functions/PrefixLenJaccardDescriptor.java   |  27 +-
 .../functions/SimilarityDescriptor.java         |  52 +-
 .../SimilarityJaccardCheckDescriptor.java       |   7 +-
 .../functions/SimilarityJaccardDescriptor.java  |   7 +-
 .../SimilarityJaccardPrefixCheckDescriptor.java |  12 +-
 .../SimilarityJaccardPrefixDescriptor.java      |   7 +-
 .../SimilarityJaccardSortedCheckDescriptor.java |   7 +-
 .../SimilarityJaccardSortedDescriptor.java      |   7 +-
 .../functions/SpatialAreaDescriptor.java        |  25 +-
 .../functions/SpatialCellDescriptor.java        |  48 +-
 .../functions/SpatialDistanceDescriptor.java    |  33 +-
 .../functions/SpatialIntersectDescriptor.java   | 595 ++++++++++---------
 .../functions/StringConcatDescriptor.java       |  38 +-
 .../functions/StringContainsDescriptor.java     |   8 +-
 .../functions/StringEndsWithDescriptor.java     |   8 +-
 .../functions/StringEqualDescriptor.java        |   8 +-
 .../functions/StringInitCapDescriptor.java      |   4 +-
 .../functions/StringJoinDescriptor.java         | 165 ++---
 .../functions/StringLTrim2Descriptor.java       |   7 +-
 .../functions/StringLTrimDescriptor.java        |   7 +-
 .../functions/StringLengthDescriptor.java       |  15 +-
 .../functions/StringLikeDescriptor.java         |   7 +-
 .../functions/StringLowerCaseDescriptor.java    |   4 +-
 .../functions/StringPositionDescriptor.java     |   7 +-
 .../functions/StringRTrim2Descriptor.java       |   7 +-
 .../functions/StringRTrimDescriptor.java        |   7 +-
 .../StringRegExpContainsDescriptor.java         |   7 +-
 .../StringRegExpContainsWithFlagDescriptor.java |   7 +-
 .../functions/StringRegExpLikeDescriptor.java   |   7 +-
 .../StringRegExpLikeWithFlagDescriptor.java     |   7 +-
 .../StringRegExpPositionDescriptor.java         |   7 +-
 .../StringRegExpPositionWithFlagDescriptor.java |   7 +-
 .../StringRegExpReplaceDescriptor.java          |   7 +-
 .../StringRegExpReplaceWithFlagsDescriptor.java |   7 +-
 .../functions/StringRepeatDescriptor.java       |  33 +-
 .../functions/StringSplitDescriptor.java        |  21 +-
 .../functions/StringStartsWithDescriptor.java   |   8 +-
 .../functions/StringToCodePointDescriptor.java  |  15 +-
 .../functions/StringTrim2Descriptor.java        |   7 +-
 .../functions/StringTrimDescriptor.java         |   7 +-
 .../functions/StringUpperCaseDescriptor.java    |   4 +-
 .../functions/Substring2Descriptor.java         |  36 +-
 .../functions/SubstringAfterDescriptor.java     |  27 +-
 .../functions/SubstringBeforeDescriptor.java    |  26 +-
 .../functions/SubstringDescriptor.java          |  37 +-
 .../functions/SwitchCaseDescriptor.java         |  10 +-
 .../evaluators/functions/UUIDDescriptor.java    |  17 +-
 .../UnorderedListConstructorDescriptor.java     |  16 +-
 .../functions/WordTokensDescriptor.java         |   7 +-
 .../binary/AbstractBinaryScalarEvaluator.java   |  10 +-
 .../binary/AbstractFindBinaryEvaluator.java     |  33 +-
 .../binary/AbstractSubBinaryEvaluator.java      |  14 +-
 .../binary/BinaryConcatDescriptor.java          |  48 +-
 .../binary/BinaryLengthDescriptor.java          |  20 +-
 .../functions/binary/FindBinaryDescriptor.java  |   9 +-
 .../binary/FindBinaryFromDescriptor.java        |  17 +-
 .../functions/binary/ParseBinaryDescriptor.java |  62 +-
 .../functions/binary/PrintBinaryDescriptor.java |  16 +-
 .../binary/SubBinaryFromDescriptor.java         |   9 +-
 .../binary/SubBinaryFromToDescriptor.java       |  19 +-
 .../records/FieldAccessByIndexEvalFactory.java  |  22 +-
 .../records/FieldAccessByNameEvalFactory.java   |  17 +-
 .../records/FieldAccessNestedEvalFactory.java   |  42 +-
 .../records/GetRecordFieldValueEvalFactory.java |  16 +-
 .../records/GetRecordFieldsEvalFactory.java     |  17 +-
 .../records/RecordAddFieldsDescriptor.java      |  73 ++-
 .../functions/records/RecordFieldsUtil.java     |   9 +-
 .../records/RecordMergeDescriptor.java          |  21 +-
 .../records/RecordPairsDescriptor.java          |  70 +--
 .../records/RecordRemoveFieldsDescriptor.java   |   4 +-
 .../records/RecordRemoveFieldsEvalFactory.java  |  31 +-
 .../AbstractIntervalLogicFuncDescriptor.java    |  49 +-
 .../AdjustDateTimeForTimeZoneDescriptor.java    |  30 +-
 .../AdjustTimeForTimeZoneDescriptor.java        |  30 +-
 .../CalendarDuartionFromDateDescriptor.java     | 216 ++++---
 .../CalendarDurationFromDateTimeDescriptor.java | 221 ++++---
 .../temporal/CurrentDateDescriptor.java         |  22 +-
 .../temporal/CurrentDateTimeDescriptor.java     |  20 +-
 .../temporal/CurrentTimeDescriptor.java         |  23 +-
 .../temporal/DateFromDatetimeDescriptor.java    |  36 +-
 .../DateFromUnixTimeInDaysDescriptor.java       |  19 +-
 .../DatetimeFromDateAndTimeDescriptor.java      |  41 +-
 .../DatetimeFromUnixTimeInMsDescriptor.java     |  50 +-
 .../DatetimeFromUnixTimeInSecsDescriptor.java   |  58 +-
 .../functions/temporal/DayOfWeekDescriptor.java |  84 ++-
 .../DayTimeDurationComparatorDescriptor.java    |  55 +-
 .../temporal/DurationEqualDescriptor.java       |  40 +-
 .../DurationFromIntervalDescriptor.java         |  46 +-
 .../DurationFromMillisecondsDescriptor.java     |  51 +-
 .../temporal/DurationFromMonthsDescriptor.java  |  19 +-
 .../temporal/GetDayTimeDurationDescriptor.java  |  26 +-
 .../GetOverlappingIntervalDescriptor.java       |  62 +-
 .../GetYearMonthDurationDescriptor.java         |  29 +-
 .../temporal/IntervalBinDescriptor.java         |  55 +-
 ...llisecondsFromDayTimeDurationDescriptor.java |  29 +-
 .../MonthsFromYearMonthDurationDescriptor.java  |  28 +-
 .../temporal/OverlapBinsDescriptor.java         |  61 +-
 .../functions/temporal/ParseDateDescriptor.java |  97 ++-
 .../temporal/ParseDateTimeDescriptor.java       |  97 ++-
 .../functions/temporal/ParseTimeDescriptor.java |  94 ++-
 .../functions/temporal/PrintDateDescriptor.java |  29 +-
 .../temporal/PrintDateTimeDescriptor.java       |  26 +-
 .../functions/temporal/PrintTimeDescriptor.java |  28 +-
 .../temporal/TimeFromDatetimeDescriptor.java    |  35 +-
 .../TimeFromUnixTimeInMsDescriptor.java         |  19 +-
 .../UnixTimeFromDateInDaysDescriptor.java       |  27 +-
 .../UnixTimeFromDatetimeInMsDescriptor.java     |  28 +-
 .../UnixTimeFromDatetimeInSecsDescriptor.java   |  30 +-
 .../UnixTimeFromTimeInMsDescriptor.java         |  28 +-
 .../YearMonthDurationComparatorDescriptor.java  |  54 +-
 .../visitors/DeepEqualityVisitor.java           |   3 +-
 .../runtime/exceptions/ExceptionUtil.java       |  64 ++
 .../exceptions/IncompatibleTypeException.java   |  42 ++
 .../exceptions/InvalidDataFormatException.java  |  43 ++
 .../runtime/exceptions/OverflowException.java   |  38 ++
 .../exceptions/TypeMismatchException.java       |  45 ++
 .../runtime/exceptions/UnderflowException.java  |  38 ++
 .../UnsupportedItemTypeException.java           |  38 ++
 .../exceptions/UnsupportedTypeException.java    |  40 ++
 .../std/TidRunningAggregateDescriptor.java      |  20 +-
 .../unnestingfunctions/std/RangeDescriptor.java |  35 +-
 .../std/ScanCollectionDescriptor.java           |  46 +-
 .../std/SubsetCollectionDescriptor.java         |  32 +-
 .../physical/NestedLoopJoinPOperator.java       |  23 +-
 .../IntegerEqFunctionEvaluatorFactory.java      |   6 +-
 .../TupleCountAggregateFunctionFactory.java     |  14 +-
 ...pleCountRunningAggregateFunctionFactory.java |  12 +-
 .../runtime/base/IAggregateEvaluator.java       |  10 +-
 .../base/IAggregateEvaluatorFactory.java        |   4 +-
 .../runtime/base/IPushRuntimeFactory.java       |   3 +-
 .../base/IRunningAggregateEvaluator.java        |   6 +-
 .../base/IRunningAggregateEvaluatorFactory.java |   4 +-
 .../runtime/base/IScalarEvaluator.java          |   4 +-
 .../runtime/base/IScalarEvaluatorFactory.java   |   4 +-
 .../base/ISerializedAggregateEvaluator.java     |  11 +-
 .../ISerializedAggregateEvaluatorFactory.java   |   4 +-
 .../runtime/base/IUnnestingEvaluator.java       |   6 +-
 .../base/IUnnestingEvaluatorFactory.java        |   4 +-
 .../evaluators/ColumnAccessEvalFactory.java     |   6 +-
 .../runtime/evaluators/ConstantEvalFactory.java |   6 +-
 .../evaluators/TupleFieldEvaluatorFactory.java  |   6 +-
 .../aggreg/AggregateRuntimeFactory.java         |  34 +-
 ...estedPlansAccumulatingAggregatorFactory.java |   9 +-
 .../NestedPlansRunningAggregatorFactory.java    |   7 +-
 ...SerializableAggregatorDescriptorFactory.java |  61 +-
 ...AlgebricksAccumulatingAggregatorFactory.java |  43 +-
 ...AbstractOneInputOneOutputRuntimeFactory.java |   5 +-
 .../operators/base/SinkRuntimeFactory.java      |   3 +-
 .../MicroPreClusteredGroupRuntimeFactory.java   |   3 +-
 .../meta/AlgebricksMetaOperatorDescriptor.java  |  17 +-
 .../operators/meta/PipelineAssembler.java       |   3 +-
 .../operators/meta/SubplanRuntimeFactory.java   |  13 +-
 .../sort/InMemorySortRuntimeFactory.java        |   5 +-
 .../operators/std/AssignRuntimeFactory.java     |  11 +-
 .../std/RunningAggregateRuntimeFactory.java     |  21 +-
 .../operators/std/SinkWriterRuntimeFactory.java |  17 +-
 .../operators/std/SplitOperatorDescriptor.java  |  13 +-
 .../std/StreamLimitRuntimeFactory.java          |  17 +-
 .../std/StreamProjectRuntimeFactory.java        |   5 +-
 .../std/StreamSelectRuntimeFactory.java         |  13 +-
 .../std/StringStreamingRuntimeFactory.java      |   4 +-
 .../operators/std/UnnestRuntimeFactory.java     |  13 +-
 .../algebricks/algebricks-tests/pom.xml         |   5 -
 .../tests/pushruntime/IntArrayUnnester.java     |  10 +-
 .../pushruntime/IntegerAddEvalFactory.java      |   7 +-
 .../pushruntime/IntegerConstantEvalFactory.java |   9 +-
 .../pushruntime/IntegerEqualsEvalFactory.java   |   6 +-
 .../IntegerGreaterThanEvalFactory.java          |   6 +-
 .../value/ITuplePairComparatorFactory.java      |   3 +-
 .../api/exceptions/HyracksDataException.java    |  11 +-
 .../std/group/IAggregatorDescriptor.java        |   7 +-
 .../join/NestedLoopJoinOperatorDescriptor.java  |   3 +-
 435 files changed, 5097 insertions(+), 5294 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/asterixdb/blob/52671a2c/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/algebra/operators/physical/CommitRuntimeFactory.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/algebra/operators/physical/CommitRuntimeFactory.java b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/algebra/operators/physical/CommitRuntimeFactory.java
index 9486a19..767d864 100644
--- a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/algebra/operators/physical/CommitRuntimeFactory.java
+++ b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/algebra/operators/physical/CommitRuntimeFactory.java
@@ -20,10 +20,10 @@
 package org.apache.asterix.algebra.operators.physical;
 
 import org.apache.asterix.common.transactions.JobId;
-import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.runtime.base.IPushRuntime;
 import org.apache.hyracks.algebricks.runtime.base.IPushRuntimeFactory;
 import org.apache.hyracks.api.context.IHyracksTaskContext;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
 
 public class CommitRuntimeFactory implements IPushRuntimeFactory {
 
@@ -56,7 +56,7 @@ public class CommitRuntimeFactory implements IPushRuntimeFactory {
     }
 
     @Override
-    public IPushRuntime createPushRuntime(IHyracksTaskContext ctx) throws AlgebricksException {
+    public IPushRuntime createPushRuntime(IHyracksTaskContext ctx) throws HyracksDataException {
         if (upsertVarIdx >= 0) {
             return new UpsertCommitRuntime(ctx, jobId, datasetId, primaryKeyFields, isTemporaryDatasetWriteJob,
                     isWriteTransaction, datasetPartitions[ctx.getTaskAttemptId().getTaskId().getPartition()],

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/52671a2c/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/ConstantFoldingRule.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/ConstantFoldingRule.java b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/ConstantFoldingRule.java
index fec564e..ae31780 100644
--- a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/ConstantFoldingRule.java
+++ b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/ConstantFoldingRule.java
@@ -23,7 +23,6 @@ import java.io.DataInputStream;
 import java.nio.ByteBuffer;
 import java.util.List;
 
-import org.apache.asterix.om.util.ConstantExpressionUtil;
 import org.apache.asterix.common.config.GlobalConfig;
 import org.apache.asterix.dataflow.data.common.AqlExpressionTypeComputer;
 import org.apache.asterix.dataflow.data.nontagged.AqlMissingWriterFactory;
@@ -43,6 +42,7 @@ import org.apache.asterix.om.typecomputer.base.TypeCastUtils;
 import org.apache.asterix.om.types.ARecordType;
 import org.apache.asterix.om.types.ATypeTag;
 import org.apache.asterix.om.types.AbstractCollectionType;
+import org.apache.asterix.om.util.ConstantExpressionUtil;
 import org.apache.commons.lang3.mutable.Mutable;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.common.utils.Pair;
@@ -214,20 +214,20 @@ public class ConstantFoldingRule implements IAlgebraicRewriteRule {
 
             IScalarEvaluatorFactory fact = _jobGenCtx.getExpressionRuntimeProvider().createEvaluatorFactory(expr,
                     _emptyTypeEnv, _emptySchemas, _jobGenCtx);
-            IScalarEvaluator eval = fact.createScalarEvaluator(null);
-            eval.evaluate(null, p);
-            Object t = _emptyTypeEnv.getType(expr);
-
-            @SuppressWarnings("rawtypes")
-            ISerializerDeserializer serde = _jobGenCtx.getSerializerDeserializerProvider().getSerializerDeserializer(t);
-            bbis.setByteBuffer(ByteBuffer.wrap(p.getByteArray(), p.getStartOffset(), p.getLength()), 0);
-            IAObject o;
             try {
-                o = (IAObject) serde.deserialize(dis);
+                IScalarEvaluator eval = fact.createScalarEvaluator(null);
+                eval.evaluate(null, p);
+                Object t = _emptyTypeEnv.getType(expr);
+
+                @SuppressWarnings("rawtypes")
+                ISerializerDeserializer serde = _jobGenCtx.getSerializerDeserializerProvider()
+                        .getSerializerDeserializer(t);
+                bbis.setByteBuffer(ByteBuffer.wrap(p.getByteArray(), p.getStartOffset(), p.getLength()), 0);
+                IAObject o = (IAObject) serde.deserialize(dis);
+                return new Pair<>(true, new ConstantExpression(new AsterixConstantValue(o)));
             } catch (HyracksDataException e) {
                 throw new AlgebricksException(e);
             }
-            return new Pair<Boolean, ILogicalExpression>(true, new ConstantExpression(new AsterixConstantValue(o)));
         }
 
         @Override

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/52671a2c/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/MetaFunctionToMetaVariableRule.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/MetaFunctionToMetaVariableRule.java b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/MetaFunctionToMetaVariableRule.java
index 06a6f37..4fd8d75 100644
--- a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/MetaFunctionToMetaVariableRule.java
+++ b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/MetaFunctionToMetaVariableRule.java
@@ -225,7 +225,7 @@ class LogicalExpressionReferenceTransform implements ILogicalExpressionReference
         // The user query provides zero parameter for the meta function.
         if (variableRequired) {
             throw new AlgebricksException("Cannot resolve to ambiguity on the meta function call --"
-                    + " there are more than once dataset choices!");
+                    + " there are more than one dataset choices!");
         }
         exprRef.setValue(new VariableReferenceExpression(metaVar));
         return true;

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/52671a2c/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/cc/CompilerExtensionManager.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/cc/CompilerExtensionManager.java b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/cc/CompilerExtensionManager.java
index 4734841..c994abd 100644
--- a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/cc/CompilerExtensionManager.java
+++ b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/cc/CompilerExtensionManager.java
@@ -30,6 +30,7 @@ import org.apache.asterix.common.api.ExtensionId;
 import org.apache.asterix.common.api.IExtension;
 import org.apache.asterix.common.config.AsterixExtension;
 import org.apache.asterix.common.exceptions.ErrorCode;
+import org.apache.asterix.common.exceptions.RuntimeDataException;
 import org.apache.asterix.compiler.provider.AqlCompilationProvider;
 import org.apache.asterix.compiler.provider.ILangCompilationProvider;
 import org.apache.asterix.compiler.provider.SqlppCompilationProvider;
@@ -43,10 +44,6 @@ import org.apache.hyracks.api.exceptions.HyracksDataException;
  */
 public class CompilerExtensionManager implements IAlgebraExtensionManager {
 
-    private static final String ERROR_MESSAGE_ID_CONFLICT = "Two Extensions share the same Id: %1$s";
-    public static final String ERROR_MESSAGE_COMPONENT_CONFLICT =
-            "Extension Conflict between %1$s and %2$s both extensions extend %3$s";
-
     private final Map<ExtensionId, IExtension> extensions = new HashMap<>();
 
     private final IStatementExecutorExtension statementExecutorExtension;
@@ -75,8 +72,7 @@ public class CompilerExtensionManager implements IAlgebraExtensionManager {
                 IExtension extension = (IExtension) Class.forName(extensionConf.getClassName()).newInstance();
                 extension.configure(extensionConf.getArgs());
                 if (extensions.containsKey(extension.getId())) {
-                    throw new HyracksDataException(ErrorCode.ASTERIX, ErrorCode.ERROR_EXTENSION_CONFLICT,
-                            ERROR_MESSAGE_ID_CONFLICT, extension.getId());
+                    throw new RuntimeDataException(ErrorCode.ERROR_EXTENSION_ID_CONFLICT, extension.getId());
                 }
                 extensions.put(extension.getId(), extension);
                 switch (extension.getExtensionKind()) {
@@ -101,8 +97,8 @@ public class CompilerExtensionManager implements IAlgebraExtensionManager {
     private Pair<ExtensionId, ILangCompilationProvider> extendLangCompilationProvider(Language lang,
             Pair<ExtensionId, ILangCompilationProvider> cp, ILangExtension le) throws HyracksDataException {
         if (cp != null && le.getLangCompilationProvider(lang) != null) {
-            throw new HyracksDataException(ErrorCode.ASTERIX, ErrorCode.ERROR_EXTENSION_CONFLICT,
-                    ERROR_MESSAGE_COMPONENT_CONFLICT, le.getId(), cp.first, lang.toString());
+            throw new RuntimeDataException(ErrorCode.ERROR_EXTENSION_COMPONENT_CONFLICT, le.getId(), cp.first,
+                    lang.toString());
         }
         return (le.getLangCompilationProvider(lang) != null)
                 ? new Pair<>(le.getId(), le.getLangCompilationProvider(lang)) : cp;
@@ -111,8 +107,7 @@ public class CompilerExtensionManager implements IAlgebraExtensionManager {
     private IStatementExecutorExtension extendStatementExecutor(IStatementExecutorExtension qte,
             IStatementExecutorExtension extension) throws HyracksDataException {
         if (qte != null) {
-            throw new HyracksDataException(ErrorCode.ASTERIX, ErrorCode.ERROR_EXTENSION_CONFLICT,
-                    ERROR_MESSAGE_COMPONENT_CONFLICT, qte.getId(), extension.getId(),
+            throw new RuntimeDataException(ErrorCode.ERROR_EXTENSION_COMPONENT_CONFLICT, qte.getId(), extension.getId(),
                     IStatementExecutorFactory.class.getSimpleName());
         }
         return extension;

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/52671a2c/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/NCExtensionManager.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/NCExtensionManager.java b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/NCExtensionManager.java
index 759bf09..fcf559f 100644
--- a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/NCExtensionManager.java
+++ b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/NCExtensionManager.java
@@ -22,10 +22,10 @@ import java.rmi.RemoteException;
 import java.util.ArrayList;
 import java.util.List;
 
-import org.apache.asterix.app.cc.CompilerExtensionManager;
 import org.apache.asterix.common.api.IExtension;
 import org.apache.asterix.common.config.AsterixExtension;
 import org.apache.asterix.common.exceptions.ACIDException;
+import org.apache.asterix.common.exceptions.RuntimeDataException;
 import org.apache.asterix.common.exceptions.ErrorCode;
 import org.apache.asterix.metadata.api.IMetadataExtension;
 import org.apache.asterix.metadata.entitytupletranslators.MetadataTupleTranslatorProvider;
@@ -76,8 +76,8 @@ public class NCExtensionManager {
     private MetadataTupleTranslatorProvider extendTupleTranslator(MetadataTupleTranslatorProvider ttp,
             IMetadataExtension tupleTranslatorExtension, IMetadataExtension mde) throws HyracksDataException {
         if (ttp != null) {
-            throw new HyracksDataException(ErrorCode.ASTERIX, ErrorCode.ERROR_EXTENSION_CONFLICT,
-                    CompilerExtensionManager.ERROR_MESSAGE_COMPONENT_CONFLICT, tupleTranslatorExtension.getId(),
+            throw new RuntimeDataException(ErrorCode.ERROR_EXTENSION_COMPONENT_CONFLICT,
+                    tupleTranslatorExtension.getId(),
                     mde.getId(), IMetadataExtension.class.getSimpleName());
         }
         return mde.getMetadataTupleTranslatorProvider();

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/52671a2c/asterixdb/asterix-app/src/test/java/org/apache/asterix/runtime/ExceptionTest.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/java/org/apache/asterix/runtime/ExceptionTest.java b/asterixdb/asterix-app/src/test/java/org/apache/asterix/runtime/ExceptionTest.java
new file mode 100644
index 0000000..6a1d6e2
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/java/org/apache/asterix/runtime/ExceptionTest.java
@@ -0,0 +1,115 @@
+
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.asterix.runtime;
+
+import static org.mockito.Mockito.mock;
+
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
+import org.apache.asterix.om.types.ATypeTag;
+import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
+import org.apache.asterix.translator.util.FunctionCollection;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.evaluators.ConstantEvalFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class ExceptionTest {
+
+    @Test
+    public void test() throws Exception {
+        List<IFunctionDescriptorFactory> functions = FunctionCollection.getFunctionDescriptorFactories();
+        int testedFunctions = 0;
+        for (IFunctionDescriptorFactory func : functions) {
+            String className = func.getClass().getName();
+            // We test all generated functions except
+            // record and cast functions, which requires type settings.
+            if (className.contains("Gen") && !className.contains("record") && !className.contains("Cast")) {
+                testFunction(func);
+                ++testedFunctions;
+            }
+        }
+        // 208 is the current number of functions with generated code.
+        Assert.assertTrue(testedFunctions >= 208);
+    }
+
+    private void testFunction(IFunctionDescriptorFactory funcFactory) throws Exception {
+        AbstractScalarFunctionDynamicDescriptor funcDesc = (AbstractScalarFunctionDynamicDescriptor) funcFactory
+                .createFunctionDescriptor();
+        int inputArity = funcDesc.getIdentifier().getArity();
+        Iterator<IScalarEvaluatorFactory[]> argEvalFactoryIterator = getArgCombinations(inputArity);
+        while (argEvalFactoryIterator.hasNext()) {
+            IScalarEvaluatorFactory evalFactory = funcDesc.createEvaluatorFactory(argEvalFactoryIterator.next());
+            IHyracksTaskContext ctx = mock(IHyracksTaskContext.class);
+            IScalarEvaluator evaluator = evalFactory.createScalarEvaluator(ctx);
+            IPointable resultPointable = new VoidPointable();
+            try {
+                evaluator.evaluate(null, resultPointable);
+            } catch (Throwable e) {
+                if (e.getMessage() == null) {
+                    continue;
+                }
+                if (e.getMessage().startsWith("ASX")) {
+                    continue;
+                } else {
+                    // Any root-level data exceptions thrown from runtime functions should have an error code.
+                    Assert.assertTrue(!(e instanceof HyracksDataException) || (e.getCause() != null));
+                }
+            }
+        }
+    }
+
+    private Iterator<IScalarEvaluatorFactory[]> getArgCombinations(final int inputArity) {
+        final int argSize = inputArity >= 0 ? inputArity : 3;
+        final int numCombinations = (int) Math.pow(ATypeTag.values().length, argSize);
+        return new Iterator<IScalarEvaluatorFactory[]>() {
+            private int index = 0;
+
+            @Override
+            public boolean hasNext() {
+                return index < numCombinations;
+            }
+
+            @Override
+            public IScalarEvaluatorFactory[] next() {
+                IScalarEvaluatorFactory[] scalarEvaluatorFactories = new IScalarEvaluatorFactory[argSize];
+                for (int j = 0; j < argSize; ++j) {
+                    int base = (int) Math.pow(ATypeTag.values().length, j);
+                    // Enumerates through all possible type tags.
+                    byte serializedTypeTag = (byte) ((index / base) % ATypeTag.values().length);
+                    scalarEvaluatorFactories[j] = new ConstantEvalFactory(new byte[] { serializedTypeTag });
+                }
+                ++index;
+                return scalarEvaluatorFactories;
+            }
+
+        };
+
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/52671a2c/asterixdb/asterix-app/src/test/java/org/apache/asterix/runtime/NullMissingTest.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/java/org/apache/asterix/runtime/NullMissingTest.java b/asterixdb/asterix-app/src/test/java/org/apache/asterix/runtime/NullMissingTest.java
index d30ffd9..7827297 100644
--- a/asterixdb/asterix-app/src/test/java/org/apache/asterix/runtime/NullMissingTest.java
+++ b/asterixdb/asterix-app/src/test/java/org/apache/asterix/runtime/NullMissingTest.java
@@ -25,6 +25,7 @@ import static org.mockito.Mockito.mock;
 import java.util.Iterator;
 import java.util.List;
 
+import org.apache.asterix.om.functions.IFunctionDescriptor;
 import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
 import org.apache.asterix.om.types.ATypeTag;
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
@@ -43,19 +44,26 @@ public class NullMissingTest {
     @Test
     public void test() throws Exception {
         List<IFunctionDescriptorFactory> functions = FunctionCollection.getFunctionDescriptorFactories();
+        int testedFunctions = 0;
         for (IFunctionDescriptorFactory func : functions) {
             String className = func.getClass().getName();
             // We test all generated functions except
-            // record functions, which requires type settings (we test them in runtime tests);
-            if (className.contains("generated") && !className.contains("record") && !className.contains("Cast")) {
+            // record and cast functions, which requires type settings (we test them in runtime tests).
+            if (className.contains("Gen") && !className.contains("record") && !className.contains("Cast")) {
                 testFunction(func);
+                ++testedFunctions;
             }
         }
+        // 208 is the current number of functions with generated code.
+        Assert.assertTrue(testedFunctions >= 208);
     }
 
     private void testFunction(IFunctionDescriptorFactory funcFactory) throws Exception {
-        AbstractScalarFunctionDynamicDescriptor funcDesc =
-                (AbstractScalarFunctionDynamicDescriptor) funcFactory.createFunctionDescriptor();
+        IFunctionDescriptor functionDescriptor = funcFactory.createFunctionDescriptor();
+        if (!(functionDescriptor instanceof AbstractScalarFunctionDynamicDescriptor)) {
+            return;
+        }
+        AbstractScalarFunctionDynamicDescriptor funcDesc = (AbstractScalarFunctionDynamicDescriptor) functionDescriptor;
         int inputArity = funcDesc.getIdentifier().getArity();
         Iterator<IScalarEvaluatorFactory[]> argEvalFactoryIterator = getArgCombinations(inputArity);
         int index = 0;
@@ -76,7 +84,8 @@ public class NullMissingTest {
         }
     }
 
-    private Iterator<IScalarEvaluatorFactory[]> getArgCombinations(int argSize) {
+    private Iterator<IScalarEvaluatorFactory[]> getArgCombinations(int inputArity) {
+        int argSize = inputArity >= 0 ? inputArity : 3;
         final int numCombinations = 1 << argSize;
         return new Iterator<IScalarEvaluatorFactory[]>() {
             private int index = 0;

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/52671a2c/asterixdb/asterix-app/src/test/resources/metadata/testsuite.xml
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/metadata/testsuite.xml b/asterixdb/asterix-app/src/test/resources/metadata/testsuite.xml
index 7b0e015..298c458 100644
--- a/asterixdb/asterix-app/src/test/resources/metadata/testsuite.xml
+++ b/asterixdb/asterix-app/src/test/resources/metadata/testsuite.xml
@@ -423,7 +423,7 @@
     <test-case FilePath="exception">
       <compilation-unit name="issue_255_create_dataset_error_2">
         <output-dir compare="Text">none</output-dir>
-        <expected-error>Error: The partitioning key [open-type] cannot be of type RECORD.</expected-error>
+        <expected-error>Error: The partitioning key [open-type] cannot be of type record.</expected-error>
       </compilation-unit>
     </test-case>
     <!-- Feed datasets are not supported anymore
@@ -449,37 +449,37 @@
     <test-case FilePath="exception">
       <compilation-unit name="issue_384_create_index_error_1">
         <output-dir compare="Text">none</output-dir>
-        <expected-error>Error: The field "[loc]" which is of type POINT cannot be indexed using the BTree index.</expected-error>
+        <expected-error>Error: The field "[loc]" which is of type point cannot be indexed using the BTree index.</expected-error>
       </compilation-unit>
     </test-case>
     <test-case FilePath="exception">
       <compilation-unit name="issue_384_create_index_error_2">
         <output-dir compare="Text">none</output-dir>
-        <expected-error>Error: The field "[age]" which is of type INT32 cannot be indexed using the RTree index.</expected-error>
+        <expected-error>Error: The field "[age]" which is of type int32 cannot be indexed using the RTree index.</expected-error>
       </compilation-unit>
     </test-case>
     <test-case FilePath="exception">
       <compilation-unit name="issue_384_create_index_error_3">
         <output-dir compare="Text">none</output-dir>
-        <expected-error>Error: The field "[loc]" which is of type POINT cannot be indexed using the Length Partitioned Keyword index.</expected-error>
+        <expected-error>Error: The field "[loc]" which is of type point cannot be indexed using the Length Partitioned Keyword index.</expected-error>
       </compilation-unit>
     </test-case>
     <test-case FilePath="exception">
       <compilation-unit name="issue_384_create_index_error_4">
         <output-dir compare="Text">none</output-dir>
-        <expected-error>Error: The field "[loc]" which is of type POINT cannot be indexed using the Length Partitioned Keyword index.</expected-error>
+        <expected-error>Error: The field "[loc]" which is of type point cannot be indexed using the Length Partitioned Keyword index.</expected-error>
       </compilation-unit>
     </test-case>
     <test-case FilePath="exception">
       <compilation-unit name="issue_384_create_index_error_5">
         <output-dir compare="Text">none</output-dir>
-        <expected-error>Error: The field "[loc]" which is of type POINT cannot be indexed using the Length Partitioned N-Gram index.</expected-error>
+        <expected-error>Error: The field "[loc]" which is of type point cannot be indexed using the Length Partitioned N-Gram index.</expected-error>
       </compilation-unit>
     </test-case>
     <test-case FilePath="exception">
       <compilation-unit name="issue_384_create_index_error_6">
         <output-dir compare="Text">none</output-dir>
-        <expected-error>Error: The field "[loc]" which is of type POINT cannot be indexed using the Length Partitioned N-Gram index.</expected-error>
+        <expected-error>Error: The field "[loc]" which is of type point cannot be indexed using the Length Partitioned N-Gram index.</expected-error>
       </compilation-unit>
     </test-case>
   </test-group>

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/52671a2c/asterixdb/asterix-app/src/test/resources/runtimets/queries/comparison/ComparisonQueries.xml
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/comparison/ComparisonQueries.xml b/asterixdb/asterix-app/src/test/resources/runtimets/queries/comparison/ComparisonQueries.xml
index 8493df2..e549a92 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries/comparison/ComparisonQueries.xml
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries/comparison/ComparisonQueries.xml
@@ -172,43 +172,43 @@
   <test-case FilePath="comparison">
     <compilation-unit name="issue363_inequality_duration">
       <output-dir compare="Text">issue363_inequality_duration</output-dir>
-      <expected-error>org.apache.hyracks.algebricks.common.exceptions.AlgebricksException: Comparison operations (GT, GE, LT, and LE) for the DURATION type are not defined</expected-error>
+      <expected-error>Unsupported type: comparison operations (&gt;, &gt;=, &lt;, and &lt;=) cannot process input type duration</expected-error>
     </compilation-unit>
   </test-case>
   <test-case FilePath="comparison">
     <compilation-unit name="issue363_inequality_interval">
       <output-dir compare="Text">issue363_inequality_interval</output-dir>
-      <expected-error>org.apache.hyracks.algebricks.common.exceptions.AlgebricksException: Comparison operations (GT, GE, LT, and LE) for the INTERVAL type are not defined</expected-error>
+      <expected-error>Unsupported type: comparison operations (&gt;, &gt;=, &lt;, and &lt;=) cannot process input type interval</expected-error>
     </compilation-unit>
   </test-case>
   <test-case FilePath="comparison">
     <compilation-unit name="issue363_inequality_point">
       <output-dir compare="Text">issue363_inequality_point</output-dir>
-      <expected-error>org.apache.hyracks.algebricks.common.exceptions.AlgebricksException: Comparison operations (GT, GE, LT, and LE) for the POINT type are not defined</expected-error>
+      <expected-error>Unsupported type: comparison operations (&gt;, &gt;=, &lt;, and &lt;=) cannot process input type point</expected-error>
     </compilation-unit>
   </test-case>
   <test-case FilePath="comparison">
     <compilation-unit name="issue363_inequality_line">
       <output-dir compare="Text">issue363_inequality_line</output-dir>
-      <expected-error>org.apache.hyracks.algebricks.common.exceptions.AlgebricksException: Comparison operations (GT, GE, LT, and LE) for the LINE type are not defined</expected-error>
+      <expected-error>Unsupported type: comparison operations (&gt;, &gt;=, &lt;, and &lt;=) cannot process input type line</expected-error>
     </compilation-unit>
   </test-case>
   <test-case FilePath="comparison">
     <compilation-unit name="issue363_inequality_polygon">
       <output-dir compare="Text">issue363_inequality_polygon</output-dir>
-      <expected-error>org.apache.hyracks.algebricks.common.exceptions.AlgebricksException: Comparison operations (GT, GE, LT, and LE) for the POLYGON type are not defined</expected-error>
+      <expected-error>Unsupported type: comparison operations (&gt;, &gt;=, &lt;, and &lt;=) cannot process input type polygon</expected-error>
     </compilation-unit>
   </test-case>
   <test-case FilePath="comparison">
     <compilation-unit name="issue363_inequality_rectangle">
       <output-dir compare="Text">issue363_inequality_rectangle</output-dir>
-      <expected-error>org.apache.hyracks.algebricks.common.exceptions.AlgebricksException: Comparison operations (GT, GE, LT, and LE) for the RECTANGLE type are not defined</expected-error>
+      <expected-error>Unsupported type: comparison operations (&gt;, &gt;=, &lt;, and &lt;=) cannot process input type rectangle</expected-error>
     </compilation-unit>
   </test-case>
   <test-case FilePath="comparison">
     <compilation-unit name="issue363_inequality_circle">
       <output-dir compare="Text">issue363_inequality_circle</output-dir>
-      <expected-error>org.apache.hyracks.algebricks.common.exceptions.AlgebricksException: Comparison operations (GT, GE, LT, and LE) for the CIRCLE type are not defined</expected-error>
+      <expected-error>Unsupported type: comparison operations (&gt;, &gt;=, &lt;, and &lt;=) cannot process input type circle</expected-error>
     </compilation-unit>
   </test-case>
   <test-case FilePath="comparison">

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/52671a2c/asterixdb/asterix-app/src/test/resources/runtimets/testsuite.xml
----------------------------------------------------------------------
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">

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/52671a2c/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
----------------------------------------------------------------------
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 f89fd63..1030454 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
@@ -132,19 +132,19 @@
     <test-case FilePath="aggregate">
       <compilation-unit name="avg_mixed">
         <output-dir compare="Text">avg_mixed</output-dir>
-        <expected-error>Unexpected type STRING in aggregation input stream. Expected type FLOAT</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>Unexpected type STRING in aggregation input stream. Expected type (or a promotable type to)FLOAT</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>Unexpected type STRING in aggregation input stream. Expected type FLOAT</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">
@@ -568,19 +568,19 @@
     <test-case FilePath="aggregate-sql">
       <compilation-unit name="avg_mixed">
         <output-dir compare="Text">avg_mixed</output-dir>
-        <expected-error>Unexpected type STRING in aggregation input stream. Expected type FLOAT</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>Unexpected type STRING in aggregation input stream. Expected type (or a promotable type to)FLOAT</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>Unexpected type STRING in aggregation input stream. Expected type FLOAT</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">
@@ -1112,43 +1112,43 @@
     <test-case FilePath="comparison">
       <compilation-unit name="issue363_inequality_duration">
         <output-dir compare="Text">issue363_inequality_duration</output-dir>
-        <expected-error>Comparison operations (GT, GE, LT, and LE) for the DURATION type are not defined</expected-error>
+        <expected-error>Unsupported type: comparison operations (&gt;, &gt;=, &lt;, and &lt;=) cannot process input type duration</expected-error>
       </compilation-unit>
     </test-case>
     <test-case FilePath="comparison">
       <compilation-unit name="issue363_inequality_interval">
         <output-dir compare="Text">issue363_inequality_interval</output-dir>
-        <expected-error>Comparison operations (GT, GE, LT, and LE) for the INTERVAL type are not defined</expected-error>
+        <expected-error>Unsupported type: comparison operations (&gt;, &gt;=, &lt;, and &lt;=) cannot process input type interval</expected-error>
       </compilation-unit>
     </test-case>
     <test-case FilePath="comparison">
       <compilation-unit name="issue363_inequality_point">
         <output-dir compare="Text">issue363_inequality_point</output-dir>
-        <expected-error>Comparison operations (GT, GE, LT, and LE) for the POINT type are not defined</expected-error>
+        <expected-error>Unsupported type: comparison operations (&gt;, &gt;=, &lt;, and &lt;=) cannot process input type point</expected-error>
       </compilation-unit>
     </test-case>
     <test-case FilePath="comparison">
       <compilation-unit name="issue363_inequality_line">
         <output-dir compare="Text">issue363_inequality_line</output-dir>
-        <expected-error>Comparison operations (GT, GE, LT, and LE) for the LINE type are not defined</expected-error>
+        <expected-error>Unsupported type: comparison operations (&gt;, &gt;=, &lt;, and &lt;=) cannot process input type line</expected-error>
       </compilation-unit>
     </test-case>
     <test-case FilePath="comparison">
       <compilation-unit name="issue363_inequality_polygon">
         <output-dir compare="Text">issue363_inequality_polygon</output-dir>
-        <expected-error>Comparison operations (GT, GE, LT, and LE) for the POLYGON type are not defined</expected-error>
+        <expected-error>Unsupported type: comparison operations (&gt;, &gt;=, &lt;, and &lt;=) cannot process input type polygon</expected-error>
       </compilation-unit>
     </test-case>
     <test-case FilePath="comparison">
       <compilation-unit name="issue363_inequality_rectangle">
         <output-dir compare="Text">issue363_inequality_rectangle</output-dir>
-        <expected-error>Comparison operations (GT, GE, LT, and LE) for the RECTANGLE type are not defined</expected-error>
+        <expected-error>Unsupported type: comparison operations (&gt;, &gt;=, &lt;, and &lt;=) cannot process input type rectangle</expected-error>
       </compilation-unit>
     </test-case>
     <test-case FilePath="comparison">
       <compilation-unit name="issue363_inequality_circle">
         <output-dir compare="Text">issue363_inequality_circle</output-dir>
-        <expected-error>Comparison operations (GT, GE, LT, and LE) for the CIRCLE type are not defined</expected-error>
+        <expected-error>Unsupported type: comparison operations (&gt;, &gt;=, &lt;, and &lt;=) cannot process input type circle</expected-error>
       </compilation-unit>
     </test-case>
     <test-case FilePath="comparison">
@@ -2440,7 +2440,7 @@
     <test-case FilePath="global-aggregate">
       <compilation-unit name="q06_error">
         <output-dir compare="Text">q01</output-dir>
-        <expected-error>Unsupported type: STRING</expected-error>
+        <expected-error>Type mismatch: function scan-collection 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="global-aggregate">
@@ -3171,7 +3171,7 @@
       <test-case FilePath="open-index-enforced/error-checking">
         <compilation-unit name="enforced-field-type-collision">
           <output-dir compare="Text">enforced-field-type-collision</output-dir>
-          <expected-error>A field &quot;[value]&quot; is already defined with the type &quot;STRING&quot;</expected-error>
+          <expected-error>A field &quot;[value]&quot; is already defined with the type &quot;string&quot;</expected-error>
         </compilation-unit>
       </test-case>
       <test-case FilePath="open-index-enforced/error-checking">
@@ -4640,7 +4640,7 @@
     <test-case FilePath="open-closed">
       <compilation-unit name="query-issue410">
         <output-dir compare="Text">query-issue410</output-dir>
-        <expected-error>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">
@@ -5433,7 +5433,7 @@
     <test-case FilePath="string">
       <compilation-unit name="repeat_error">
         <output-dir compare="Text">repeat</output-dir>
-        <expected-error>repeat: expects a non-negative repeating number but got -1</expected-error>
+        <expected-error>Invalid value: function asterix:repeat expects its 1 input parameter to be a non-negative value, but gets -1</expected-error>
       </compilation-unit>
     </test-case>
     <test-case FilePath="string">

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/52671a2c/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/exceptions/ErrorCode.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/exceptions/ErrorCode.java b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/exceptions/ErrorCode.java
index a56d6f6..b182e35 100644
--- a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/exceptions/ErrorCode.java
+++ b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/exceptions/ErrorCode.java
@@ -18,12 +18,91 @@
  */
 package org.apache.asterix.common.exceptions;
 
+import java.util.HashMap;
+import java.util.Map;
+
+// Error code:
+// 0 --- 999:  runtime errors
+// 1000 ---- 1999: compilation errors
+// 2000 ---- 2999: storage errors
+// 3000 ---- 3999: feed errors
+// 4000 ---- 4999: lifecycle management errors
 public class ErrorCode {
     public static final String ASTERIX = "ASX";
-    public static final int ERROR_CASTING_FIELD = 0;
-    public static final int ERROR_EXTENSION_CONFLICT = 1;
-    public static final int ERROR_PARSE_ERROR = 2;
+
+    // Extension errors
+    public static final int ERROR_EXTENSION_ID_CONFLICT = 4001;
+    public static final int ERROR_EXTENSION_COMPONENT_CONFLICT = 4002;
+
+    // Runtime errors
+    public static final int ERROR_CASTING_FIELD = 1;
+    public static final int ERROR_TYPE_MISMATCH = 2;
+    public static final int ERROR_TYPE_INCOMPATIBLE = 3;
+    public static final int ERROR_TYPE_UNSUPPORTED = 4;
+    public static final int ERROR_TYPE_ITEM = 5;
+    public static final int ERROR_INVALID_FORMAT = 6;
+    public static final int ERROR_OVERFLOW = 7;
+    public static final int ERROR_UNDERFLOW = 8;
+    public static final int ERROR_INJECTED_FAILURE = 9;
+    public static final int ERROR_NEGATIVE_VALUE = 10;
+    public static final int ERROR_OUT_OF_BOUND = 11;
+    public static final int ERROR_COERCION = 12;
+    public static final int ERROR_DUPLICATE_FIELD = 13;
+
+    // Compilation errors
+    public static final int ERROR_PARSE_ERROR = 1001;
+
+    private static final String ERROR_MESSAGE_ID_CONFLICT = "Two Extensions share the same Id: %1$s";
+    private static final String ERROR_MESSAGE_COMPONENT_CONFLICT = "Extension Conflict between %1$s and %2$s both "
+            + "extensions extend %3$s";
+    private static final String ERROR_MESSAGE_TYPE_MISMATCH = "Type mismatch: function %1$s expects"
+            + " its %2$s input parameter to be type %3$s, but the actual input type is %4$s";
+    private static final String ERROR_MESSAGE_TYPE_INCOMPATIBLE = "Type incompatibility: function %1$s gets"
+            + " incompatible input values: %2$s and %3$s";
+    private static final String ERROR_MESSAGE_TYPE_UNSUPPORTED = "Unsupported type: %1$s"
+            + " cannot process input type %2$s";
+    private static final String ERROR_MESSAGE_TYPE_ITEM = "Invalid item type: function %1$s"
+            + " cannot process item type %2$s in an input array (or multiset)";
+    public static final String ERROR_MESSAGE_INVALID_FORMAT = "Invalid format for %1$s in %2$s";
+    public static final String ERROR_MESSAGE_OVERFLOW = "Overflow happend in %1$s";
+    public static final String ERROR_MESSAGE_UNDERFLOW = "Underflow happend in %1$s";
+    public static final String ERROR_MESSAGE_INJECTED_FAILURE = "Injected failure in %1$s";
+    public static final String ERROR_MESSAGE_NEGATIVE_VALUE = "Invalid value: function %1$s expects"
+            + " its %2$s input parameter to be a non-negative value, but gets %3$s";
+    public static final String ERROR_MESSAGE_OUT_OF_BOUND = "Index out of bound in %1$s: %2$s";
+    public static final String ERROR_MESSAGE_COERCION = "Invalid implicit scalar to collection coercion in %1$s";
+    public static final String ERROR_MESSAGE_DUPLICATE_FIELD = "Get duplicate fields in %1$s";
+
+    private static Map<Integer, String> errorMessageMap = new HashMap<>();
+
+    static {
+        // compilation errors
+        errorMessageMap.put(ERROR_TYPE_MISMATCH, ERROR_MESSAGE_TYPE_MISMATCH);
+        errorMessageMap.put(ERROR_TYPE_INCOMPATIBLE, ERROR_MESSAGE_TYPE_INCOMPATIBLE);
+        errorMessageMap.put(ERROR_TYPE_ITEM, ERROR_MESSAGE_TYPE_ITEM);
+        errorMessageMap.put(ERROR_TYPE_UNSUPPORTED, ERROR_MESSAGE_TYPE_UNSUPPORTED);
+        errorMessageMap.put(ERROR_INVALID_FORMAT, ERROR_MESSAGE_INVALID_FORMAT);
+        errorMessageMap.put(ERROR_OVERFLOW, ERROR_MESSAGE_OVERFLOW);
+        errorMessageMap.put(ERROR_UNDERFLOW, ERROR_MESSAGE_UNDERFLOW);
+        errorMessageMap.put(ERROR_INJECTED_FAILURE, ERROR_MESSAGE_INJECTED_FAILURE);
+        errorMessageMap.put(ERROR_NEGATIVE_VALUE, ERROR_MESSAGE_NEGATIVE_VALUE);
+        errorMessageMap.put(ERROR_OUT_OF_BOUND, ERROR_MESSAGE_OUT_OF_BOUND);
+        errorMessageMap.put(ERROR_COERCION, ERROR_MESSAGE_COERCION);
+        errorMessageMap.put(ERROR_DUPLICATE_FIELD, ERROR_MESSAGE_DUPLICATE_FIELD);
+
+        // lifecycle management errors
+        errorMessageMap.put(ERROR_EXTENSION_ID_CONFLICT, ERROR_MESSAGE_ID_CONFLICT);
+        errorMessageMap.put(ERROR_EXTENSION_COMPONENT_CONFLICT, ERROR_MESSAGE_COMPONENT_CONFLICT);
+    }
 
     private ErrorCode() {
     }
+
+    public static String getErrorMessage(int errorCode) {
+        String msg = errorMessageMap.get(errorCode);
+        if (msg == null) {
+            throw new IllegalStateException("Undefined error code: " + errorCode);
+        }
+        return msg;
+    }
 }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/52671a2c/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/exceptions/RuntimeDataException.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/exceptions/RuntimeDataException.java b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/exceptions/RuntimeDataException.java
new file mode 100644
index 0000000..fded0d9
--- /dev/null
+++ b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/exceptions/RuntimeDataException.java
@@ -0,0 +1,36 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.asterix.common.exceptions;
+
+import java.io.Serializable;
+
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+
+public class RuntimeDataException extends HyracksDataException {
+
+    public RuntimeDataException(int errorCode, Serializable... params) {
+        super(ErrorCode.ASTERIX, errorCode, ErrorCode.getErrorMessage(errorCode), params);
+    }
+
+    public RuntimeDataException(int errorCode, Throwable cause, Serializable... params) {
+        super(ErrorCode.ASTERIX, errorCode, ErrorCode.getErrorMessage(errorCode), params);
+        addSuppressed(cause);
+    }
+}

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/52671a2c/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/library/ExternalFunction.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/library/ExternalFunction.java b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/library/ExternalFunction.java
index 789e9ba..3e47f36 100755
--- a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/library/ExternalFunction.java
+++ b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/library/ExternalFunction.java
@@ -37,6 +37,7 @@ import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
 import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
 import org.apache.hyracks.data.std.api.IPointable;
 import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
@@ -55,7 +56,7 @@ public abstract class ExternalFunction implements IExternalFunction {
     protected final JavaFunctionHelper functionHelper;
 
     public ExternalFunction(IExternalFunctionInfo finfo, IScalarEvaluatorFactory args[], IHyracksTaskContext context)
-            throws AlgebricksException {
+            throws HyracksDataException {
         this.finfo = finfo;
         this.evaluatorFactories = args;
         argumentEvaluators = new IScalarEvaluator[args.length];
@@ -85,7 +86,7 @@ public abstract class ExternalFunction implements IExternalFunction {
             externalFunctionFactory = (IFunctionFactory) clazz.newInstance();
             externalFunction = externalFunctionFactory.getExternalFunction();
         } catch (Exception e) {
-            throw new AlgebricksException(" Unable to load/instantiate class " + classname, e);
+            throw new HyracksDataException(" Unable to load/instantiate class " + classname, e);
         }
     }
 


Mime
View raw message