asterixdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From buyin...@apache.org
Subject [21/22] asterixdb git commit: Unify runtime type exceptions by using error code and message template.
Date Tue, 01 Nov 2016 03:08:30 GMT
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/52671a2c/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/library/ExternalFunctionProvider.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/library/ExternalFunctionProvider.java b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/library/ExternalFunctionProvider.java
index 4f5242e..b344598 100755
--- a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/library/ExternalFunctionProvider.java
+++ b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/library/ExternalFunctionProvider.java
@@ -23,17 +23,17 @@ import org.apache.asterix.external.api.IExternalScalarFunction;
 import org.apache.asterix.external.api.IFunctionHelper;
 import org.apache.asterix.om.functions.IExternalFunctionInfo;
 import org.apache.asterix.om.types.ATypeTag;
-import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 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.dataflow.common.data.accessors.IFrameTupleReference;
 
 public class ExternalFunctionProvider {
 
     public static IExternalFunction getExternalFunctionEvaluator(IExternalFunctionInfo finfo,
-            IScalarEvaluatorFactory args[], IHyracksTaskContext context) throws AlgebricksException {
+            IScalarEvaluatorFactory args[], IHyracksTaskContext context) throws HyracksDataException {
         switch (finfo.getKind()) {
             case SCALAR:
                 return new ExternalScalarFunction(finfo, args, context);
@@ -49,17 +49,17 @@ public class ExternalFunctionProvider {
 class ExternalScalarFunction extends ExternalFunction implements IExternalScalarFunction, IScalarEvaluator {
 
     public ExternalScalarFunction(IExternalFunctionInfo finfo, IScalarEvaluatorFactory args[],
-            IHyracksTaskContext context) throws AlgebricksException {
+            IHyracksTaskContext context) throws HyracksDataException {
         super(finfo, args, context);
         try {
             initialize(functionHelper);
         } catch (Exception 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 {
             setArguments(tuple);
             evaluate(functionHelper);
@@ -67,22 +67,26 @@ class ExternalScalarFunction extends ExternalFunction implements IExternalScalar
             functionHelper.reset();
         } catch (Exception e) {
             e.printStackTrace();
-            throw new AlgebricksException(e);
+            throw new HyracksDataException(e);
         }
     }
 
     @Override
-    public void evaluate(IFunctionHelper argumentProvider) throws Exception {
-        resultBuffer.reset();
-        ((IExternalScalarFunction) externalFunction).evaluate(argumentProvider);
+    public void evaluate(IFunctionHelper argumentProvider) throws HyracksDataException {
+        try {
+            resultBuffer.reset();
+            ((IExternalScalarFunction) externalFunction).evaluate(argumentProvider);
         /*
          * Make sure that if "setResult" is not called,
          * or the result object is missing we let Hyracks storage manager know
          * we want to discard a missing object
          */
-        byte byteOutput = resultBuffer.getByteArray()[0];
-        if (!argumentProvider.isValidResult() || byteOutput == ATypeTag.SERIALIZED_MISSING_TYPE_TAG) {
-            resultBuffer.getDataOutput().writeByte(ATypeTag.SERIALIZED_MISSING_TYPE_TAG);
+            byte byteOutput = resultBuffer.getByteArray()[0];
+            if (!argumentProvider.isValidResult() || byteOutput == ATypeTag.SERIALIZED_MISSING_TYPE_TAG) {
+                resultBuffer.getDataOutput().writeByte(ATypeTag.SERIALIZED_MISSING_TYPE_TAG);
+            }
+        } catch (Exception e) {
+            throw new HyracksDataException(e);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/52671a2c/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/library/ExternalScalarFunctionEvaluatorFactory.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/library/ExternalScalarFunctionEvaluatorFactory.java b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/library/ExternalScalarFunctionEvaluatorFactory.java
index 7c1ce4b..99d40c7 100755
--- a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/library/ExternalScalarFunctionEvaluatorFactory.java
+++ b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/library/ExternalScalarFunctionEvaluatorFactory.java
@@ -23,6 +23,7 @@ import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 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 ExternalScalarFunctionEvaluatorFactory implements IScalarEvaluatorFactory {
 
@@ -37,7 +38,7 @@ public class ExternalScalarFunctionEvaluatorFactory implements IScalarEvaluatorF
     }
 
     @Override
-    public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws AlgebricksException {
+    public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws HyracksDataException {
         return (ExternalScalarFunction) ExternalFunctionProvider.getExternalFunctionEvaluator(finfo, args, ctx);
     }
 

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/52671a2c/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/library/JavaFunctionHelper.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/library/JavaFunctionHelper.java b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/library/JavaFunctionHelper.java
index 50dc28e..912192d 100644
--- a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/library/JavaFunctionHelper.java
+++ b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/library/JavaFunctionHelper.java
@@ -59,7 +59,7 @@ public class JavaFunctionHelper implements IFunctionHelper {
     private boolean isValidResult = false;
 
     public JavaFunctionHelper(IExternalFunctionInfo finfo, IDataOutputProvider outputProvider)
-            throws AlgebricksException {
+            throws HyracksDataException {
         this.finfo = finfo;
         this.outputProvider = outputProvider;
         this.pointableVisitor = new JObjectPointableVisitor();

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/52671a2c/asterixdb/asterix-external-data/src/test/java/org/apache/asterix/external/classad/ClassAd.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-external-data/src/test/java/org/apache/asterix/external/classad/ClassAd.java b/asterixdb/asterix-external-data/src/test/java/org/apache/asterix/external/classad/ClassAd.java
index 4f27cd8..7ac637f 100644
--- a/asterixdb/asterix-external-data/src/test/java/org/apache/asterix/external/classad/ClassAd.java
+++ b/asterixdb/asterix-external-data/src/test/java/org/apache/asterix/external/classad/ClassAd.java
@@ -478,7 +478,7 @@ public class ClassAd extends ExprTree {
         ExprTree tree = pRef;
         // sanity checks
         if (attrName.isEmpty() || pRef == null) {
-            throw new HyracksDataException();
+            throw new HyracksDataException("Attribute name is empty");
         }
         if (tree != null) {
             CaseInsensitiveString pstrAttr = objectPool.caseInsensitiveStringPool.get();

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/52671a2c/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ACircleSerializerDeserializer.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ACircleSerializerDeserializer.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ACircleSerializerDeserializer.java
index 4460fd9..ad8375c 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ACircleSerializerDeserializer.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ACircleSerializerDeserializer.java
@@ -55,7 +55,7 @@ public class ACircleSerializerDeserializer implements ISerializerDeserializer<AC
             out.writeDouble(instance.getP().getY());
             out.writeDouble(instance.getRadius());
         } catch (IOException e) {
-            throw new HyracksDataException();
+            throw new HyracksDataException(e);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/52671a2c/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ADayTimeDurationSerializerDeserializer.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ADayTimeDurationSerializerDeserializer.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ADayTimeDurationSerializerDeserializer.java
index c2e7729..3e6bacd 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ADayTimeDurationSerializerDeserializer.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ADayTimeDurationSerializerDeserializer.java
@@ -49,7 +49,7 @@ public class ADayTimeDurationSerializerDeserializer implements ISerializerDeseri
         try {
             out.writeLong(instance.getMilliseconds());
         } catch (IOException e) {
-            throw new HyracksDataException();
+            throw new HyracksDataException(e);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/52671a2c/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ALineSerializerDeserializer.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ALineSerializerDeserializer.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ALineSerializerDeserializer.java
index aef8de0..0ffa0d0 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ALineSerializerDeserializer.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ALineSerializerDeserializer.java
@@ -56,7 +56,7 @@ public class ALineSerializerDeserializer implements ISerializerDeserializer<ALin
             out.writeDouble(instance.getP2().getX());
             out.writeDouble(instance.getP2().getY());
         } catch (IOException e) {
-            throw new HyracksDataException();
+            throw new HyracksDataException(e);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/52671a2c/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ARectangleSerializerDeserializer.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ARectangleSerializerDeserializer.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ARectangleSerializerDeserializer.java
index 7e0bf0f..b12b964 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ARectangleSerializerDeserializer.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ARectangleSerializerDeserializer.java
@@ -56,7 +56,7 @@ public class ARectangleSerializerDeserializer implements ISerializerDeserializer
             out.writeDouble(instance.getP2().getX());
             out.writeDouble(instance.getP2().getY());
         } catch (IOException e) {
-            throw new HyracksDataException();
+            throw new HyracksDataException(e);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/52671a2c/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/AYearMonthDurationSerializerDeserializer.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/AYearMonthDurationSerializerDeserializer.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/AYearMonthDurationSerializerDeserializer.java
index eb6942f..f927204 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/AYearMonthDurationSerializerDeserializer.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/AYearMonthDurationSerializerDeserializer.java
@@ -49,7 +49,7 @@ public class AYearMonthDurationSerializerDeserializer implements ISerializerDese
         try {
             out.writeInt(instance.getMonths());
         } catch (IOException e) {
-            throw new HyracksDataException();
+            throw new HyracksDataException(e);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/52671a2c/asterixdb/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlBinaryIntegerInspector.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlBinaryIntegerInspector.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlBinaryIntegerInspector.java
index 21877f5..d7b3845 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlBinaryIntegerInspector.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlBinaryIntegerInspector.java
@@ -40,6 +40,6 @@ public class AqlBinaryIntegerInspector implements IBinaryIntegerInspector {
 
     @Override
     public int getIntegerValue(byte[] bytes, int offset, int length) throws HyracksDataException {
-        return ATypeHierarchy.getIntegerValue(bytes, offset);
+        return ATypeHierarchy.getIntegerValue("integer-inspector", 0, bytes, offset);
     }
 }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/52671a2c/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/temporal/AsterixTemporalTypeParseException.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/temporal/AsterixTemporalTypeParseException.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/temporal/AsterixTemporalTypeParseException.java
index ba7dbda..78e64c9 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/temporal/AsterixTemporalTypeParseException.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/temporal/AsterixTemporalTypeParseException.java
@@ -24,14 +24,6 @@ public class AsterixTemporalTypeParseException extends HyracksDataException {
 
     private static final long serialVersionUID = 1L;
 
-    public AsterixTemporalTypeParseException() {
-        super();
-    }
-
-    public AsterixTemporalTypeParseException(Exception ex) {
-        super(ex);
-    }
-
     public AsterixTemporalTypeParseException(String msg) {
         super(msg);
     }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/52671a2c/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/functions/AsterixBuiltinFunctions.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/functions/AsterixBuiltinFunctions.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/functions/AsterixBuiltinFunctions.java
index 66581c4..29a693c 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/functions/AsterixBuiltinFunctions.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/functions/AsterixBuiltinFunctions.java
@@ -726,7 +726,7 @@ public class AsterixBuiltinFunctions {
     public static final FunctionIdentifier ADJUST_DATETIME_FOR_TIMEZONE = new FunctionIdentifier(
             FunctionConstants.ASTERIX_NS, "adjust-datetime-for-timezone", 2);
     public static final FunctionIdentifier DAY_OF_WEEK = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
-            "day-of-week");
+            "day-of-week", 1);
     public static final FunctionIdentifier PARSE_DATE = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
             "parse-date", 2);
     public static final FunctionIdentifier PARSE_TIME = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/52671a2c/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/types/ATypeTag.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/types/ATypeTag.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/types/ATypeTag.java
index 4d6a96c..ec1805f 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/types/ATypeTag.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/types/ATypeTag.java
@@ -98,6 +98,8 @@ public enum ATypeTag implements IEnumSerializer {
     public static final byte SERIALIZED_INT64_TYPE_TAG = INT64.serialize();
     public static final byte SERIALIZED_FLOAT_TYPE_TAG = FLOAT.serialize();
     public static final byte SERIALIZED_BINARY_TYPE_TAG = BINARY.serialize();
+    public static final byte SERIALIZED_UUID_TYPE_TAG = UUID.serialize();
+
     /*
      * Serialized Tags end
      */
@@ -131,4 +133,9 @@ public enum ATypeTag implements IEnumSerializer {
                 || this == ATypeTag.UNION;
     }
 
+    @Override
+    public String toString() {
+        return this.name().toLowerCase();
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/52671a2c/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/types/hierachy/ATypeHierarchy.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/types/hierachy/ATypeHierarchy.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/types/hierachy/ATypeHierarchy.java
index af4d2a2..515ea67 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/types/hierachy/ATypeHierarchy.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/types/hierachy/ATypeHierarchy.java
@@ -25,6 +25,8 @@ import java.util.HashMap;
 import java.util.Map;
 
 import org.apache.asterix.common.exceptions.AsterixException;
+import org.apache.asterix.common.exceptions.ErrorCode;
+import org.apache.asterix.common.exceptions.RuntimeDataException;
 import org.apache.asterix.om.base.ADouble;
 import org.apache.asterix.om.base.AFloat;
 import org.apache.asterix.om.base.AInt16;
@@ -181,11 +183,11 @@ public class ATypeHierarchy {
             ATypeTag targetTypeTag) throws AlgebricksException {
         ATypeTag sourceTypeTag = sourceObject.getType().getTypeTag();
         AsterixConstantValue asterixNewConstantValue = null;
-        short tmpShortValue = 0;
-        int tmpIntValue = 0;
-        long tmpLongValue = 0;
-        float tmpFloatValue = 0.0f;
-        double tmpDoubleValue = 0.0;
+        short tmpShortValue;
+        int tmpIntValue;
+        long tmpLongValue;
+        float tmpFloatValue;
+        double tmpDoubleValue;
 
         // if the constant type and target type does not match, we do a type conversion
         if (sourceTypeTag != targetTypeTag) {
@@ -645,18 +647,21 @@ public class ATypeHierarchy {
 
     }
 
+
     // Get an INT value from numeric types array. We assume the first byte contains the type tag.
-    public static int getIntegerValue(byte[] bytes, int offset) throws HyracksDataException {
-        return getIntegerValueWithDifferentTypeTagPosition(bytes, offset + 1, offset);
+    public static int getIntegerValue(String name, int argIndex, byte[] bytes, int offset) throws HyracksDataException {
+        return getIntegerValueWithDifferentTypeTagPosition(name, argIndex, bytes, offset + 1, offset);
     }
 
     // Get an INT value from numeric types array. We assume the specific location of a byte array contains the type tag.
-    public static int getIntegerValueWithDifferentTypeTagPosition(byte[] bytes, int offset, int typeTagPosition)
-            throws HyracksDataException {
-        int value = 0;
-
+    public static int getIntegerValueWithDifferentTypeTagPosition(String name, int argIndex, byte[] bytes, int offset,
+            int typeTagPosition) throws HyracksDataException {
+        int value;
         ATypeTag sourceTypeTag = ATypeTag.VALUE_TYPE_MAPPING[bytes[typeTagPosition]];
 
+        if (sourceTypeTag == null) {
+            throw new RuntimeDataException(ErrorCode.ERROR_INVALID_FORMAT, name, argIndex);
+        }
         switch (sourceTypeTag) {
             case INT64:
                 value = (int) LongPointable.getLong(bytes, offset);
@@ -677,26 +682,27 @@ public class ATypeHierarchy {
                 value = (int) DoublePointable.getDouble(bytes, offset);
                 break;
             default:
-                throw new HyracksDataException(
-                        "Type casting error while getting an INT32 value: expected INT8/16/32/64/FLOAT/DOUBLE but got "
-                                + sourceTypeTag + ".");
+                throw new RuntimeDataException(ErrorCode.ERROR_TYPE_MISMATCH, name, argIndex, sourceTypeTag,
+                        ATypeTag.INT8, ATypeTag.INT16, ATypeTag.INT32, ATypeTag.INT64, ATypeTag.FLOAT, ATypeTag.DOUBLE);
+
         }
 
         return value;
     }
 
     // Get a LONG (INT64) value from numeric types array. We assume the first byte contains the type tag.
-    public static long getLongValue(byte[] bytes, int offset) throws HyracksDataException {
-        return getLongValueWithDifferentTypeTagPosition(bytes, offset + 1, offset);
+    public static long getLongValue(String name, int argIndex, byte[] bytes, int offset) throws HyracksDataException {
+        return getLongValueWithDifferentTypeTagPosition(name, argIndex, bytes, offset + 1, offset);
     }
 
     // Get a LONG (INT64) value from numeric types array. We assume the specific location of a byte array contains the type tag.
-    public static long getLongValueWithDifferentTypeTagPosition(byte[] bytes, int offset, int typeTagPosition)
-            throws HyracksDataException {
-        long value = 0;
-
+    private static long getLongValueWithDifferentTypeTagPosition(String name, int argIndex, byte[] bytes, int offset,
+            int typeTagPosition) throws HyracksDataException {
+        long value;
         ATypeTag sourceTypeTag = ATypeTag.VALUE_TYPE_MAPPING[bytes[typeTagPosition]];
-
+        if (sourceTypeTag == null) {
+            throw new RuntimeDataException(ErrorCode.ERROR_INVALID_FORMAT, name, argIndex);
+        }
         switch (sourceTypeTag) {
             case INT64:
                 value = LongPointable.getLong(bytes, offset);
@@ -717,66 +723,28 @@ public class ATypeHierarchy {
                 value = (long) DoublePointable.getDouble(bytes, offset);
                 break;
             default:
-                throw new HyracksDataException(
-                        "Type casting error while getting an INT64 value: expected INT8/16/32/64/FLOAT/DOUBLE but got "
-                                + sourceTypeTag + ".");
-        }
-
-        return value;
-    }
-
-    // Get a FLOAT value from numeric types array. We assume the first byte contains the type tag.
-    public static float getFloatValue(byte[] bytes, int offset) throws HyracksDataException {
-        return getFloatValueWithDifferentTypeTagPosition(bytes, offset + 1, offset);
-    }
-
-    // Get a FLOAT value from numeric types array. We assume the specific location of a byte array contains the type tag.
-    public static float getFloatValueWithDifferentTypeTagPosition(byte[] bytes, int offset, int typeTagPosition)
-            throws HyracksDataException {
-        float value = 0;
-
-        ATypeTag sourceTypeTag = ATypeTag.VALUE_TYPE_MAPPING[bytes[typeTagPosition]];
-
-        switch (sourceTypeTag) {
-            case INT64:
-                value = LongPointable.getLong(bytes, offset);
-                break;
-            case INT32:
-                value = IntegerPointable.getInteger(bytes, offset);
-                break;
-            case INT8:
-                value = bytes[offset];
-                break;
-            case INT16:
-                value = ShortPointable.getShort(bytes, offset);
-                break;
-            case FLOAT:
-                value = FloatPointable.getFloat(bytes, offset);
-                break;
-            case DOUBLE:
-                value = (float) DoublePointable.getDouble(bytes, offset);
-                break;
-            default:
-                throw new HyracksDataException(
-                        "Type casting error while getting a FLOAT value: expected INT8/16/32/64/FLOAT/DOUBLE but got "
-                                + sourceTypeTag + ".");
+                throw new RuntimeDataException(ErrorCode.ERROR_TYPE_MISMATCH, name, argIndex, sourceTypeTag,
+                        ATypeTag.INT8, ATypeTag.INT16, ATypeTag.INT32, ATypeTag.INT64, ATypeTag.FLOAT, ATypeTag.DOUBLE);
         }
 
         return value;
     }
 
     // Get a DOUBLE value from numeric types array. We assume the first byte contains the type tag.
-    public static double getDoubleValue(byte[] bytes, int offset) throws HyracksDataException {
-        return getDoubleValueWithDifferentTypeTagPosition(bytes, offset + 1, offset);
+    public static double getDoubleValue(String name, int argIndex, byte[] bytes, int offset)
+            throws HyracksDataException {
+        return getDoubleValueWithDifferentTypeTagPosition(name, argIndex, bytes, offset + 1, offset);
     }
 
     // Get a DOUBLE value from numeric types array. We assume the specific location of a byte array contains the type tag.
-    public static double getDoubleValueWithDifferentTypeTagPosition(byte[] bytes, int offset, int typeTagPosition)
+    private static double getDoubleValueWithDifferentTypeTagPosition(String name, int argIndex, byte[] bytes,
+            int offset, int typeTagPosition)
             throws HyracksDataException {
-        double value = 0;
-
+        double value;
         ATypeTag sourceTypeTag = ATypeTag.VALUE_TYPE_MAPPING[bytes[typeTagPosition]];
-
+        if (sourceTypeTag == null) {
+            throw new RuntimeDataException(ErrorCode.ERROR_INVALID_FORMAT, name, argIndex);
+        }
         switch (sourceTypeTag) {
             case INT64:
                 value = LongPointable.getLong(bytes, offset);
@@ -797,9 +765,8 @@ public class ATypeHierarchy {
                 value = DoublePointable.getDouble(bytes, offset);
                 break;
             default:
-                throw new HyracksDataException(
-                        "Type casting error while getting a DOUBLE value: expected INT8/16/32/64/FLOAT/DOUBLE but got "
-                                + sourceTypeTag + ".");
+                throw new RuntimeDataException(ErrorCode.ERROR_TYPE_MISMATCH, name, argIndex, sourceTypeTag,
+                        ATypeTag.INT8, ATypeTag.INT16, ATypeTag.INT32, ATypeTag.INT64, ATypeTag.FLOAT, ATypeTag.DOUBLE);
         }
 
         return value;

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/52671a2c/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/collections/FirstElementAggregateDescriptor.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/collections/FirstElementAggregateDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/collections/FirstElementAggregateDescriptor.java
index 2a94418..1aef0eb 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/collections/FirstElementAggregateDescriptor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/collections/FirstElementAggregateDescriptor.java
@@ -21,7 +21,7 @@ package org.apache.asterix.runtime.aggregates.collections;
 import org.apache.asterix.om.functions.AsterixBuiltinFunctions;
 import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
 import org.apache.asterix.runtime.aggregates.base.AbstractAggregateFunctionDynamicDescriptor;
-import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
 import org.apache.hyracks.algebricks.runtime.base.IAggregateEvaluatorFactory;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
@@ -38,8 +38,7 @@ public class FirstElementAggregateDescriptor extends AbstractAggregateFunctionDy
     }
 
     @Override
-    public IAggregateEvaluatorFactory createAggregateEvaluatorFactory(final IScalarEvaluatorFactory[] args)
-            throws AlgebricksException {
+    public IAggregateEvaluatorFactory createAggregateEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
         return new FirstElementEvalFactory(args, false);
     }
 

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/52671a2c/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/collections/FirstElementEvalFactory.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/collections/FirstElementEvalFactory.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/collections/FirstElementEvalFactory.java
index fe3a7ec..bea8d5f 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/collections/FirstElementEvalFactory.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/collections/FirstElementEvalFactory.java
@@ -19,12 +19,12 @@
 package org.apache.asterix.runtime.aggregates.collections;
 
 import org.apache.asterix.om.types.ATypeTag;
-import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.runtime.base.IAggregateEvaluator;
 import org.apache.hyracks.algebricks.runtime.base.IAggregateEvaluatorFactory;
 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;
@@ -42,8 +42,7 @@ class FirstElementEvalFactory implements IAggregateEvaluatorFactory {
     }
 
     @Override
-    public IAggregateEvaluator createAggregateEvaluator(final IHyracksTaskContext ctx) throws AlgebricksException {
-
+    public IAggregateEvaluator createAggregateEvaluator(final IHyracksTaskContext ctx) throws HyracksDataException {
         return new IAggregateEvaluator() {
 
             private boolean first = true;
@@ -56,18 +55,18 @@ class FirstElementEvalFactory implements IAggregateEvaluatorFactory {
             private final byte[] systemNullBytes = new byte[] { ATypeTag.SERIALIZED_SYSTEM_NULL_TYPE_TAG };
 
             @Override
-            public void init() throws AlgebricksException {
+            public void init() throws HyracksDataException {
                 first = true;
             }
 
             @Override
-            public void step(IFrameTupleReference tuple) throws AlgebricksException {
+            public void step(IFrameTupleReference tuple) throws HyracksDataException {
                 if (!first) {
                     return;
                 }
                 eval.evaluate(tuple, inputVal);
                 byte typeTagByte = inputVal.getByteArray()[inputVal.getStartOffset()];
-                if(typeTagByte == ATypeTag.SERIALIZED_SYSTEM_NULL_TYPE_TAG){
+                if (typeTagByte == ATypeTag.SERIALIZED_SYSTEM_NULL_TYPE_TAG) {
                     // Ignores SYSTEM_NULLs generated by local-first-element.
                     return;
                 }
@@ -76,7 +75,7 @@ class FirstElementEvalFactory implements IAggregateEvaluatorFactory {
             }
 
             @Override
-            public void finish(IPointable result) throws AlgebricksException {
+            public void finish(IPointable result) throws HyracksDataException {
                 if (first) {
                     result.set(isLocal ? systemNullBytes : nullBytes, 0, 1);
                     return;
@@ -85,7 +84,7 @@ class FirstElementEvalFactory implements IAggregateEvaluatorFactory {
             }
 
             @Override
-            public void finishPartial(IPointable result) throws AlgebricksException {
+            public void finishPartial(IPointable result) throws HyracksDataException {
                 finish(result);
             }
 

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/52671a2c/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/collections/ListifyAggregateDescriptor.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/collections/ListifyAggregateDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/collections/ListifyAggregateDescriptor.java
index aeb10a7..21d07b0 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/collections/ListifyAggregateDescriptor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/collections/ListifyAggregateDescriptor.java
@@ -23,7 +23,7 @@ import org.apache.asterix.om.functions.IFunctionDescriptor;
 import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
 import org.apache.asterix.om.types.AOrderedListType;
 import org.apache.asterix.runtime.aggregates.base.AbstractAggregateFunctionDynamicDescriptor;
-import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
 import org.apache.hyracks.algebricks.runtime.base.IAggregateEvaluatorFactory;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
@@ -50,8 +50,7 @@ public class ListifyAggregateDescriptor extends AbstractAggregateFunctionDynamic
     }
 
     @Override
-    public IAggregateEvaluatorFactory createAggregateEvaluatorFactory(final IScalarEvaluatorFactory[] args)
-            throws AlgebricksException {
+    public IAggregateEvaluatorFactory createAggregateEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
         return new ListifyAggregateFunctionEvalFactory(args, oltype);
     }
 

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/52671a2c/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/collections/ListifyAggregateFunctionEvalFactory.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/collections/ListifyAggregateFunctionEvalFactory.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/collections/ListifyAggregateFunctionEvalFactory.java
index 6a12423..1f1d408 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/collections/ListifyAggregateFunctionEvalFactory.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/collections/ListifyAggregateFunctionEvalFactory.java
@@ -22,12 +22,12 @@ import java.io.IOException;
 
 import org.apache.asterix.builders.OrderedListBuilder;
 import org.apache.asterix.om.types.AOrderedListType;
-import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.runtime.base.IAggregateEvaluator;
 import org.apache.hyracks.algebricks.runtime.base.IAggregateEvaluatorFactory;
 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;
@@ -45,8 +45,7 @@ public class ListifyAggregateFunctionEvalFactory implements IAggregateEvaluatorF
     }
 
     @Override
-    public IAggregateEvaluator createAggregateEvaluator(final IHyracksTaskContext ctx) throws AlgebricksException {
-
+    public IAggregateEvaluator createAggregateEvaluator(final IHyracksTaskContext ctx) throws HyracksDataException {
         return new IAggregateEvaluator() {
 
             private IPointable inputVal = new VoidPointable();
@@ -55,33 +54,33 @@ public class ListifyAggregateFunctionEvalFactory implements IAggregateEvaluatorF
             private OrderedListBuilder builder = new OrderedListBuilder();
 
             @Override
-            public void init() throws AlgebricksException {
+            public void init() throws HyracksDataException {
                 builder.reset(orderedlistType);
             }
 
             @Override
-            public void step(IFrameTupleReference tuple) throws AlgebricksException {
+            public void step(IFrameTupleReference tuple) throws HyracksDataException {
                 try {
                     eval.evaluate(tuple, inputVal);
                     builder.addItem(inputVal);
                 } catch (IOException e) {
-                    throw new AlgebricksException(e);
+                    throw new HyracksDataException(e);
                 }
             }
 
             @Override
-            public void finish(IPointable result) throws AlgebricksException {
+            public void finish(IPointable result) throws HyracksDataException {
                 resultStorage.reset();
                 try {
                     builder.write(resultStorage.getDataOutput(), true);
                 } catch (IOException e) {
-                    throw new AlgebricksException(e);
+                    throw new HyracksDataException(e);
                 }
                 result.set(resultStorage);
             }
 
             @Override
-            public void finishPartial(IPointable result) throws AlgebricksException {
+            public void finishPartial(IPointable result) throws HyracksDataException {
                 finish(result);
             }
 

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/52671a2c/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/collections/LocalFirstElementAggregateDescriptor.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/collections/LocalFirstElementAggregateDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/collections/LocalFirstElementAggregateDescriptor.java
index c1465d5..3070f86 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/collections/LocalFirstElementAggregateDescriptor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/collections/LocalFirstElementAggregateDescriptor.java
@@ -21,7 +21,7 @@ package org.apache.asterix.runtime.aggregates.collections;
 import org.apache.asterix.om.functions.AsterixBuiltinFunctions;
 import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
 import org.apache.asterix.runtime.aggregates.base.AbstractAggregateFunctionDynamicDescriptor;
-import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
 import org.apache.hyracks.algebricks.runtime.base.IAggregateEvaluatorFactory;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
@@ -37,8 +37,7 @@ public class LocalFirstElementAggregateDescriptor extends AbstractAggregateFunct
     }
 
     @Override
-    public IAggregateEvaluatorFactory createAggregateEvaluatorFactory(final IScalarEvaluatorFactory[] args)
-            throws AlgebricksException {
+    public IAggregateEvaluatorFactory createAggregateEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
         return new FirstElementEvalFactory(args, true);
     }
 

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/52671a2c/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/scalar/AbstractScalarAggregateDescriptor.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/scalar/AbstractScalarAggregateDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/scalar/AbstractScalarAggregateDescriptor.java
index eed79ac..e6c6398 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/scalar/AbstractScalarAggregateDescriptor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/scalar/AbstractScalarAggregateDescriptor.java
@@ -32,6 +32,7 @@ import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
 import org.apache.hyracks.algebricks.runtime.evaluators.ColumnAccessEvalFactory;
 import org.apache.hyracks.api.context.IHyracksTaskContext;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
 
 public abstract class AbstractScalarAggregateDescriptor extends AbstractScalarFunctionDynamicDescriptor {
     private static final long serialVersionUID = 1L;
@@ -39,7 +40,6 @@ public abstract class AbstractScalarAggregateDescriptor extends AbstractScalarFu
     @Override
     public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
             throws AlgebricksException {
-
         // The aggregate function will get a SingleFieldFrameTupleReference that points to the result of the ScanCollection.
         // The list-item will always reside in the first field (column) of the SingleFieldFrameTupleReference.
         IScalarEvaluatorFactory[] aggFuncArgs = new IScalarEvaluatorFactory[1];
@@ -55,7 +55,7 @@ public abstract class AbstractScalarAggregateDescriptor extends AbstractScalarFu
             private static final long serialVersionUID = 1L;
 
             @Override
-            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws AlgebricksException {
+            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws HyracksDataException {
                 // Use ScanCollection to iterate over list items.
                 ScanCollectionUnnestingFunctionFactory scanCollectionFactory = new ScanCollectionUnnestingFunctionFactory(
                         args[0]);

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/52671a2c/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/scalar/GenericScalarAggregateFunction.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/scalar/GenericScalarAggregateFunction.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/scalar/GenericScalarAggregateFunction.java
index 8e14473..9cec06d 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/scalar/GenericScalarAggregateFunction.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/scalar/GenericScalarAggregateFunction.java
@@ -19,12 +19,12 @@
 package org.apache.asterix.runtime.aggregates.scalar;
 
 import org.apache.asterix.runtime.aggregates.base.SingleFieldFrameTupleReference;
-import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.runtime.base.IAggregateEvaluator;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
 import org.apache.hyracks.algebricks.runtime.base.IUnnestingEvaluator;
 import org.apache.hyracks.algebricks.runtime.base.IUnnestingEvaluatorFactory;
 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;
@@ -42,13 +42,13 @@ public class GenericScalarAggregateFunction implements IScalarEvaluator {
     private final SingleFieldFrameTupleReference itemTuple = new SingleFieldFrameTupleReference();
 
     public GenericScalarAggregateFunction(IAggregateEvaluator aggFunc, IUnnestingEvaluatorFactory scanCollectionFactory,
-            IHyracksTaskContext context) throws AlgebricksException {
+            IHyracksTaskContext context) throws HyracksDataException {
         this.aggFunc = aggFunc;
         this.scanCollection = scanCollectionFactory.createUnnestingEvaluator(context);
     }
 
     @Override
-    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+    public void evaluate(IFrameTupleReference tuple, IPointable result) throws HyracksDataException {
         scanCollection.init(tuple);
         aggFunc.init();
         while (scanCollection.step(listItemOut)) {

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/52671a2c/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/AbstractSerializableAvgAggregateFunction.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/AbstractSerializableAvgAggregateFunction.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/AbstractSerializableAvgAggregateFunction.java
index 41a2d3f..6d20cca 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/AbstractSerializableAvgAggregateFunction.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/AbstractSerializableAvgAggregateFunction.java
@@ -36,6 +36,7 @@ import org.apache.asterix.om.base.AInt64;
 import org.apache.asterix.om.base.AMutableDouble;
 import org.apache.asterix.om.base.AMutableInt64;
 import org.apache.asterix.om.base.ANull;
+import org.apache.asterix.om.functions.AsterixBuiltinFunctions;
 import org.apache.asterix.om.types.ARecordType;
 import org.apache.asterix.om.types.ATypeTag;
 import org.apache.asterix.om.types.BuiltinType;
@@ -44,13 +45,14 @@ import org.apache.asterix.om.types.IAType;
 import org.apache.asterix.om.types.hierachy.ATypeHierarchy;
 import org.apache.asterix.runtime.evaluators.common.AccessibleByteArrayEval;
 import org.apache.asterix.runtime.evaluators.common.ClosedRecordConstructorEvalFactory.ClosedRecordConstructorEval;
-import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
-import org.apache.hyracks.algebricks.common.exceptions.NotImplementedException;
+import org.apache.asterix.runtime.exceptions.IncompatibleTypeException;
+import org.apache.asterix.runtime.exceptions.UnsupportedItemTypeException;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
 import org.apache.hyracks.algebricks.runtime.base.ISerializedAggregateEvaluator;
 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.ByteArrayAccessibleOutputStream;
@@ -89,34 +91,34 @@ public abstract class AbstractSerializableAvgAggregateFunction implements ISeria
             .getSerializerDeserializer(BuiltinType.ANULL);
 
     public AbstractSerializableAvgAggregateFunction(IScalarEvaluatorFactory[] args, IHyracksTaskContext context)
-            throws AlgebricksException {
+            throws HyracksDataException {
         eval = args[0].createScalarEvaluator(context);
     }
 
     @Override
-    public void init(DataOutput state) throws AlgebricksException {
+    public void init(DataOutput state) throws HyracksDataException {
         try {
             state.writeDouble(0.0);
             state.writeLong(0);
             state.writeByte(ATypeTag.SERIALIZED_SYSTEM_NULL_TYPE_TAG);
         } catch (IOException e) {
-            throw new AlgebricksException(e);
+            throw new HyracksDataException(e);
         }
     }
 
     @Override
-    public abstract void step(IFrameTupleReference tuple, byte[] state, int start, int len) throws AlgebricksException;
+    public abstract void step(IFrameTupleReference tuple, byte[] state, int start, int len) throws HyracksDataException;
 
     @Override
-    public abstract void finish(byte[] state, int start, int len, DataOutput result) throws AlgebricksException;
+    public abstract void finish(byte[] state, int start, int len, DataOutput result) throws HyracksDataException;
 
     @Override
-    public abstract void finishPartial(byte[] state, int start, int len, DataOutput result) throws AlgebricksException;
+    public abstract void finishPartial(byte[] state, int start, int len, DataOutput result) throws HyracksDataException;
 
     protected abstract void processNull(byte[] state, int start);
 
     protected void processDataValues(IFrameTupleReference tuple, byte[] state, int start, int len)
-            throws AlgebricksException {
+            throws HyracksDataException {
         if (skipStep(state, start)) {
             return;
         }
@@ -134,8 +136,7 @@ public abstract class AbstractSerializableAvgAggregateFunction implements ISeria
         } else if (aggType == ATypeTag.SYSTEM_NULL) {
             aggType = typeTag;
         } else if (typeTag != ATypeTag.SYSTEM_NULL && !ATypeHierarchy.isCompatible(typeTag, aggType)) {
-            throw new AlgebricksException(
-                    "Unexpected type " + typeTag + " in aggregation input stream. Expected type " + aggType + ".");
+            throw new IncompatibleTypeException(AsterixBuiltinFunctions.AVG, bytes[offset], aggType.serialize());
         } else if (ATypeHierarchy.canPromote(aggType, typeTag)) {
             aggType = typeTag;
         }
@@ -171,9 +172,8 @@ public abstract class AbstractSerializableAvgAggregateFunction implements ISeria
                 sum += val;
                 break;
             }
-            default: {
-                throw new NotImplementedException("Cannot compute AVG for values of type " + typeTag);
-            }
+            default:
+                throw new UnsupportedItemTypeException(AsterixBuiltinFunctions.AVG, bytes[offset]);
         }
         BufferSerDeUtil.writeDouble(sum, state, start + SUM_OFFSET);
         BufferSerDeUtil.writeLong(count, state, start + COUNT_OFFSET);
@@ -181,7 +181,7 @@ public abstract class AbstractSerializableAvgAggregateFunction implements ISeria
     }
 
     protected void finishPartialResults(byte[] state, int start, int len, DataOutput result)
-            throws AlgebricksException {
+            throws HyracksDataException {
         double sum = BufferSerDeUtil.getDouble(state, start + SUM_OFFSET);
         long count = BufferSerDeUtil.getLong(state, start + COUNT_OFFSET);
         ATypeTag aggType = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(state[start + AGG_TYPE_OFFSET]);
@@ -210,19 +210,17 @@ public abstract class AbstractSerializableAvgAggregateFunction implements ISeria
                 result.write(avgBytes.getByteArray(), avgBytes.getStartOffset(), avgBytes.getLength());
             }
         } catch (IOException e) {
-            throw new AlgebricksException(e);
+            throw new HyracksDataException(e);
         }
     }
 
     protected void processPartialResults(IFrameTupleReference tuple, byte[] state, int start, int len)
-            throws AlgebricksException {
+            throws HyracksDataException {
         if (skipStep(state, start)) {
             return;
         }
         double sum = BufferSerDeUtil.getDouble(state, start + SUM_OFFSET);
         long count = BufferSerDeUtil.getLong(state, start + COUNT_OFFSET);
-        ATypeTag aggType = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(state[start + AGG_TYPE_OFFSET]);
-
         eval.evaluate(tuple, inputVal);
         byte[] serBytes = inputVal.getByteArray();
         int offset = inputVal.getStartOffset();
@@ -239,7 +237,7 @@ public abstract class AbstractSerializableAvgAggregateFunction implements ISeria
             }
             case RECORD: {
                 // Expected.
-                aggType = ATypeTag.DOUBLE;
+                ATypeTag aggType = ATypeTag.DOUBLE;
                 int nullBitmapSize = 0;
                 int offset1 = ARecordSerializerDeserializer.getFieldOffsetById(serBytes, offset, SUM_FIELD_ID,
                         nullBitmapSize, false);
@@ -253,14 +251,12 @@ public abstract class AbstractSerializableAvgAggregateFunction implements ISeria
                 state[start + AGG_TYPE_OFFSET] = aggType.serialize();
                 break;
             }
-            default: {
-                throw new AlgebricksException("Global-Avg is not defined for values of type "
-                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(serBytes[offset]));
-            }
+            default:
+                throw new UnsupportedItemTypeException(AsterixBuiltinFunctions.AVG, serBytes[offset]);
         }
     }
 
-    protected void finishFinalResults(byte[] state, int start, int len, DataOutput result) throws AlgebricksException {
+    protected void finishFinalResults(byte[] state, int start, int len, DataOutput result) throws HyracksDataException {
         double sum = BufferSerDeUtil.getDouble(state, start + SUM_OFFSET);
         long count = BufferSerDeUtil.getLong(state, start + COUNT_OFFSET);
         ATypeTag aggType = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(state[start + AGG_TYPE_OFFSET]);
@@ -272,7 +268,7 @@ public abstract class AbstractSerializableAvgAggregateFunction implements ISeria
                 doubleSerde.serialize(aDouble, result);
             }
         } catch (IOException 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/aggregates/serializable/std/AbstractSerializableCountAggregateFunction.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/AbstractSerializableCountAggregateFunction.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/AbstractSerializableCountAggregateFunction.java
index d11997c..cca0d43 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/AbstractSerializableCountAggregateFunction.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/AbstractSerializableCountAggregateFunction.java
@@ -28,7 +28,7 @@ import org.apache.asterix.om.base.ANull;
 import org.apache.asterix.om.types.ATypeTag;
 import org.apache.asterix.om.types.BuiltinType;
 import org.apache.asterix.om.types.EnumDeserializer;
-import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
 import org.apache.hyracks.algebricks.runtime.base.ISerializedAggregateEvaluator;
@@ -56,22 +56,22 @@ public abstract class AbstractSerializableCountAggregateFunction implements ISer
     private IScalarEvaluator eval;
 
     public AbstractSerializableCountAggregateFunction(IScalarEvaluatorFactory[] args, IHyracksTaskContext context)
-            throws AlgebricksException {
+            throws HyracksDataException {
         eval = args[0].createScalarEvaluator(context);
     }
 
     @Override
-    public void init(DataOutput state) throws AlgebricksException {
+    public void init(DataOutput state) throws HyracksDataException {
         try {
             state.writeBoolean(false);
             state.writeLong(0);
         } catch (IOException e) {
-            throw new AlgebricksException(e);
+            throw new HyracksDataException(e);
         }
     }
 
     @Override
-    public void step(IFrameTupleReference tuple, byte[] state, int start, int len) throws AlgebricksException {
+    public void step(IFrameTupleReference tuple, byte[] state, int start, int len) throws HyracksDataException {
         boolean metNull = BufferSerDeUtil.getBoolean(state, start);
         long cnt = BufferSerDeUtil.getLong(state, start + 1);
         eval.evaluate(tuple, inputVal);
@@ -87,7 +87,7 @@ public abstract class AbstractSerializableCountAggregateFunction implements ISer
     }
 
     @Override
-    public void finish(byte[] state, int start, int len, DataOutput out) throws AlgebricksException {
+    public void finish(byte[] state, int start, int len, DataOutput out) throws HyracksDataException {
         boolean metNull = BufferSerDeUtil.getBoolean(state, start);
         long cnt = BufferSerDeUtil.getLong(state, start + 1);
         try {
@@ -98,12 +98,12 @@ public abstract class AbstractSerializableCountAggregateFunction implements ISer
                 int64Serde.serialize(result, out);
             }
         } catch (IOException e) {
-            throw new AlgebricksException(e);
+            throw new HyracksDataException(e);
         }
     }
 
     @Override
-    public void finishPartial(byte[] state, int start, int len, DataOutput out) throws AlgebricksException {
+    public void finishPartial(byte[] state, int start, int len, DataOutput out) throws HyracksDataException {
         finish(state, start, len, out);
     }
 

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/52671a2c/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/AbstractSerializableSumAggregateFunction.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/AbstractSerializableSumAggregateFunction.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/AbstractSerializableSumAggregateFunction.java
index d742d83..d5670a9 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/AbstractSerializableSumAggregateFunction.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/AbstractSerializableSumAggregateFunction.java
@@ -35,17 +35,19 @@ import org.apache.asterix.om.base.AMutableInt32;
 import org.apache.asterix.om.base.AMutableInt64;
 import org.apache.asterix.om.base.AMutableInt8;
 import org.apache.asterix.om.base.ANull;
+import org.apache.asterix.om.functions.AsterixBuiltinFunctions;
 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.om.types.hierachy.ATypeHierarchy;
-import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
-import org.apache.hyracks.algebricks.common.exceptions.NotImplementedException;
+import org.apache.asterix.runtime.exceptions.IncompatibleTypeException;
+import org.apache.asterix.runtime.exceptions.UnsupportedItemTypeException;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
 import org.apache.hyracks.algebricks.runtime.base.ISerializedAggregateEvaluator;
 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.dataflow.common.data.accessors.IFrameTupleReference;
@@ -66,22 +68,22 @@ public abstract class AbstractSerializableSumAggregateFunction implements ISeria
     public ISerializerDeserializer serde;
 
     public AbstractSerializableSumAggregateFunction(IScalarEvaluatorFactory[] args, IHyracksTaskContext context)
-            throws AlgebricksException {
+            throws HyracksDataException {
         eval = args[0].createScalarEvaluator(context);
     }
 
     @Override
-    public void init(DataOutput state) throws AlgebricksException {
+    public void init(DataOutput state) throws HyracksDataException {
         try {
             state.writeByte(ATypeTag.SERIALIZED_SYSTEM_NULL_TYPE_TAG);
             state.writeDouble(0.0);
         } catch (IOException e) {
-            throw new AlgebricksException(e);
+            throw new HyracksDataException(e);
         }
     }
 
     @Override
-    public void step(IFrameTupleReference tuple, byte[] state, int start, int len) throws AlgebricksException {
+    public void step(IFrameTupleReference tuple, byte[] state, int start, int len) throws HyracksDataException {
         if (skipStep(state, start)) {
             return;
         }
@@ -98,8 +100,7 @@ public abstract class AbstractSerializableSumAggregateFunction implements ISeria
         } else if (aggType == ATypeTag.SYSTEM_NULL) {
             aggType = typeTag;
         } else if (typeTag != ATypeTag.SYSTEM_NULL && !ATypeHierarchy.isCompatible(typeTag, aggType)) {
-            throw new AlgebricksException("Unexpected type " + typeTag
-                    + " in aggregation input stream. Expected type (or a promotable type to)" + aggType + ".");
+            throw new IncompatibleTypeException(AsterixBuiltinFunctions.SUM, bytes[offset], aggType.serialize());
         }
 
         if (ATypeHierarchy.canPromote(aggType, typeTag)) {
@@ -145,9 +146,8 @@ public abstract class AbstractSerializableSumAggregateFunction implements ISeria
                 processSystemNull();
                 break;
             }
-            default: {
-                throw new NotImplementedException("Cannot compute SUM for values of type " + typeTag + ".");
-            }
+            default:
+                throw new UnsupportedItemTypeException(AsterixBuiltinFunctions.SUM, bytes[offset]);
         }
         state[start + AGG_TYPE_OFFSET] = aggType.serialize();
         BufferSerDeUtil.writeDouble(sum, state, start + SUM_OFFSET);
@@ -155,7 +155,7 @@ public abstract class AbstractSerializableSumAggregateFunction implements ISeria
 
     @SuppressWarnings("unchecked")
     @Override
-    public void finish(byte[] state, int start, int len, DataOutput out) throws AlgebricksException {
+    public void finish(byte[] state, int start, int len, DataOutput out) throws HyracksDataException {
         ATypeTag aggType = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(state[start + AGG_TYPE_OFFSET]);
         double sum = BufferSerDeUtil.getDouble(state, start + SUM_OFFSET);
         try {
@@ -206,16 +206,15 @@ public abstract class AbstractSerializableSumAggregateFunction implements ISeria
                     break;
                 }
                 default:
-                    throw new AlgebricksException(
-                            "SumAggregationFunction: incompatible type for the result (" + aggType + "). ");
+                    throw new UnsupportedItemTypeException(AsterixBuiltinFunctions.SUM, aggType.serialize());
             }
         } catch (IOException e) {
-            throw new AlgebricksException(e);
+            throw new HyracksDataException(e);
         }
     }
 
     @Override
-    public void finishPartial(byte[] state, int start, int len, DataOutput out) throws AlgebricksException {
+    public void finishPartial(byte[] state, int start, int len, DataOutput out) throws HyracksDataException {
         finish(state, start, len, out);
     }
 
@@ -225,7 +224,7 @@ public abstract class AbstractSerializableSumAggregateFunction implements ISeria
 
     protected abstract void processNull(byte[] state, int start);
 
-    protected abstract void processSystemNull() throws AlgebricksException;
+    protected abstract void processSystemNull() throws HyracksDataException;
 
     protected abstract void finishSystemNull(DataOutput out) throws IOException;
 

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/52671a2c/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableAvgAggregateDescriptor.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableAvgAggregateDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableAvgAggregateDescriptor.java
index b05ff19..d1030ca 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableAvgAggregateDescriptor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableAvgAggregateDescriptor.java
@@ -23,6 +23,7 @@ import org.apache.asterix.om.functions.IFunctionDescriptor;
 import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
 import org.apache.asterix.runtime.aggregates.base.AbstractSerializableAggregateFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
 import org.apache.hyracks.algebricks.runtime.base.ISerializedAggregateEvaluator;
@@ -52,7 +53,7 @@ public class SerializableAvgAggregateDescriptor extends AbstractSerializableAggr
 
             @Override
             public ISerializedAggregateEvaluator createAggregateEvaluator(IHyracksTaskContext ctx)
-                    throws AlgebricksException {
+                    throws HyracksDataException {
                 return new SerializableAvgAggregateFunction(args, ctx);
             }
         };

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/52671a2c/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableAvgAggregateFunction.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableAvgAggregateFunction.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableAvgAggregateFunction.java
index 346fa76..4c32fe0 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableAvgAggregateFunction.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableAvgAggregateFunction.java
@@ -22,7 +22,7 @@ import java.io.DataOutput;
 
 import org.apache.asterix.om.types.ATypeTag;
 import org.apache.asterix.om.types.EnumDeserializer;
-import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
 import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
@@ -30,22 +30,22 @@ import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 public class SerializableAvgAggregateFunction extends AbstractSerializableAvgAggregateFunction {
 
     public SerializableAvgAggregateFunction(IScalarEvaluatorFactory[] args, IHyracksTaskContext context)
-            throws AlgebricksException {
+            throws HyracksDataException {
         super(args, context);
     }
 
     @Override
-    public void step(IFrameTupleReference tuple, byte[] state, int start, int len) throws AlgebricksException {
+    public void step(IFrameTupleReference tuple, byte[] state, int start, int len) throws HyracksDataException {
         processDataValues(tuple, state, start, len);
     }
 
     @Override
-    public void finish(byte[] state, int start, int len, DataOutput result) throws AlgebricksException {
+    public void finish(byte[] state, int start, int len, DataOutput result) throws HyracksDataException {
         finishFinalResults(state, start, len, result);
     }
 
     @Override
-    public void finishPartial(byte[] state, int start, int len, DataOutput result) throws AlgebricksException {
+    public void finishPartial(byte[] state, int start, int len, DataOutput result) throws HyracksDataException {
         finish(state, start, len, result);
     }
 

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/52671a2c/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableCountAggregateDescriptor.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableCountAggregateDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableCountAggregateDescriptor.java
index d60fb7f..d499523 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableCountAggregateDescriptor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableCountAggregateDescriptor.java
@@ -22,12 +22,12 @@ 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.runtime.aggregates.base.AbstractSerializableAggregateFunctionDynamicDescriptor;
-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;
 import org.apache.hyracks.algebricks.runtime.base.ISerializedAggregateEvaluator;
 import org.apache.hyracks.algebricks.runtime.base.ISerializedAggregateEvaluatorFactory;
 import org.apache.hyracks.api.context.IHyracksTaskContext;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
 
 /**
  * count(NULL) returns NULL.
@@ -49,13 +49,13 @@ public class SerializableCountAggregateDescriptor extends AbstractSerializableAg
 
     @Override
     public ISerializedAggregateEvaluatorFactory createSerializableAggregateEvaluatorFactory(
-            final IScalarEvaluatorFactory[] args) throws AlgebricksException {
+            final IScalarEvaluatorFactory[] args) {
         return new ISerializedAggregateEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
             public ISerializedAggregateEvaluator createAggregateEvaluator(IHyracksTaskContext ctx)
-                    throws AlgebricksException {
+                    throws HyracksDataException {
                 return new SerializableCountAggregateFunction(args, ctx);
             }
         };

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/52671a2c/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableCountAggregateFunction.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableCountAggregateFunction.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableCountAggregateFunction.java
index 1dd9f90..fb8d8d7 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableCountAggregateFunction.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableCountAggregateFunction.java
@@ -18,7 +18,7 @@
  */
 package org.apache.asterix.runtime.aggregates.serializable.std;
 
-import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
 import org.apache.hyracks.api.context.IHyracksTaskContext;
 
@@ -27,7 +27,7 @@ import org.apache.hyracks.api.context.IHyracksTaskContext;
  */
 public class SerializableCountAggregateFunction extends AbstractSerializableCountAggregateFunction {
     public SerializableCountAggregateFunction(IScalarEvaluatorFactory[] args, IHyracksTaskContext context)
-            throws AlgebricksException {
+            throws HyracksDataException {
         super(args, context);
     }
 }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/52671a2c/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableGlobalAvgAggregateDescriptor.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableGlobalAvgAggregateDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableGlobalAvgAggregateDescriptor.java
index 6f11b66..8ae70bb 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableGlobalAvgAggregateDescriptor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableGlobalAvgAggregateDescriptor.java
@@ -23,12 +23,12 @@ 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.runtime.aggregates.base.AbstractSerializableAggregateFunctionDynamicDescriptor;
-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;
 import org.apache.hyracks.algebricks.runtime.base.ISerializedAggregateEvaluator;
 import org.apache.hyracks.algebricks.runtime.base.ISerializedAggregateEvaluatorFactory;
 import org.apache.hyracks.api.context.IHyracksTaskContext;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
 
 public class SerializableGlobalAvgAggregateDescriptor extends AbstractSerializableAggregateFunctionDynamicDescriptor {
 
@@ -47,13 +47,13 @@ public class SerializableGlobalAvgAggregateDescriptor extends AbstractSerializab
 
     @Override
     public ISerializedAggregateEvaluatorFactory createSerializableAggregateEvaluatorFactory(
-            final IScalarEvaluatorFactory[] args) throws AlgebricksException {
+            final IScalarEvaluatorFactory[] args) {
         return new ISerializedAggregateEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
             public ISerializedAggregateEvaluator createAggregateEvaluator(IHyracksTaskContext ctx)
-                    throws AlgebricksException {
+                    throws HyracksDataException {
                 return new SerializableGlobalAvgAggregateFunction(args, ctx);
             }
         };

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/52671a2c/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableGlobalAvgAggregateFunction.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableGlobalAvgAggregateFunction.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableGlobalAvgAggregateFunction.java
index 3895911..a916355 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableGlobalAvgAggregateFunction.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableGlobalAvgAggregateFunction.java
@@ -23,7 +23,7 @@ import java.io.DataOutput;
 
 import org.apache.asterix.om.types.ATypeTag;
 import org.apache.asterix.om.types.EnumDeserializer;
-import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
 import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
@@ -31,22 +31,22 @@ import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 public class SerializableGlobalAvgAggregateFunction extends AbstractSerializableAvgAggregateFunction {
 
     public SerializableGlobalAvgAggregateFunction(IScalarEvaluatorFactory[] args, IHyracksTaskContext context)
-            throws AlgebricksException {
+            throws HyracksDataException {
         super(args, context);
     }
 
     @Override
-    public void step(IFrameTupleReference tuple, byte[] state, int start, int len) throws AlgebricksException {
+    public void step(IFrameTupleReference tuple, byte[] state, int start, int len) throws HyracksDataException {
         processPartialResults(tuple, state, start, len);
     }
 
     @Override
-    public void finish(byte[] state, int start, int len, DataOutput result) throws AlgebricksException {
+    public void finish(byte[] state, int start, int len, DataOutput result) throws HyracksDataException {
         finishFinalResults(state, start, len, result);
     }
 
     @Override
-    public void finishPartial(byte[] state, int start, int len, DataOutput result) throws AlgebricksException {
+    public void finishPartial(byte[] state, int start, int len, DataOutput result) throws HyracksDataException {
         finishPartialResults(state, start, len, result);
     }
 

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/52671a2c/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableGlobalSqlAvgAggregateDescriptor.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableGlobalSqlAvgAggregateDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableGlobalSqlAvgAggregateDescriptor.java
index b7507b1..a6c128e 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableGlobalSqlAvgAggregateDescriptor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableGlobalSqlAvgAggregateDescriptor.java
@@ -23,7 +23,7 @@ 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.runtime.aggregates.base.AbstractSerializableAggregateFunctionDynamicDescriptor;
-import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
 import org.apache.hyracks.algebricks.runtime.base.ISerializedAggregateEvaluator;
@@ -48,13 +48,13 @@ public class SerializableGlobalSqlAvgAggregateDescriptor
 
     @Override
     public ISerializedAggregateEvaluatorFactory createSerializableAggregateEvaluatorFactory(
-            final IScalarEvaluatorFactory[] args) throws AlgebricksException {
+            final IScalarEvaluatorFactory[] args) {
         return new ISerializedAggregateEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
             public ISerializedAggregateEvaluator createAggregateEvaluator(IHyracksTaskContext ctx)
-                    throws AlgebricksException {
+                    throws HyracksDataException {
                 return new SerializableGlobalSqlAvgAggregateFunction(args, ctx);
             }
         };

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/52671a2c/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableGlobalSqlAvgAggregateFunction.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableGlobalSqlAvgAggregateFunction.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableGlobalSqlAvgAggregateFunction.java
index ebd8e89..8ddccdc 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableGlobalSqlAvgAggregateFunction.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableGlobalSqlAvgAggregateFunction.java
@@ -21,7 +21,7 @@ package org.apache.asterix.runtime.aggregates.serializable.std;
 
 import java.io.DataOutput;
 
-import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
 import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
@@ -29,22 +29,22 @@ import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 public class SerializableGlobalSqlAvgAggregateFunction extends AbstractSerializableAvgAggregateFunction {
 
     public SerializableGlobalSqlAvgAggregateFunction(IScalarEvaluatorFactory[] args, IHyracksTaskContext context)
-            throws AlgebricksException {
+            throws HyracksDataException {
         super(args, context);
     }
 
     @Override
-    public void step(IFrameTupleReference tuple, byte[] state, int start, int len) throws AlgebricksException {
+    public void step(IFrameTupleReference tuple, byte[] state, int start, int len) throws HyracksDataException {
         processPartialResults(tuple, state, start, len);
     }
 
     @Override
-    public void finish(byte[] state, int start, int len, DataOutput result) throws AlgebricksException {
+    public void finish(byte[] state, int start, int len, DataOutput result) throws HyracksDataException {
         finishFinalResults(state, start, len, result);
     }
 
     @Override
-    public void finishPartial(byte[] state, int start, int len, DataOutput result) throws AlgebricksException {
+    public void finishPartial(byte[] state, int start, int len, DataOutput result) throws HyracksDataException {
         finishPartialResults(state, start, len, result);
     }
 

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/52671a2c/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableIntermediateAvgAggregateDescriptor.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableIntermediateAvgAggregateDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableIntermediateAvgAggregateDescriptor.java
index e9920e2..1214b7c 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableIntermediateAvgAggregateDescriptor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableIntermediateAvgAggregateDescriptor.java
@@ -23,12 +23,12 @@ 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.runtime.aggregates.base.AbstractSerializableAggregateFunctionDynamicDescriptor;
-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;
 import org.apache.hyracks.algebricks.runtime.base.ISerializedAggregateEvaluator;
 import org.apache.hyracks.algebricks.runtime.base.ISerializedAggregateEvaluatorFactory;
 import org.apache.hyracks.api.context.IHyracksTaskContext;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
 
 public class SerializableIntermediateAvgAggregateDescriptor
         extends AbstractSerializableAggregateFunctionDynamicDescriptor {
@@ -48,13 +48,13 @@ public class SerializableIntermediateAvgAggregateDescriptor
 
     @Override
     public ISerializedAggregateEvaluatorFactory createSerializableAggregateEvaluatorFactory(
-            final IScalarEvaluatorFactory[] args) throws AlgebricksException {
+            final IScalarEvaluatorFactory[] args) {
         return new ISerializedAggregateEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
             public ISerializedAggregateEvaluator createAggregateEvaluator(IHyracksTaskContext ctx)
-                    throws AlgebricksException {
+                    throws HyracksDataException {
                 return new SerializableIntermediateAvgAggregateFunction(args, ctx);
             }
         };


Mime
View raw message