asterixdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From buyin...@apache.org
Subject [13/22] asterixdb git commit: Unify runtime type exceptions by using error code and message template.
Date Tue, 01 Nov 2016 03:08:22 GMT
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/52671a2c/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/AndDescriptor.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/AndDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/AndDescriptor.java
index 7150517..1aba0ef 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/AndDescriptor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/AndDescriptor.java
@@ -31,7 +31,7 @@ import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
 import org.apache.asterix.om.types.ATypeTag;
 import org.apache.asterix.om.types.BuiltinType;
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
-import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
+import org.apache.asterix.runtime.exceptions.TypeMismatchException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
@@ -58,14 +58,12 @@ public class AndDescriptor extends AbstractScalarFunctionDynamicDescriptor {
     }
 
     @Override
-    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
-            throws AlgebricksException {
-
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
         return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws AlgebricksException {
+            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws HyracksDataException {
                 final ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
                 final DataOutput out = resultStorage.getDataOutput();
                 final IPointable argPtr = new VoidPointable();
@@ -86,54 +84,54 @@ public class AndDescriptor extends AbstractScalarFunctionDynamicDescriptor {
                             .getSerializerDeserializer(BuiltinType.AMISSING);
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
-                        try {
-                            resultStorage.reset();
-                            int n = args.length;
-                            boolean res = true;
-                            boolean metNull = false;
-                            boolean metMissing = false;
-                            for (int i = 0; i < n; i++) {
-                                evals[i].evaluate(tuple, argPtr);
-                                byte[] bytes = argPtr.getByteArray();
-                                int offset = argPtr.getStartOffset();
-                                boolean isNull = false;
-                                boolean isMissing = false;
-                                if (bytes[offset] == ATypeTag.SERIALIZED_MISSING_TYPE_TAG) {
-                                    isMissing = true;
-                                    metMissing = true;
-                                }
-                                if (bytes[offset] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
-                                    isNull = true;
-                                    metNull = true;
-                                }
-                                if (isMissing || isNull) {
-                                    continue;
-                                }
-                                boolean argResult = ABooleanSerializerDeserializer.getBoolean(bytes, offset + 1);
-                                if (argResult == false) {
-                                    // anything AND FALSE = FALSE
-                                    booleanSerde.serialize(ABoolean.FALSE, out);
-                                    result.set(resultStorage);
-                                    return;
-                                }
-                                res &= argResult;
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws HyracksDataException {
+                        resultStorage.reset();
+                        int n = args.length;
+                        boolean res = true;
+                        boolean metNull = false;
+                        boolean metMissing = false;
+                        for (int i = 0; i < n; i++) {
+                            evals[i].evaluate(tuple, argPtr);
+                            byte[] bytes = argPtr.getByteArray();
+                            int offset = argPtr.getStartOffset();
+                            boolean isNull = false;
+                            boolean isMissing = false;
+                            if (bytes[offset] == ATypeTag.SERIALIZED_MISSING_TYPE_TAG) {
+                                isMissing = true;
+                                metMissing = true;
+                            }
+                            if (bytes[offset] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
+                                isNull = true;
+                                metNull = true;
+                            }
+                            if (isMissing || isNull) {
+                                continue;
                             }
-                            if (metMissing) {
-                                // MISSING AND NULL = MISSING
-                                // MISSING AND TRUE = MISSING
-                                missingSerde.serialize(AMissing.MISSING, out);
-                            } else if (metNull) {
-                                // NULL AND TRUE = NULL
-                                nullSerde.serialize(ANull.NULL, out);
-                            } else {
-                                ABoolean aResult = res ? (ABoolean.TRUE) : (ABoolean.FALSE);
-                                booleanSerde.serialize(aResult, out);
+                            if (bytes[offset] != ATypeTag.SERIALIZED_BOOLEAN_TYPE_TAG) {
+                                throw new TypeMismatchException(getIdentifier(), i, bytes[offset],
+                                        ATypeTag.SERIALIZED_BOOLEAN_TYPE_TAG);
                             }
-                            result.set(resultStorage);
-                        } catch (HyracksDataException hde) {
-                            throw new AlgebricksException(hde);
+                            boolean argResult = ABooleanSerializerDeserializer.getBoolean(bytes, offset + 1);
+                            if (argResult == false) {
+                                // anything AND FALSE = FALSE
+                                booleanSerde.serialize(ABoolean.FALSE, out);
+                                result.set(resultStorage);
+                                return;
+                            }
+                            res &= argResult;
+                        }
+                        if (metMissing) {
+                            // MISSING AND NULL = MISSING
+                            // MISSING AND TRUE = MISSING
+                            missingSerde.serialize(AMissing.MISSING, out);
+                        } else if (metNull) {
+                            // NULL AND TRUE = NULL
+                            nullSerde.serialize(ANull.NULL, out);
+                        } else {
+                            ABoolean aResult = res ? ABoolean.TRUE : ABoolean.FALSE;
+                            booleanSerde.serialize(aResult, out);
                         }
+                        result.set(resultStorage);
                     }
                 };
             }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/52671a2c/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/AnyCollectionMemberDescriptor.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/AnyCollectionMemberDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/AnyCollectionMemberDescriptor.java
index 16cec14..efb9b68 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/AnyCollectionMemberDescriptor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/AnyCollectionMemberDescriptor.java
@@ -31,11 +31,12 @@ import org.apache.asterix.om.types.ATypeTag;
 import org.apache.asterix.om.types.EnumDeserializer;
 import org.apache.asterix.om.util.NonTaggedFormatUtil;
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
-import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
+import org.apache.asterix.runtime.exceptions.TypeMismatchException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
 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.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;
@@ -75,7 +76,7 @@ public class AnyCollectionMemberDescriptor extends AbstractScalarFunctionDynamic
         }
 
         @Override
-        public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws AlgebricksException {
+        public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws HyracksDataException {
             return new IScalarEvaluator() {
 
                 private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
@@ -86,21 +87,21 @@ public class AnyCollectionMemberDescriptor extends AbstractScalarFunctionDynamic
                 private int itemLength;
 
                 @Override
-                public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+                public void evaluate(IFrameTupleReference tuple, IPointable result) throws HyracksDataException {
+
+                    resultStorage.reset();
+                    evalList.evaluate(tuple, inputArgList);
+                    byte[] serList = inputArgList.getByteArray();
+                    int offset = inputArgList.getStartOffset();
+
+                    if (serList[offset] != ATypeTag.SERIALIZED_ORDEREDLIST_TYPE_TAG
+                            && serList[offset] != ATypeTag.SERIALIZED_UNORDEREDLIST_TYPE_TAG) {
+                        throw new TypeMismatchException(AsterixBuiltinFunctions.ANY_COLLECTION_MEMBER, 0,
+                                serList[offset], ATypeTag.SERIALIZED_ORDEREDLIST_TYPE_TAG,
+                                ATypeTag.SERIALIZED_UNORDEREDLIST_TYPE_TAG);
+                    }
 
                     try {
-                        resultStorage.reset();
-                        evalList.evaluate(tuple, inputArgList);
-                        byte[] serList = inputArgList.getByteArray();
-                        int offset = inputArgList.getStartOffset();
-
-                        if (serList[offset] != ATypeTag.SERIALIZED_ORDEREDLIST_TYPE_TAG
-                                && serList[offset] != ATypeTag.SERIALIZED_UNORDEREDLIST_TYPE_TAG) {
-                            throw new AlgebricksException(AsterixBuiltinFunctions.ANY_COLLECTION_MEMBER.getName()
-                                    + ": expects input type ORDEREDLIST/UNORDEREDLIST, but got "
-                                    + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(serList[offset]));
-                        }
-
                         if (serList[offset] == ATypeTag.SERIALIZED_ORDEREDLIST_TYPE_TAG) {
                             if (AOrderedListSerializerDeserializer.getNumberOfItems(serList, offset) == 0) {
                                 out.writeByte(ATypeTag.SERIALIZED_MISSING_TYPE_TAG);
@@ -136,9 +137,9 @@ public class AnyCollectionMemberDescriptor extends AbstractScalarFunctionDynamic
                             result.set(resultStorage);
                         }
                     } catch (IOException e) {
-                        throw new AlgebricksException(e);
+                        throw new HyracksDataException(e);
                     } catch (AsterixException e) {
-                        throw new AlgebricksException(e);
+                        throw new HyracksDataException(e);
                     }
                 }
             };

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/52671a2c/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/BinaryHashMap.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/BinaryHashMap.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/BinaryHashMap.java
index 094e3cb..d89a63e 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/BinaryHashMap.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/BinaryHashMap.java
@@ -109,7 +109,6 @@ public class BinaryHashMap {
      * Retrieves value for given key. Returns null if key doesn't exist.
      *
      * @param key
-     * @param value
      * @return
      * @throws HyracksDataException
      */

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/52671a2c/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CastTypeDescriptor.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CastTypeDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CastTypeDescriptor.java
index 51b10dc..30dd7cc 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CastTypeDescriptor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CastTypeDescriptor.java
@@ -31,12 +31,12 @@ import org.apache.asterix.om.types.ATypeTag;
 import org.apache.asterix.om.types.BuiltinType;
 import org.apache.asterix.om.types.IAType;
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
-import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.common.utils.Triple;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
 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.exceptions.HyracksDataException;
 import org.apache.hyracks.data.std.api.IPointable;
 import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
@@ -86,7 +86,7 @@ public class CastTypeDescriptor extends AbstractScalarFunctionDynamicDescriptor
             private static final long serialVersionUID = 1L;
 
             @Override
-            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws AlgebricksException {
+            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws HyracksDataException {
                 return new CastTypeEvaluator(reqType, inputType, recordEvalFactory.createScalarEvaluator(ctx));
             }
         };
@@ -106,26 +106,26 @@ class CastTypeEvaluator implements IScalarEvaluator {
     private final Triple<IVisitablePointable, IAType, Boolean> arg;
 
     public CastTypeEvaluator(IAType reqType, IAType inputType, IScalarEvaluator argEvaluator)
-            throws AlgebricksException {
+            throws HyracksDataException {
         try {
             this.argEvaluator = argEvaluator;
             this.inputPointable = allocatePointable(inputType, reqType);
             this.resultPointable = allocatePointable(reqType, inputType);
             this.arg = new Triple<>(resultPointable, reqType, Boolean.FALSE);
         } catch (AsterixException e) {
-            throw new AlgebricksException(e);
+            throw new HyracksDataException(e);
         }
     }
 
     @Override
-    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+    public void evaluate(IFrameTupleReference tuple, IPointable result) throws HyracksDataException {
         try {
             argEvaluator.evaluate(tuple, argPointable);
             inputPointable.set(argPointable);
             inputPointable.accept(castVisitor, arg);
             result.set(resultPointable);
         } catch (Exception ioe) {
-            throw new AlgebricksException(ioe);
+            throw new HyracksDataException(ioe);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/52671a2c/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CheckUnknownDescriptor.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CheckUnknownDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CheckUnknownDescriptor.java
index abd0d3a..8cef39e 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CheckUnknownDescriptor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CheckUnknownDescriptor.java
@@ -24,11 +24,12 @@ 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;
-import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
+import org.apache.asterix.runtime.exceptions.UnsupportedTypeException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
 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.exceptions.HyracksDataException;
 import org.apache.hyracks.data.std.api.IPointable;
 import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
@@ -54,22 +55,20 @@ public class CheckUnknownDescriptor extends AbstractScalarFunctionDynamicDescrip
             private static final long serialVersionUID = 1L;
 
             @Override
-            public IScalarEvaluator createScalarEvaluator(final IHyracksTaskContext ctx) throws AlgebricksException {
+            public IScalarEvaluator createScalarEvaluator(final IHyracksTaskContext ctx) throws HyracksDataException {
                 return new IScalarEvaluator() {
                     private IPointable inputArg = new VoidPointable();
                     private IScalarEvaluator eval = args[0].createScalarEvaluator(ctx);
-                    private String errorMessage = AsterixBuiltinFunctions.CHECK_UNKNOWN
-                            + ": the input value cannot be NULL.";
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws HyracksDataException {
                         eval.evaluate(tuple, inputArg);
                         byte[] data = inputArg.getByteArray();
                         int offset = inputArg.getStartOffset();
 
                         if (data[offset] == ATypeTag.SERIALIZED_MISSING_TYPE_TAG
                                 || data[offset] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
-                            throw new AlgebricksException(errorMessage);
+                            throw new UnsupportedTypeException(getIdentifier(), data[offset]);
                         }
                         result.set(inputArg);
                     }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/52671a2c/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CodePointToStringDescriptor.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CodePointToStringDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CodePointToStringDescriptor.java
index 789d2c6..2831d98 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CodePointToStringDescriptor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CodePointToStringDescriptor.java
@@ -27,14 +27,15 @@ import org.apache.asterix.om.functions.AsterixBuiltinFunctions;
 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.om.types.EnumDeserializer;
 import org.apache.asterix.om.types.hierachy.ATypeHierarchy;
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
-import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
+import org.apache.asterix.runtime.exceptions.TypeMismatchException;
+import org.apache.asterix.runtime.exceptions.UnsupportedTypeException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
 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.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;
@@ -58,7 +59,7 @@ public class CodePointToStringDescriptor extends AbstractScalarFunctionDynamicDe
             private static final long serialVersionUID = 1L;
 
             @Override
-            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws AlgebricksException {
+            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws HyracksDataException {
                 return new IScalarEvaluator() {
 
                     private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
@@ -72,16 +73,16 @@ public class CodePointToStringDescriptor extends AbstractScalarFunctionDynamicDe
                     private final byte stringTypeTag = ATypeTag.SERIALIZED_STRING_TYPE_TAG;
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws HyracksDataException {
                         try {
                             resultStorage.reset();
                             evalList.evaluate(tuple, inputArgList);
                             byte[] serOrderedList = inputArgList.getByteArray();
                             int offset = inputArgList.getStartOffset();
-                            int size = 0;
+                            int size;
 
                             if (ATypeTag.VALUE_TYPE_MAPPING[serOrderedList[offset]] != ATypeTag.ORDEREDLIST) {
-                                cannotProcessException(serOrderedList[offset], serOrderedList[offset + 1]);
+                                throw new TypeMismatchException(getIdentifier().getName(), 0, serOrderedList[offset]);
                             } else {
                                 switch (ATypeTag.VALUE_TYPE_MAPPING[serOrderedList[offset + 1]]) {
                                     case INT8:
@@ -95,7 +96,7 @@ public class CodePointToStringDescriptor extends AbstractScalarFunctionDynamicDe
                                                 offset);
                                         break;
                                     default:
-                                        cannotProcessException(serOrderedList[offset], serOrderedList[offset + 1]);
+                                        throw new UnsupportedTypeException(getIdentifier(), serOrderedList[offset]);
                                 }
                             }
 
@@ -107,6 +108,7 @@ public class CodePointToStringDescriptor extends AbstractScalarFunctionDynamicDe
                                             offset, i);
                                     int codePoint = 0;
                                     codePoint = ATypeHierarchy.getIntegerValueWithDifferentTypeTagPosition(
+                                            getIdentifier().getName(), 0,
                                             serOrderedList, itemOffset, offset + 1);
                                     utf_8_len += UTF8StringUtil.codePointToUTF8(codePoint, currentUTF8);
                                 }
@@ -117,6 +119,7 @@ public class CodePointToStringDescriptor extends AbstractScalarFunctionDynamicDe
                                             offset, i);
                                     int codePoint = 0;
                                     codePoint = ATypeHierarchy.getIntegerValueWithDifferentTypeTagPosition(
+                                            getIdentifier().getName(), 0,
                                             serOrderedList, itemOffset, offset + 1);
                                     utf_8_len = UTF8StringUtil.codePointToUTF8(codePoint, currentUTF8);
                                     for (int j = 0; j < utf_8_len; j++) {
@@ -125,10 +128,10 @@ public class CodePointToStringDescriptor extends AbstractScalarFunctionDynamicDe
                                 }
                                 result.set(resultStorage);
                             } catch (AsterixException ex) {
-                                throw new AlgebricksException(ex);
+                                throw new HyracksDataException(ex);
                             }
                         } catch (IOException e1) {
-                            throw new AlgebricksException(e1.getMessage());
+                            throw new HyracksDataException(e1);
                         }
                     }
                 };
@@ -141,11 +144,4 @@ public class CodePointToStringDescriptor extends AbstractScalarFunctionDynamicDe
         return AsterixBuiltinFunctions.CODEPOINT_TO_STRING;
     }
 
-    private void cannotProcessException(byte tag1, byte tag2) throws AlgebricksException {
-        throw new AlgebricksException(AsterixBuiltinFunctions.CODEPOINT_TO_STRING.getName()
-                + ": expects input type ORDEREDLIST/[INT8|INT16|INT32|INT64|FLOAT|DOUBLE] but got "
-                + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(tag1) + "/"
-                + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(tag2));
-    }
-
 }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/52671a2c/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CountHashedGramTokensDescriptor.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CountHashedGramTokensDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CountHashedGramTokensDescriptor.java
index 7aa39bd..39e069d 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CountHashedGramTokensDescriptor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CountHashedGramTokensDescriptor.java
@@ -29,6 +29,7 @@ import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
 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.exceptions.HyracksDataException;
 import org.apache.hyracks.storage.am.lsm.invertedindex.tokenizers.HashedUTF8NGramTokenFactory;
 import org.apache.hyracks.storage.am.lsm.invertedindex.tokenizers.ITokenFactory;
 import org.apache.hyracks.storage.am.lsm.invertedindex.tokenizers.NGramUTF8StringBinaryTokenizer;
@@ -55,7 +56,7 @@ public class CountHashedGramTokensDescriptor extends AbstractScalarFunctionDynam
             private static final long serialVersionUID = 1L;
 
             @Override
-            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws AlgebricksException {
+            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws HyracksDataException {
                 ITokenFactory tokenFactory = new HashedUTF8NGramTokenFactory();
                 NGramUTF8StringBinaryTokenizer tokenizer = new NGramUTF8StringBinaryTokenizer(3, true, false, true,
                         tokenFactory);

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/52671a2c/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CountHashedWordTokensDescriptor.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CountHashedWordTokensDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CountHashedWordTokensDescriptor.java
index 8a11e48..0dbf1e7 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CountHashedWordTokensDescriptor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CountHashedWordTokensDescriptor.java
@@ -24,11 +24,11 @@ import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
 import org.apache.asterix.om.types.BuiltinType;
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.asterix.runtime.evaluators.common.WordTokensEvaluator;
-import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
 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.exceptions.HyracksDataException;
 import org.apache.hyracks.storage.am.lsm.invertedindex.tokenizers.DelimitedUTF8StringBinaryTokenizer;
 import org.apache.hyracks.storage.am.lsm.invertedindex.tokenizers.HashedUTF8WordTokenFactory;
 import org.apache.hyracks.storage.am.lsm.invertedindex.tokenizers.IBinaryTokenizer;
@@ -50,13 +50,12 @@ public class CountHashedWordTokensDescriptor extends AbstractScalarFunctionDynam
     }
 
     @Override
-    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
-            throws AlgebricksException {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
         return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws AlgebricksException {
+            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws HyracksDataException {
                 ITokenFactory tokenFactory = new HashedUTF8WordTokenFactory();
                 IBinaryTokenizer tokenizer = new DelimitedUTF8StringBinaryTokenizer(false, true, tokenFactory);
                 return new WordTokensEvaluator(args, ctx, tokenizer, BuiltinType.AINT32);

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/52671a2c/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CreateCircleDescriptor.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CreateCircleDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CreateCircleDescriptor.java
index fabbd26..989a246 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CreateCircleDescriptor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CreateCircleDescriptor.java
@@ -28,19 +28,19 @@ import org.apache.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
 import org.apache.asterix.om.base.ACircle;
 import org.apache.asterix.om.base.AMutableCircle;
 import org.apache.asterix.om.base.AMutablePoint;
+import org.apache.asterix.runtime.exceptions.TypeMismatchException;
 import org.apache.asterix.om.functions.AsterixBuiltinFunctions;
 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.om.types.BuiltinType;
-import org.apache.asterix.om.types.EnumDeserializer;
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
-import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
 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;
@@ -58,13 +58,12 @@ public class CreateCircleDescriptor extends AbstractScalarFunctionDynamicDescrip
     };
 
     @Override
-    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
-            throws AlgebricksException {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
         return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws AlgebricksException {
+            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws HyracksDataException {
                 return new IScalarEvaluator() {
 
                     private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
@@ -80,7 +79,7 @@ public class CreateCircleDescriptor extends AbstractScalarFunctionDynamicDescrip
                             .getSerializerDeserializer(BuiltinType.ACIRCLE);
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws HyracksDataException {
                         resultStorage.reset();
                         eval0.evaluate(tuple, inputArg0);
                         eval1.evaluate(tuple, inputArg1);
@@ -91,12 +90,13 @@ public class CreateCircleDescriptor extends AbstractScalarFunctionDynamicDescrip
                         int offset1 = inputArg1.getStartOffset();
 
                         // Type check: (point, double)
-                        if (bytes0[offset0] != ATypeTag.SERIALIZED_POINT_TYPE_TAG
-                                || bytes1[offset1] != ATypeTag.SERIALIZED_DOUBLE_TYPE_TAG) {
-                            throw new AlgebricksException(AsterixBuiltinFunctions.CREATE_CIRCLE.getName()
-                                    + ": expects input type (POINT, DOUBLE) but got ("
-                                    + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes0[offset0]) + ", "
-                                    + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes1[offset1]) + ")");
+                        if (bytes0[offset0] != ATypeTag.SERIALIZED_POINT_TYPE_TAG) {
+                            throw new TypeMismatchException(getIdentifier(), 0, bytes0[offset0],
+                                    ATypeTag.SERIALIZED_POINT_TYPE_TAG);
+                        }
+                        if (bytes1[offset1] != ATypeTag.SERIALIZED_DOUBLE_TYPE_TAG) {
+                            throw new TypeMismatchException(getIdentifier(), 1, bytes1[offset1],
+                                    ATypeTag.SERIALIZED_DOUBLE_TYPE_TAG);
                         }
 
                         try {
@@ -108,7 +108,7 @@ public class CreateCircleDescriptor extends AbstractScalarFunctionDynamicDescrip
                             aCircle.setValue(aPoint, ADoubleSerializerDeserializer.getDouble(bytes1, offset1 + 1));
                             circleSerde.serialize(aCircle, out);
                         } catch (IOException e1) {
-                            throw new AlgebricksException(e1);
+                            throw new HyracksDataException(e1);
                         }
                         result.set(resultStorage);
                     }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/52671a2c/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CreateLineDescriptor.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CreateLineDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CreateLineDescriptor.java
index e86dbd7..2713388 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CreateLineDescriptor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CreateLineDescriptor.java
@@ -28,19 +28,19 @@ import org.apache.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
 import org.apache.asterix.om.base.ALine;
 import org.apache.asterix.om.base.AMutableLine;
 import org.apache.asterix.om.base.AMutablePoint;
+import org.apache.asterix.runtime.exceptions.TypeMismatchException;
 import org.apache.asterix.om.functions.AsterixBuiltinFunctions;
 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.om.types.BuiltinType;
-import org.apache.asterix.om.types.EnumDeserializer;
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
-import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
 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;
@@ -58,13 +58,12 @@ public class CreateLineDescriptor extends AbstractScalarFunctionDynamicDescripto
     };
 
     @Override
-    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
-            throws AlgebricksException {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
         return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws AlgebricksException {
+            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws HyracksDataException {
                 return new IScalarEvaluator() {
 
                     private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
@@ -80,7 +79,7 @@ public class CreateLineDescriptor extends AbstractScalarFunctionDynamicDescripto
                             .getSerializerDeserializer(BuiltinType.ALINE);
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws HyracksDataException {
                         resultStorage.reset();
                         eval0.evaluate(tuple, inputArg0);
                         eval1.evaluate(tuple, inputArg1);
@@ -90,12 +89,13 @@ public class CreateLineDescriptor extends AbstractScalarFunctionDynamicDescripto
                         int offset1 = inputArg1.getStartOffset();
 
                         // type-check: (point, point)
-                        if (bytes0[offset0] != ATypeTag.SERIALIZED_POINT_TYPE_TAG
-                                || bytes1[offset1] != ATypeTag.SERIALIZED_POINT_TYPE_TAG) {
-                            throw new AlgebricksException(AsterixBuiltinFunctions.CREATE_LINE.getName()
-                                    + ": expects input type: (POINT, POINT) but got ("
-                                    + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes0[offset0]) + ", "
-                                    + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes1[offset1]) + ").");
+                        if (bytes0[offset0] != ATypeTag.SERIALIZED_POINT_TYPE_TAG) {
+                            throw new TypeMismatchException(getIdentifier(), 0, bytes0[offset0],
+                                    ATypeTag.SERIALIZED_POINT_TYPE_TAG);
+                        }
+                        if (bytes1[offset1] != ATypeTag.SERIALIZED_POINT_TYPE_TAG) {
+                            throw new TypeMismatchException(getIdentifier(), 1, bytes1[offset1],
+                                    ATypeTag.SERIALIZED_POINT_TYPE_TAG);
                         }
 
                         try {
@@ -116,7 +116,7 @@ public class CreateLineDescriptor extends AbstractScalarFunctionDynamicDescripto
                             aLine.setValue(aPoint[0], aPoint[1]);
                             lineSerde.serialize(aLine, out);
                         } catch (IOException e1) {
-                            throw new AlgebricksException(e1);
+                            throw new HyracksDataException(e1);
                         }
                         result.set(resultStorage);
                     }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/52671a2c/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CreateMBRDescriptor.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CreateMBRDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CreateMBRDescriptor.java
index a58f566..61ada60 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CreateMBRDescriptor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CreateMBRDescriptor.java
@@ -23,7 +23,6 @@ import org.apache.asterix.om.functions.IFunctionDescriptor;
 import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.asterix.runtime.evaluators.common.CreateMBREvalFactory;
-import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
 
@@ -37,7 +36,7 @@ public class CreateMBRDescriptor extends AbstractScalarFunctionDynamicDescriptor
     };
 
     @Override
-    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) throws AlgebricksException {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
         return new CreateMBREvalFactory(args[0], args[1], args[2]);
     }
 

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/52671a2c/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CreatePointDescriptor.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CreatePointDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CreatePointDescriptor.java
index 6d37152..c01bba2 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CreatePointDescriptor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CreatePointDescriptor.java
@@ -25,19 +25,19 @@ import org.apache.asterix.dataflow.data.nontagged.serde.ADoubleSerializerDeseria
 import org.apache.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
 import org.apache.asterix.om.base.AMutablePoint;
 import org.apache.asterix.om.base.APoint;
+import org.apache.asterix.runtime.exceptions.TypeMismatchException;
 import org.apache.asterix.om.functions.AsterixBuiltinFunctions;
 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.om.types.BuiltinType;
-import org.apache.asterix.om.types.EnumDeserializer;
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
-import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
 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;
@@ -53,13 +53,12 @@ public class CreatePointDescriptor extends AbstractScalarFunctionDynamicDescript
     };
 
     @Override
-    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
-            throws AlgebricksException {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
         return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws AlgebricksException {
+            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws HyracksDataException {
                 return new IScalarEvaluator() {
 
                     private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
@@ -74,7 +73,7 @@ public class CreatePointDescriptor extends AbstractScalarFunctionDynamicDescript
                             .getSerializerDeserializer(BuiltinType.APOINT);
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws HyracksDataException {
                         eval0.evaluate(tuple, inputArg0);
                         eval1.evaluate(tuple, inputArg1);
 
@@ -84,12 +83,13 @@ public class CreatePointDescriptor extends AbstractScalarFunctionDynamicDescript
                         int offset1 = inputArg1.getStartOffset();
 
                         // type-check: (double, double)
-                        if (bytes0[offset0] != ATypeTag.SERIALIZED_DOUBLE_TYPE_TAG
-                                || bytes1[offset1] != ATypeTag.SERIALIZED_DOUBLE_TYPE_TAG) {
-                            throw new AlgebricksException(AsterixBuiltinFunctions.CREATE_POINT.getName()
-                                    + ": expects input type: (DOUBLE, DOUBLE) but got ("
-                                    + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes0[offset0]) + ", "
-                                    + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes1[offset1]) + ").");
+                        if (bytes0[offset0] != ATypeTag.SERIALIZED_DOUBLE_TYPE_TAG) {
+                            throw new TypeMismatchException(getIdentifier(), 0, bytes0[offset0],
+                                    ATypeTag.SERIALIZED_DOUBLE_TYPE_TAG);
+                        }
+                        if (bytes1[offset1] != ATypeTag.SERIALIZED_DOUBLE_TYPE_TAG) {
+                            throw new TypeMismatchException(getIdentifier(), 1, bytes1[offset1],
+                                    ATypeTag.SERIALIZED_DOUBLE_TYPE_TAG);
                         }
 
                         resultStorage.reset();
@@ -98,7 +98,7 @@ public class CreatePointDescriptor extends AbstractScalarFunctionDynamicDescript
                                     ADoubleSerializerDeserializer.getDouble(bytes1, offset1 + 1));
                             pointSerde.serialize(aPoint, out);
                         } catch (IOException e1) {
-                            throw new AlgebricksException(e1);
+                            throw new HyracksDataException(e1);
                         }
                         result.set(resultStorage);
                     }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/52671a2c/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CreatePolygonDescriptor.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CreatePolygonDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CreatePolygonDescriptor.java
index 9ba0e65..c87277b 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CreatePolygonDescriptor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CreatePolygonDescriptor.java
@@ -25,21 +25,24 @@ import org.apache.asterix.common.exceptions.AsterixException;
 import org.apache.asterix.dataflow.data.nontagged.serde.ADoubleSerializerDeserializer;
 import org.apache.asterix.dataflow.data.nontagged.serde.APointSerializerDeserializer;
 import org.apache.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
+import org.apache.asterix.om.base.AMissing;
 import org.apache.asterix.om.base.ANull;
 import org.apache.asterix.om.functions.AsterixBuiltinFunctions;
 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.om.types.BuiltinType;
-import org.apache.asterix.om.types.EnumDeserializer;
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.asterix.runtime.evaluators.common.AsterixListAccessor;
-import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
+import org.apache.asterix.runtime.exceptions.InvalidDataFormatException;
+import org.apache.asterix.runtime.exceptions.TypeMismatchException;
+import org.apache.asterix.runtime.exceptions.UnsupportedItemTypeException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
 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;
@@ -62,7 +65,7 @@ public class CreatePolygonDescriptor extends AbstractScalarFunctionDynamicDescri
             private static final long serialVersionUID = 1L;
 
             @Override
-            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws AlgebricksException {
+            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws HyracksDataException {
                 return new IScalarEvaluator() {
 
                     private final AsterixListAccessor listAccessor = new AsterixListAccessor();
@@ -74,25 +77,24 @@ public class CreatePolygonDescriptor extends AbstractScalarFunctionDynamicDescri
                     @SuppressWarnings("unchecked")
                     private final ISerializerDeserializer<ANull> nullSerde = AqlSerializerDeserializerProvider.INSTANCE
                             .getSerializerDeserializer(BuiltinType.ANULL);
+                    private final ISerializerDeserializer<AMissing> missingSerde = AqlSerializerDeserializerProvider.
+                            INSTANCE.getSerializerDeserializer(BuiltinType.AMISSING);
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws HyracksDataException {
                         try {
                             resultStorage.reset();
                             evalList.evaluate(tuple, inputArgList);
                             byte[] listBytes = inputArgList.getByteArray();
                             int offset = inputArgList.getStartOffset();
 
-                            if (listBytes[offset] != ATypeTag.SERIALIZED_ORDEREDLIST_TYPE_TAG) {
-                                throw new AlgebricksException(AsterixBuiltinFunctions.CREATE_POLYGON.getName()
-                                        + ": expects input type ORDEREDLIST, but got "
-                                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(listBytes[offset]));
-                            }
-                            try {
-                                listAccessor.reset(listBytes, offset);
-                            } catch (AsterixException e) {
-                                throw new AlgebricksException(e);
+                            if (listBytes[offset] != ATypeTag.SERIALIZED_ORDEREDLIST_TYPE_TAG
+                                    && listBytes[offset] != ATypeTag.SERIALIZED_UNORDEREDLIST_TYPE_TAG) {
+                                throw new TypeMismatchException(getIdentifier(), 0, listBytes[offset],
+                                        ATypeTag.SERIALIZED_ORDEREDLIST_TYPE_TAG,
+                                        ATypeTag.SERIALIZED_UNORDEREDLIST_TYPE_TAG);
                             }
+                            listAccessor.reset(listBytes, offset);
                             try {
                                 // First check the list consists of a valid items
                                 for (int i = 0; i < listAccessor.size(); i++) {
@@ -103,17 +105,21 @@ public class CreatePolygonDescriptor extends AbstractScalarFunctionDynamicDescri
                                             nullSerde.serialize(ANull.NULL, out);
                                             return;
                                         }
-                                        throw new AlgebricksException(AsterixBuiltinFunctions.CREATE_POLYGON.getName()
-                                                + ": expects type DOUBLE/NULL for the list item but got " + itemType);
+                                        if (itemType == ATypeTag.MISSING) {
+                                            missingSerde.serialize(AMissing.MISSING, out);
+                                            return;
+                                        }
+                                        throw new UnsupportedItemTypeException(AsterixBuiltinFunctions.CREATE_POLYGON,
+                                                itemType.serialize());
                                     }
 
                                 }
                                 if (listAccessor.size() < 6) {
-                                    throw new AlgebricksException(
-                                            "A polygon instance must consists of at least 3 points");
+                                    throw new InvalidDataFormatException(getIdentifier(),
+                                            ATypeTag.SERIALIZED_POLYGON_TYPE_TAG);
                                 } else if (listAccessor.size() % 2 != 0) {
-                                    throw new AlgebricksException(
-                                            "There must be an even number of double values in the list to form a polygon");
+                                    throw new InvalidDataFormatException(getIdentifier(),
+                                            ATypeTag.SERIALIZED_POLYGON_TYPE_TAG);
                                 }
                                 out.writeByte(ATypeTag.SERIALIZED_POLYGON_TYPE_TAG);
                                 out.writeShort(listAccessor.size() / 2);
@@ -130,10 +136,10 @@ public class CreatePolygonDescriptor extends AbstractScalarFunctionDynamicDescri
                                 }
                                 result.set(resultStorage);
                             } catch (AsterixException ex) {
-                                throw new AlgebricksException(ex);
+                                throw new HyracksDataException(ex);
                             }
                         } catch (IOException e1) {
-                            throw new AlgebricksException(e1.getMessage());
+                            throw new HyracksDataException(e1);
                         }
                     }
                 };

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/52671a2c/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CreateQueryUIDDescriptor.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CreateQueryUIDDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CreateQueryUIDDescriptor.java
index a7131fb..8e49a82 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CreateQueryUIDDescriptor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CreateQueryUIDDescriptor.java
@@ -23,11 +23,11 @@ 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;
-import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
 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.exceptions.HyracksDataException;
 import org.apache.hyracks.data.std.api.IPointable;
 import org.apache.hyracks.data.std.primitive.IntegerPointable;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
@@ -47,14 +47,14 @@ public class CreateQueryUIDDescriptor extends AbstractScalarFunctionDynamicDescr
     };
 
     @Override
-    public IScalarEvaluatorFactory createEvaluatorFactory(IScalarEvaluatorFactory[] args) throws AlgebricksException {
+    public IScalarEvaluatorFactory createEvaluatorFactory(IScalarEvaluatorFactory[] args) {
         return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
             private static final int BINARY_LENGTH = 14;
             private static final int PAYLOAD_START = 2;
 
             @Override
-            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws AlgebricksException {
+            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws HyracksDataException {
                 // Format: |TypeTag | PayloadLength | Payload |
                 // TypeTag: 1 byte
                 // PayloadLength: 1 byte
@@ -70,7 +70,7 @@ public class CreateQueryUIDDescriptor extends AbstractScalarFunctionDynamicDescr
                 return new IScalarEvaluator() {
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws HyracksDataException {
                         // Increments the Unique ID value.
                         for (int i = BINARY_LENGTH - 1; i >= PAYLOAD_START; i--) {
                             if (++uidBytes[i] != 0) {

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/52671a2c/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CreateRectangleDescriptor.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CreateRectangleDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CreateRectangleDescriptor.java
index 7087453..593e71d 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CreateRectangleDescriptor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CreateRectangleDescriptor.java
@@ -28,19 +28,19 @@ import org.apache.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
 import org.apache.asterix.om.base.AMutablePoint;
 import org.apache.asterix.om.base.AMutableRectangle;
 import org.apache.asterix.om.base.ARectangle;
+import org.apache.asterix.runtime.exceptions.TypeMismatchException;
 import org.apache.asterix.om.functions.AsterixBuiltinFunctions;
 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.om.types.BuiltinType;
-import org.apache.asterix.om.types.EnumDeserializer;
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
-import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
 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;
@@ -58,13 +58,12 @@ public class CreateRectangleDescriptor extends AbstractScalarFunctionDynamicDesc
     };
 
     @Override
-    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
-            throws AlgebricksException {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
         return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws AlgebricksException {
+            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws HyracksDataException {
                 return new IScalarEvaluator() {
                     private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
                     private DataOutput out = resultStorage.getDataOutput();
@@ -80,7 +79,7 @@ public class CreateRectangleDescriptor extends AbstractScalarFunctionDynamicDesc
                             .getSerializerDeserializer(BuiltinType.ARECTANGLE);
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws HyracksDataException {
                         eval0.evaluate(tuple, inputArg0);
                         eval1.evaluate(tuple, inputArg1);
 
@@ -90,12 +89,13 @@ public class CreateRectangleDescriptor extends AbstractScalarFunctionDynamicDesc
                         int offset1 = inputArg1.getStartOffset();
 
                         resultStorage.reset();
-                        if (bytes0[offset0] != ATypeTag.SERIALIZED_POINT_TYPE_TAG
-                                || bytes1[offset1] != ATypeTag.SERIALIZED_POINT_TYPE_TAG) {
-                            throw new AlgebricksException(AsterixBuiltinFunctions.CREATE_RECTANGLE.getName()
-                                    + ": expects input type: (POINT, POINT) but got ("
-                                    + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes0[offset0]) + ", "
-                                    + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes1[offset1]) + ".");
+                        if (bytes0[offset0] != ATypeTag.SERIALIZED_POINT_TYPE_TAG) {
+                            throw new TypeMismatchException(getIdentifier(), 0, bytes0[offset0],
+                                    ATypeTag.SERIALIZED_POINT_TYPE_TAG);
+                        }
+                        if (bytes1[offset1] != ATypeTag.SERIALIZED_POINT_TYPE_TAG) {
+                            throw new TypeMismatchException(getIdentifier(), 1, bytes1[offset1],
+                                    ATypeTag.SERIALIZED_POINT_TYPE_TAG);
                         }
 
                         try {
@@ -124,7 +124,7 @@ public class CreateRectangleDescriptor extends AbstractScalarFunctionDynamicDesc
                             rectangle2DSerde.serialize(aRectangle, out);
                             result.set(resultStorage);
                         } catch (IOException e1) {
-                            throw new AlgebricksException(e1);
+                            throw new HyracksDataException(e1);
                         }
                     }
                 };

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/52671a2c/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CreateUUIDDescriptor.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CreateUUIDDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CreateUUIDDescriptor.java
index cde092d..d1c40c3 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CreateUUIDDescriptor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CreateUUIDDescriptor.java
@@ -28,7 +28,6 @@ import org.apache.asterix.om.functions.IFunctionDescriptor;
 import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
 import org.apache.asterix.om.types.BuiltinType;
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
-import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
@@ -51,7 +50,7 @@ public class CreateUUIDDescriptor extends AbstractScalarFunctionDynamicDescripto
     };
 
     @Override
-    public IScalarEvaluatorFactory createEvaluatorFactory(IScalarEvaluatorFactory[] args) throws AlgebricksException {
+    public IScalarEvaluatorFactory createEvaluatorFactory(IScalarEvaluatorFactory[] args) {
         return new IScalarEvaluatorFactory() {
 
             private static final long serialVersionUID = 1L;
@@ -61,22 +60,18 @@ public class CreateUUIDDescriptor extends AbstractScalarFunctionDynamicDescripto
                     .getSerializerDeserializer(BuiltinType.AUUID);
 
             @Override
-            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws AlgebricksException {
+            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws HyracksDataException {
                 return new IScalarEvaluator() {
                     private final ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
                     private final DataOutput output = resultStorage.getDataOutput();
                     private final AGeneratedUUID uuid = new AGeneratedUUID();
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws HyracksDataException {
                         uuid.nextUUID();
-                        try {
-                            resultStorage.reset();
-                            uuidSerDe.serialize(uuid, output);
-                            result.set(resultStorage);
-                        } catch (HyracksDataException e) {
-                            throw new AlgebricksException(e);
-                        }
+                        resultStorage.reset();
+                        uuidSerDe.serialize(uuid, output);
+                        result.set(resultStorage);
                     }
                 };
             }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/52671a2c/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/DeepEqualityDescriptor.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/DeepEqualityDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/DeepEqualityDescriptor.java
index dec8829..dcbfcf1 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/DeepEqualityDescriptor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/DeepEqualityDescriptor.java
@@ -32,12 +32,12 @@ import org.apache.asterix.om.types.BuiltinType;
 import org.apache.asterix.om.types.IAType;
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.asterix.runtime.evaluators.comparisons.DeepEqualAssessor;
-import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
 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.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
@@ -71,7 +71,7 @@ public class DeepEqualityDescriptor extends AbstractScalarFunctionDynamicDescrip
                     .getSerializerDeserializer(BuiltinType.ABOOLEAN);
 
             @Override
-            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws AlgebricksException {
+            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws HyracksDataException {
                 final ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
                 final DataOutput out = resultStorage.getDataOutput();
                 final IScalarEvaluator evalLeft = evalFactoryLeft.createScalarEvaluator(ctx);
@@ -84,7 +84,7 @@ public class DeepEqualityDescriptor extends AbstractScalarFunctionDynamicDescrip
                     private final IVisitablePointable pointableRight = allocator.allocateFieldValue(inputTypeRight);
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws HyracksDataException {
                         try {
                             evalLeft.evaluate(tuple, pointableLeft);
                             evalRight.evaluate(tuple, pointableRight);
@@ -97,7 +97,7 @@ public class DeepEqualityDescriptor extends AbstractScalarFunctionDynamicDescrip
                             boolSerde.serialize(resultBit, out);
                             result.set(resultStorage);
                         } catch (Exception ioe) {
-                            throw new AlgebricksException(ioe);
+                            throw new HyracksDataException(ioe);
                         }
                     }
                 };

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/52671a2c/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/EditDistanceCheckDescriptor.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/EditDistanceCheckDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/EditDistanceCheckDescriptor.java
index f1cc899..360d12e 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/EditDistanceCheckDescriptor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/EditDistanceCheckDescriptor.java
@@ -23,11 +23,11 @@ import org.apache.asterix.om.functions.IFunctionDescriptor;
 import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.asterix.runtime.evaluators.common.EditDistanceCheckEvaluator;
-import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
 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.exceptions.HyracksDataException;
 
 public class EditDistanceCheckDescriptor extends AbstractScalarFunctionDynamicDescriptor {
 
@@ -40,13 +40,12 @@ public class EditDistanceCheckDescriptor extends AbstractScalarFunctionDynamicDe
     };
 
     @Override
-    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
-            throws AlgebricksException {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
         return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws AlgebricksException {
+            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws HyracksDataException {
                 return new EditDistanceCheckEvaluator(args, ctx);
             }
         };

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/52671a2c/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/EditDistanceContainsDescriptor.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/EditDistanceContainsDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/EditDistanceContainsDescriptor.java
index d9ef39e..296af09 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/EditDistanceContainsDescriptor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/EditDistanceContainsDescriptor.java
@@ -23,11 +23,11 @@ import org.apache.asterix.om.functions.IFunctionDescriptor;
 import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.asterix.runtime.evaluators.common.EditDistanceContainsEvaluator;
-import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
 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.exceptions.HyracksDataException;
 
 public class EditDistanceContainsDescriptor extends AbstractScalarFunctionDynamicDescriptor {
 
@@ -40,13 +40,12 @@ public class EditDistanceContainsDescriptor extends AbstractScalarFunctionDynami
     };
 
     @Override
-    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
-            throws AlgebricksException {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
         return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws AlgebricksException {
+            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws HyracksDataException {
                 return new EditDistanceContainsEvaluator(args, ctx);
             }
         };

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/52671a2c/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/EditDistanceDescriptor.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/EditDistanceDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/EditDistanceDescriptor.java
index 88b9b31..e0f9a90 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/EditDistanceDescriptor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/EditDistanceDescriptor.java
@@ -23,11 +23,11 @@ import org.apache.asterix.om.functions.IFunctionDescriptor;
 import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.asterix.runtime.evaluators.common.EditDistanceEvaluator;
-import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
 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.exceptions.HyracksDataException;
 
 public class EditDistanceDescriptor extends AbstractScalarFunctionDynamicDescriptor {
 
@@ -40,13 +40,12 @@ public class EditDistanceDescriptor extends AbstractScalarFunctionDynamicDescrip
     };
 
     @Override
-    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
-            throws AlgebricksException {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
         return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws AlgebricksException {
+            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws HyracksDataException {
                 return new EditDistanceEvaluator(args, ctx);
             }
         };

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/52671a2c/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/EditDistanceListIsFilterableDescriptor.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/EditDistanceListIsFilterableDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/EditDistanceListIsFilterableDescriptor.java
index a4c4311..a7337a8 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/EditDistanceListIsFilterableDescriptor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/EditDistanceListIsFilterableDescriptor.java
@@ -33,7 +33,7 @@ import org.apache.asterix.om.types.BuiltinType;
 import org.apache.asterix.om.types.EnumDeserializer;
 import org.apache.asterix.om.types.hierachy.ATypeHierarchy;
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
-import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
+import org.apache.asterix.runtime.exceptions.TypeMismatchException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
@@ -65,13 +65,12 @@ public class EditDistanceListIsFilterableDescriptor extends AbstractScalarFuncti
     };
 
     @Override
-    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
-            throws AlgebricksException {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
         return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws AlgebricksException {
+            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws HyracksDataException {
                 return new EditDistanceListIsFilterableEvaluator(args, ctx);
             }
         };
@@ -97,13 +96,13 @@ public class EditDistanceListIsFilterableDescriptor extends AbstractScalarFuncti
                 .getSerializerDeserializer(BuiltinType.ABOOLEAN);
 
         public EditDistanceListIsFilterableEvaluator(IScalarEvaluatorFactory[] args, IHyracksTaskContext context)
-                throws AlgebricksException {
+                throws HyracksDataException {
             listEval = args[0].createScalarEvaluator(context);
             edThreshEval = args[1].createScalarEvaluator(context);
         }
 
         @Override
-        public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+        public void evaluate(IFrameTupleReference tuple, IPointable result) throws HyracksDataException {
             resultStorage.reset();
 
             listEval.evaluate(tuple, listPtr);
@@ -123,21 +122,16 @@ public class EditDistanceListIsFilterableDescriptor extends AbstractScalarFuncti
                     listLen = AOrderedListSerializerDeserializer.getNumberOfItems(bytes, offset);
                     break;
                 default:
-                    throw new AlgebricksException(AsterixBuiltinFunctions.EDIT_DISTANCE_LIST_IS_FILTERABLE.getName()
-                            + ": expects input type ORDEREDLIST or UNORDEREDLIST as the first argument, but got "
-                            + typeTag + ".");
+                    throw new TypeMismatchException(AsterixBuiltinFunctions.EDIT_DISTANCE_LIST_IS_FILTERABLE,
+                            0, ATypeTag.SERIALIZED_UNORDEREDLIST_TYPE_TAG,
+                            ATypeTag.SERIALIZED_ORDEREDLIST_TYPE_TAG);
             }
 
             // Check type and extract edit-distance threshold.
             bytes = edThreshPtr.getByteArray();
             offset = edThreshPtr.getStartOffset();
-            long edThresh;
-
-            try {
-                edThresh = ATypeHierarchy.getIntegerValue(bytes, offset);
-            } catch (HyracksDataException e1) {
-                throw new AlgebricksException(e1);
-            }
+            long edThresh = ATypeHierarchy.getIntegerValue(
+                    AsterixBuiltinFunctions.EDIT_DISTANCE_LIST_IS_FILTERABLE.getName(), 1, bytes, offset);
 
             // Compute result.
             long lowerBound = listLen - edThresh;
@@ -148,7 +142,7 @@ public class EditDistanceListIsFilterableDescriptor extends AbstractScalarFuncti
                     booleanSerde.serialize(ABoolean.TRUE, output);
                 }
             } catch (IOException e) {
-                throw new AlgebricksException(e);
+                throw new HyracksDataException(e);
             }
             result.set(resultStorage);
         }


Mime
View raw message