You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@asterixdb.apache.org by bu...@apache.org on 2016/11/01 03:08:12 UTC
[03/22] asterixdb git commit: Unify runtime type exceptions by using
error code and message template.
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/52671a2c/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/PrintDateDescriptor.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/PrintDateDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/PrintDateDescriptor.java
index b979786..cec78cc 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/PrintDateDescriptor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/PrintDateDescriptor.java
@@ -23,19 +23,19 @@ import java.io.IOException;
import org.apache.asterix.dataflow.data.nontagged.serde.ADateSerializerDeserializer;
import org.apache.asterix.om.base.temporal.DateTimeFormatUtils;
-import org.apache.asterix.om.base.temporal.DateTimeFormatUtils.DateTimeParseMode;
import org.apache.asterix.om.base.temporal.GregorianCalendarSystem;
+import org.apache.asterix.om.base.temporal.DateTimeFormatUtils.DateTimeParseMode;
+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.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.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;
@@ -57,14 +57,13 @@ public class PrintDateDescriptor 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(final IHyracksTaskContext ctx) throws AlgebricksException {
+ public IScalarEvaluator createScalarEvaluator(final IHyracksTaskContext ctx) throws HyracksDataException {
return new IScalarEvaluator() {
private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
@@ -78,7 +77,7 @@ public class PrintDateDescriptor extends AbstractScalarFunctionDynamicDescriptor
private final UTF8StringWriter utf8Writer = new UTF8StringWriter();
@Override
- public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+ public void evaluate(IFrameTupleReference tuple, IPointable result) throws HyracksDataException {
resultStorage.reset();
eval0.evaluate(tuple, argPtr0);
eval1.evaluate(tuple, argPtr1);
@@ -89,14 +88,14 @@ public class PrintDateDescriptor extends AbstractScalarFunctionDynamicDescriptor
int offset1 = argPtr1.getStartOffset();
try {
- if (bytes0[offset0] != ATypeTag.SERIALIZED_DATE_TYPE_TAG
- || bytes1[offset1] != ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
- throw new AlgebricksException(getIdentifier().getName()
- + ": expects (DATE, STRING) but got ("
- + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes0[offset0]) + ", "
- + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes1[offset1]) + ")");
+ if (bytes0[offset0] != ATypeTag.SERIALIZED_DATE_TYPE_TAG) {
+ throw new TypeMismatchException(getIdentifier(), 0, bytes0[offset0],
+ ATypeTag.SERIALIZED_DATE_TYPE_TAG);
+ }
+ if (bytes1[offset1] != ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
+ throw new TypeMismatchException(getIdentifier(), 1, bytes1[offset1],
+ ATypeTag.SERIALIZED_STRING_TYPE_TAG);
}
-
long chronon = ADateSerializerDeserializer.getChronon(bytes0, offset0 + 1)
* GregorianCalendarSystem.CHRONON_OF_DAY;
int formatLength = UTF8StringUtil.getUTFLength(bytes1, offset1 + 1);
@@ -108,7 +107,7 @@ public class PrintDateDescriptor extends AbstractScalarFunctionDynamicDescriptor
out.writeByte(ATypeTag.SERIALIZED_STRING_TYPE_TAG);
utf8Writer.writeUTF8(sbder.toString(), out);
} catch (IOException ex) {
- throw new AlgebricksException(ex);
+ throw new HyracksDataException(ex);
}
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/temporal/PrintDateTimeDescriptor.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/PrintDateTimeDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/PrintDateTimeDescriptor.java
index 780d09a..cca9a93 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/PrintDateTimeDescriptor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/PrintDateTimeDescriptor.java
@@ -24,17 +24,17 @@ import java.io.IOException;
import org.apache.asterix.dataflow.data.nontagged.serde.ADateTimeSerializerDeserializer;
import org.apache.asterix.om.base.temporal.DateTimeFormatUtils;
import org.apache.asterix.om.base.temporal.DateTimeFormatUtils.DateTimeParseMode;
+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.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.exceptions.HyracksDataException;
import org.apache.hyracks.data.std.api.IPointable;
import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
import org.apache.hyracks.data.std.primitive.VoidPointable;
@@ -56,14 +56,13 @@ public class PrintDateTimeDescriptor extends AbstractScalarFunctionDynamicDescri
};
@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(final IHyracksTaskContext ctx) throws AlgebricksException {
+ public IScalarEvaluator createScalarEvaluator(final IHyracksTaskContext ctx) throws HyracksDataException {
return new IScalarEvaluator() {
private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
@@ -77,7 +76,7 @@ public class PrintDateTimeDescriptor extends AbstractScalarFunctionDynamicDescri
private UTF8StringPointable utf8Ptr = new UTF8StringPointable();
@Override
- public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+ public void evaluate(IFrameTupleReference tuple, IPointable result) throws HyracksDataException {
resultStorage.reset();
eval0.evaluate(tuple, argPtr0);
eval1.evaluate(tuple, argPtr1);
@@ -89,12 +88,13 @@ public class PrintDateTimeDescriptor extends AbstractScalarFunctionDynamicDescri
int len1 = argPtr1.getLength();
try {
- if (bytes0[offset0] != ATypeTag.SERIALIZED_DATETIME_TYPE_TAG
- || bytes1[offset1] != ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
- throw new AlgebricksException(getIdentifier().getName()
- + ": expects (DATETIME, STRING) but got ("
- + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes0[offset0]) + ", "
- + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes1[offset1]) + ")");
+ if (bytes0[offset0] != ATypeTag.SERIALIZED_DATETIME_TYPE_TAG) {
+ throw new TypeMismatchException(getIdentifier(), 0, bytes0[offset0],
+ ATypeTag.SERIALIZED_DATETIME_TYPE_TAG);
+ }
+ if (bytes1[offset1] != ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
+ throw new TypeMismatchException(getIdentifier(), 1, bytes1[offset1],
+ ATypeTag.SERIALIZED_STRING_TYPE_TAG);
}
long chronon = ADateTimeSerializerDeserializer.getChronon(bytes0, offset0 + 1);
utf8Ptr.set(bytes1, offset1 + 1, len1 - 1);
@@ -106,7 +106,7 @@ public class PrintDateTimeDescriptor extends AbstractScalarFunctionDynamicDescri
out.writeByte(ATypeTag.SERIALIZED_STRING_TYPE_TAG);
utf8Writer.writeUTF8(sbder.toString(), out);
} catch (IOException ex) {
- throw new AlgebricksException(ex);
+ throw new HyracksDataException(ex);
}
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/temporal/PrintTimeDescriptor.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/PrintTimeDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/PrintTimeDescriptor.java
index 576de35..e6201c5 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/PrintTimeDescriptor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/PrintTimeDescriptor.java
@@ -24,17 +24,17 @@ import java.io.IOException;
import org.apache.asterix.dataflow.data.nontagged.serde.ATimeSerializerDeserializer;
import org.apache.asterix.om.base.temporal.DateTimeFormatUtils;
import org.apache.asterix.om.base.temporal.DateTimeFormatUtils.DateTimeParseMode;
+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.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.exceptions.HyracksDataException;
import org.apache.hyracks.data.std.api.IPointable;
import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
import org.apache.hyracks.data.std.primitive.VoidPointable;
@@ -56,16 +56,13 @@ public class PrintTimeDescriptor 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(final IHyracksTaskContext ctx) throws AlgebricksException {
+ public IScalarEvaluator createScalarEvaluator(final IHyracksTaskContext ctx) throws HyracksDataException {
return new IScalarEvaluator() {
-
private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
private DataOutput out = resultStorage.getDataOutput();
private IPointable argPtr0 = new VoidPointable();
@@ -78,7 +75,7 @@ public class PrintTimeDescriptor extends AbstractScalarFunctionDynamicDescriptor
private final UTF8StringPointable utf8Ptr = new UTF8StringPointable();
@Override
- public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+ public void evaluate(IFrameTupleReference tuple, IPointable result) throws HyracksDataException {
resultStorage.reset();
eval0.evaluate(tuple, argPtr0);
eval1.evaluate(tuple, argPtr1);
@@ -90,12 +87,13 @@ public class PrintTimeDescriptor extends AbstractScalarFunctionDynamicDescriptor
int len1 = argPtr1.getLength();
try {
- if (bytes0[offset0] != ATypeTag.SERIALIZED_TIME_TYPE_TAG
- || bytes1[offset1] != ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
- throw new AlgebricksException(getIdentifier().getName()
- + ": expects (TIME, STRING) but got ("
- + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes0[offset0]) + ", "
- + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes1[offset1]) + ")");
+ if (bytes0[offset0] != ATypeTag.SERIALIZED_TIME_TYPE_TAG) {
+ throw new TypeMismatchException(getIdentifier(), 0, bytes0[offset0],
+ ATypeTag.SERIALIZED_TIME_TYPE_TAG);
+ }
+ if (bytes1[offset1] != ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
+ throw new TypeMismatchException(getIdentifier(), 1, bytes1[offset1],
+ ATypeTag.SERIALIZED_STRING_TYPE_TAG);
}
long chronon = ATimeSerializerDeserializer.getChronon(bytes0, offset0 + 1);
@@ -108,7 +106,7 @@ public class PrintTimeDescriptor extends AbstractScalarFunctionDynamicDescriptor
out.writeByte(ATypeTag.SERIALIZED_STRING_TYPE_TAG);
writer.writeUTF8(sbder.toString(), out);
} catch (IOException ex) {
- throw new AlgebricksException(ex);
+ throw new HyracksDataException(ex);
}
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/temporal/TimeFromDatetimeDescriptor.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/TimeFromDatetimeDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/TimeFromDatetimeDescriptor.java
index 6846ef8..b7637a6 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/TimeFromDatetimeDescriptor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/TimeFromDatetimeDescriptor.java
@@ -25,14 +25,13 @@ import org.apache.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
import org.apache.asterix.om.base.AMutableTime;
import org.apache.asterix.om.base.ATime;
import org.apache.asterix.om.base.temporal.GregorianCalendarSystem;
+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;
@@ -61,14 +60,13 @@ public class TimeFromDatetimeDescriptor extends AbstractScalarFunctionDynamicDes
* @see org.apache.asterix.runtime.base.IScalarFunctionDynamicDescriptor#createEvaluatorFactory(org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory[])
*/
@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(final IHyracksTaskContext ctx) throws AlgebricksException {
+ public IScalarEvaluator createScalarEvaluator(final IHyracksTaskContext ctx) throws HyracksDataException {
return new IScalarEvaluator() {
private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
@@ -83,29 +81,24 @@ public class TimeFromDatetimeDescriptor extends AbstractScalarFunctionDynamicDes
private AMutableTime aTime = new AMutableTime(0);
@Override
- public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+ public void evaluate(IFrameTupleReference tuple, IPointable result) throws HyracksDataException {
resultStorage.reset();
eval.evaluate(tuple, argPtr);
byte[] bytes = argPtr.getByteArray();
int offset = argPtr.getStartOffset();
- try {
- if (bytes[offset] != ATypeTag.SERIALIZED_DATETIME_TYPE_TAG) {
- throw new AlgebricksException(
- FID.getName() + ": expects input type DATETIME/NULL but got "
- + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes[offset]));
- }
- long datetimeChronon = ADateTimeSerializerDeserializer.getChronon(bytes, offset + 1);
- int timeChronon = (int) (datetimeChronon % GregorianCalendarSystem.CHRONON_OF_DAY);
- if (timeChronon < 0) {
- timeChronon += GregorianCalendarSystem.CHRONON_OF_DAY;
- }
- aTime.setValue(timeChronon);
- timeSerde.serialize(aTime, out);
- } catch (HyracksDataException hex) {
- throw new AlgebricksException(hex);
+ if (bytes[offset] != ATypeTag.SERIALIZED_DATETIME_TYPE_TAG) {
+ throw new TypeMismatchException(getIdentifier(), 0, bytes[offset],
+ ATypeTag.SERIALIZED_DATETIME_TYPE_TAG);
}
+ long datetimeChronon = ADateTimeSerializerDeserializer.getChronon(bytes, offset + 1);
+ int timeChronon = (int) (datetimeChronon % GregorianCalendarSystem.CHRONON_OF_DAY);
+ if (timeChronon < 0) {
+ timeChronon += GregorianCalendarSystem.CHRONON_OF_DAY;
+ }
+ aTime.setValue(timeChronon);
+ timeSerde.serialize(aTime, 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/temporal/TimeFromUnixTimeInMsDescriptor.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/TimeFromUnixTimeInMsDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/TimeFromUnixTimeInMsDescriptor.java
index e46241d..6420a75 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/TimeFromUnixTimeInMsDescriptor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/TimeFromUnixTimeInMsDescriptor.java
@@ -29,7 +29,6 @@ import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
import org.apache.asterix.om.types.BuiltinType;
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.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
@@ -56,14 +55,12 @@ public class TimeFromUnixTimeInMsDescriptor extends AbstractScalarFunctionDynami
* @see org.apache.asterix.runtime.base.IScalarFunctionDynamicDescriptor#createEvaluatorFactory(org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory[])
*/
@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(final IHyracksTaskContext ctx) throws AlgebricksException {
+ public IScalarEvaluator createScalarEvaluator(final IHyracksTaskContext ctx) throws HyracksDataException {
return new IScalarEvaluator() {
private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
@@ -79,16 +76,12 @@ public class TimeFromUnixTimeInMsDescriptor extends AbstractScalarFunctionDynami
private AMutableTime aTime = new AMutableTime(0);
@Override
- public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+ public void evaluate(IFrameTupleReference tuple, IPointable result) throws HyracksDataException {
resultStorage.reset();
eval.evaluate(tuple, argPtr);
- try {
- aTime.setValue(
- ATypeHierarchy.getIntegerValue(argPtr.getByteArray(), argPtr.getStartOffset()));
- timeSerde.serialize(aTime, out);
- } catch (HyracksDataException hex) {
- throw new AlgebricksException(hex);
- }
+ aTime.setValue(ATypeHierarchy.getIntegerValue(getIdentifier().getName(), 0,
+ argPtr.getByteArray(), argPtr.getStartOffset()));
+ timeSerde.serialize(aTime, 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/temporal/UnixTimeFromDateInDaysDescriptor.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/UnixTimeFromDateInDaysDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/UnixTimeFromDateInDaysDescriptor.java
index 7268302..db8161c 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/UnixTimeFromDateInDaysDescriptor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/UnixTimeFromDateInDaysDescriptor.java
@@ -24,14 +24,13 @@ import org.apache.asterix.dataflow.data.nontagged.serde.ADateSerializerDeseriali
import org.apache.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
import org.apache.asterix.om.base.AInt64;
import org.apache.asterix.om.base.AMutableInt64;
+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;
@@ -55,14 +54,13 @@ public class UnixTimeFromDateInDaysDescriptor extends AbstractScalarFunctionDyna
};
@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(final IHyracksTaskContext ctx) throws AlgebricksException {
+ public IScalarEvaluator createScalarEvaluator(final IHyracksTaskContext ctx) throws HyracksDataException {
return new IScalarEvaluator() {
private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
@@ -77,24 +75,19 @@ public class UnixTimeFromDateInDaysDescriptor extends AbstractScalarFunctionDyna
.getSerializerDeserializer(BuiltinType.AINT64);
@Override
- public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+ public void evaluate(IFrameTupleReference tuple, IPointable result) throws HyracksDataException {
resultStorage.reset();
eval.evaluate(tuple, argPtr);
byte[] bytes = argPtr.getByteArray();
int offset = argPtr.getStartOffset();
- try {
- if (bytes[offset] != ATypeTag.SERIALIZED_DATE_TYPE_TAG) {
- throw new AlgebricksException(
- getIdentifier().getName() + ": expects input type DATE/NULL but got "
- + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes[offset]));
- }
- long dateChronon = ADateSerializerDeserializer.getChronon(bytes, offset + 1);
- aInt64.setValue(dateChronon);
- int64Serde.serialize(aInt64, out);
- } catch (HyracksDataException hex) {
- throw new AlgebricksException(hex);
+ if (bytes[offset] != ATypeTag.SERIALIZED_DATE_TYPE_TAG) {
+ throw new TypeMismatchException(getIdentifier(), 0, bytes[offset],
+ ATypeTag.SERIALIZED_DATE_TYPE_TAG);
}
+ long dateChronon = ADateSerializerDeserializer.getChronon(bytes, offset + 1);
+ aInt64.setValue(dateChronon);
+ int64Serde.serialize(aInt64, 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/temporal/UnixTimeFromDatetimeInMsDescriptor.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/UnixTimeFromDatetimeInMsDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/UnixTimeFromDatetimeInMsDescriptor.java
index fe76f32..2f24861 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/UnixTimeFromDatetimeInMsDescriptor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/UnixTimeFromDatetimeInMsDescriptor.java
@@ -24,14 +24,13 @@ import org.apache.asterix.dataflow.data.nontagged.serde.ADateTimeSerializerDeser
import org.apache.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
import org.apache.asterix.om.base.AInt64;
import org.apache.asterix.om.base.AMutableInt64;
+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;
@@ -54,14 +53,12 @@ public class UnixTimeFromDatetimeInMsDescriptor extends AbstractScalarFunctionDy
};
@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(final IHyracksTaskContext ctx) throws AlgebricksException {
+ public IScalarEvaluator createScalarEvaluator(final IHyracksTaskContext ctx) throws HyracksDataException {
return new IScalarEvaluator() {
private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
@@ -76,24 +73,19 @@ public class UnixTimeFromDatetimeInMsDescriptor extends AbstractScalarFunctionDy
.getSerializerDeserializer(BuiltinType.AINT64);
@Override
- public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+ public void evaluate(IFrameTupleReference tuple, IPointable result) throws HyracksDataException {
resultStorage.reset();
eval.evaluate(tuple, argPtr);
byte[] bytes = argPtr.getByteArray();
int offset = argPtr.getStartOffset();
- try {
- if (bytes[offset] != ATypeTag.SERIALIZED_DATETIME_TYPE_TAG) {
- throw new AlgebricksException(
- getIdentifier().getName() + ": expects input type DATETIME/NULL but got "
- + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes[offset]));
- }
- long datetimeChronon = ADateTimeSerializerDeserializer.getChronon(bytes, offset + 1);
- aInt64.setValue(datetimeChronon);
- int64Serde.serialize(aInt64, out);
- } catch (HyracksDataException hex) {
- throw new AlgebricksException(hex);
+ if (bytes[offset] != ATypeTag.SERIALIZED_DATETIME_TYPE_TAG) {
+ throw new TypeMismatchException(getIdentifier(), 0, bytes[offset],
+ ATypeTag.SERIALIZED_DATETIME_TYPE_TAG);
}
+ long datetimeChronon = ADateTimeSerializerDeserializer.getChronon(bytes, offset + 1);
+ aInt64.setValue(datetimeChronon);
+ int64Serde.serialize(aInt64, 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/temporal/UnixTimeFromDatetimeInSecsDescriptor.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/UnixTimeFromDatetimeInSecsDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/UnixTimeFromDatetimeInSecsDescriptor.java
index 162f002..3f0757b 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/UnixTimeFromDatetimeInSecsDescriptor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/UnixTimeFromDatetimeInSecsDescriptor.java
@@ -18,20 +18,21 @@
*/
package org.apache.asterix.runtime.evaluators.functions.temporal;
+import static org.apache.asterix.om.types.ATypeTag.SERIALIZED_DATETIME_TYPE_TAG;
+
import java.io.DataOutput;
import org.apache.asterix.dataflow.data.nontagged.serde.ADateTimeSerializerDeserializer;
import org.apache.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
import org.apache.asterix.om.base.AInt64;
import org.apache.asterix.om.base.AMutableInt64;
+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;
@@ -58,14 +59,12 @@ public class UnixTimeFromDatetimeInSecsDescriptor extends AbstractScalarFunction
* @see org.apache.asterix.runtime.base.IScalarFunctionDynamicDescriptor#createEvaluatorFactory(org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory[])
*/
@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(final IHyracksTaskContext ctx) throws AlgebricksException {
+ public IScalarEvaluator createScalarEvaluator(final IHyracksTaskContext ctx) throws HyracksDataException {
return new IScalarEvaluator() {
private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
@@ -80,24 +79,19 @@ public class UnixTimeFromDatetimeInSecsDescriptor extends AbstractScalarFunction
.getSerializerDeserializer(BuiltinType.AINT64);
@Override
- public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+ public void evaluate(IFrameTupleReference tuple, IPointable result) throws HyracksDataException {
resultStorage.reset();
eval.evaluate(tuple, argPtr);
byte[] bytes = argPtr.getByteArray();
int offset = argPtr.getStartOffset();
- try {
- if (bytes[offset] != ATypeTag.SERIALIZED_DATETIME_TYPE_TAG) {
- throw new AlgebricksException(
- getIdentifier().getName() + ": expects input type DATETIME/NULL but got "
- + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes[offset]));
- }
- long datetimeChronon = ADateTimeSerializerDeserializer.getChronon(bytes, offset + 1);
- aInt64.setValue(datetimeChronon / 1000L);
- int64Serde.serialize(aInt64, out);
- } catch (HyracksDataException hex) {
- throw new AlgebricksException(hex);
+ if (bytes[offset] != SERIALIZED_DATETIME_TYPE_TAG) {
+ throw new TypeMismatchException(getIdentifier(), 0, bytes[offset],
+ ATypeTag.SERIALIZED_DATETIME_TYPE_TAG);
}
+ long datetimeChronon = ADateTimeSerializerDeserializer.getChronon(bytes, offset + 1);
+ aInt64.setValue(datetimeChronon / 1000L);
+ int64Serde.serialize(aInt64, 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/temporal/UnixTimeFromTimeInMsDescriptor.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/UnixTimeFromTimeInMsDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/UnixTimeFromTimeInMsDescriptor.java
index 1beb772..7213479 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/UnixTimeFromTimeInMsDescriptor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/UnixTimeFromTimeInMsDescriptor.java
@@ -24,14 +24,13 @@ import org.apache.asterix.dataflow.data.nontagged.serde.ATimeSerializerDeseriali
import org.apache.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
import org.apache.asterix.om.base.AInt64;
import org.apache.asterix.om.base.AMutableInt64;
+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;
@@ -56,14 +55,12 @@ public class UnixTimeFromTimeInMsDescriptor extends AbstractScalarFunctionDynami
* @see org.apache.asterix.runtime.base.IScalarFunctionDynamicDescriptor#createEvaluatorFactory(org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory[])
*/
@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(final IHyracksTaskContext ctx) throws AlgebricksException {
+ public IScalarEvaluator createScalarEvaluator(final IHyracksTaskContext ctx) throws HyracksDataException {
return new IScalarEvaluator() {
private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
@@ -78,24 +75,19 @@ public class UnixTimeFromTimeInMsDescriptor extends AbstractScalarFunctionDynami
.getSerializerDeserializer(BuiltinType.AINT64);
@Override
- public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+ public void evaluate(IFrameTupleReference tuple, IPointable result) throws HyracksDataException {
resultStorage.reset();
eval.evaluate(tuple, argPtr);
byte[] bytes = argPtr.getByteArray();
int offset = argPtr.getStartOffset();
- try {
- if (bytes[offset] != ATypeTag.SERIALIZED_TIME_TYPE_TAG) {
- throw new AlgebricksException(
- getIdentifier().getName() + ": expects input type TIME/NULL but got "
- + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes[offset]));
- }
- long timeChronon = ATimeSerializerDeserializer.getChronon(bytes, offset + 1);
- aInt64.setValue(timeChronon);
- int64Serde.serialize(aInt64, out);
- } catch (HyracksDataException hex) {
- throw new AlgebricksException(hex);
+ if (bytes[offset] != ATypeTag.SERIALIZED_TIME_TYPE_TAG) {
+ throw new TypeMismatchException(getIdentifier(), 0, bytes[offset],
+ ATypeTag.SERIALIZED_TIME_TYPE_TAG);
}
+ long timeChronon = ATimeSerializerDeserializer.getChronon(bytes, offset + 1);
+ aInt64.setValue(timeChronon);
+ int64Serde.serialize(aInt64, 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/temporal/YearMonthDurationComparatorDescriptor.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/YearMonthDurationComparatorDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/YearMonthDurationComparatorDescriptor.java
index 10b8116..78c40c5 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/YearMonthDurationComparatorDescriptor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/YearMonthDurationComparatorDescriptor.java
@@ -26,9 +26,9 @@ import org.apache.asterix.om.base.ABoolean;
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.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
-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.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
@@ -51,14 +51,13 @@ public class YearMonthDurationComparatorDescriptor extends AbstractScalarFunctio
}
@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(final IHyracksTaskContext ctx) throws AlgebricksException {
+ public IScalarEvaluator createScalarEvaluator(final IHyracksTaskContext ctx) throws HyracksDataException {
return new IScalarEvaluator() {
private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
@@ -73,7 +72,7 @@ public class YearMonthDurationComparatorDescriptor extends AbstractScalarFunctio
.getSerializerDeserializer(BuiltinType.ABOOLEAN);
@Override
- public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+ public void evaluate(IFrameTupleReference tuple, IPointable result) throws HyracksDataException {
resultStorage.reset();
eval0.evaluate(tuple, argPtr0);
eval1.evaluate(tuple, argPtr1);
@@ -83,29 +82,26 @@ public class YearMonthDurationComparatorDescriptor extends AbstractScalarFunctio
byte[] bytes1 = argPtr1.getByteArray();
int offset1 = argPtr1.getStartOffset();
- try {
- if (bytes0[offset0] != ATypeTag.SERIALIZED_DURATION_TYPE_TAG
- || bytes1[offset1] != ATypeTag.SERIALIZED_DURATION_TYPE_TAG) {
- throw new AlgebricksException(getIdentifier().getName()
- + ": expects type NULL/DURATION, NULL/DURATION but got "
- + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes0[offset0]) + " and "
- + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes1[offset1]));
- }
-
- if ((ADurationSerializerDeserializer.getDayTime(bytes0, offset0 + 1) != 0)
- || (ADurationSerializerDeserializer.getDayTime(bytes1, offset1 + 1) != 0)) {
- throw new AlgebricksException(
- getIdentifier().getName() + ": only year-month durations are allowed.");
- }
-
- if (ADurationSerializerDeserializer.getYearMonth(bytes0,
- offset0 + 1) > ADurationSerializerDeserializer.getYearMonth(bytes1, offset1 + 1)) {
- boolSerde.serialize(isGreaterThan ? ABoolean.TRUE : ABoolean.FALSE, out);
- } else {
- boolSerde.serialize(isGreaterThan ? ABoolean.FALSE : ABoolean.TRUE, out);
- }
- } catch (HyracksDataException hex) {
- throw new AlgebricksException(hex);
+ if (bytes0[offset0] != ATypeTag.SERIALIZED_DURATION_TYPE_TAG) {
+ throw new TypeMismatchException(getIdentifier(), 0, bytes0[offset0],
+ ATypeTag.SERIALIZED_DURATION_TYPE_TAG);
+ }
+ if (bytes1[offset1] != ATypeTag.SERIALIZED_DURATION_TYPE_TAG) {
+ throw new TypeMismatchException(getIdentifier(), 1, bytes1[offset1],
+ ATypeTag.SERIALIZED_DURATION_TYPE_TAG);
+ }
+
+ if ((ADurationSerializerDeserializer.getDayTime(bytes0, offset0 + 1) != 0)
+ || (ADurationSerializerDeserializer.getDayTime(bytes1, offset1 + 1) != 0)) {
+ throw new InvalidDataFormatException(getIdentifier(),
+ ATypeTag.SERIALIZED_YEAR_MONTH_DURATION_TYPE_TAG);
+ }
+
+ if (ADurationSerializerDeserializer.getYearMonth(bytes0,
+ offset0 + 1) > ADurationSerializerDeserializer.getYearMonth(bytes1, offset1 + 1)) {
+ boolSerde.serialize(isGreaterThan ? ABoolean.TRUE : ABoolean.FALSE, out);
+ } else {
+ boolSerde.serialize(isGreaterThan ? ABoolean.FALSE : ABoolean.TRUE, 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/visitors/DeepEqualityVisitor.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/visitors/DeepEqualityVisitor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/visitors/DeepEqualityVisitor.java
index cd2718e..3cf5ec9 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/visitors/DeepEqualityVisitor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/visitors/DeepEqualityVisitor.java
@@ -96,7 +96,8 @@ public class DeepEqualityVisitor implements IVisitablePointableVisitor<Void, Pai
if (domain == Domain.NUMERIC) {
int s1 = pointable.getStartOffset();
int s2 = arg.first.getStartOffset();
- arg.second = (ATypeHierarchy.getDoubleValue(b1, s1) == ATypeHierarchy.getDoubleValue(b2, s2));
+ arg.second = Math.abs(ATypeHierarchy.getDoubleValue("deep-equal", 0, b1, s1)
+ - ATypeHierarchy.getDoubleValue("deep-equal", 1, b2, s2)) < 1E-10;
} else {
arg.second = false;
}
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/52671a2c/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/exceptions/ExceptionUtil.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/exceptions/ExceptionUtil.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/exceptions/ExceptionUtil.java
new file mode 100644
index 0000000..cf9ae22
--- /dev/null
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/exceptions/ExceptionUtil.java
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.asterix.runtime.exceptions;
+
+import org.apache.asterix.om.types.EnumDeserializer;
+
+public class ExceptionUtil {
+ private ExceptionUtil() {
+ }
+
+ static String toExpectedTypeString(byte... expectedTypeTags) {
+ StringBuilder expectedTypes = new StringBuilder();
+ int numCandidateTypes = expectedTypeTags.length;
+ for (int index = 0; index < numCandidateTypes; ++index) {
+ if (index > 0) {
+ if (index == numCandidateTypes - 1) {
+ expectedTypes.append(" or ");
+ } else {
+ expectedTypes.append(", ");
+ }
+ }
+ expectedTypes.append(EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(expectedTypeTags[index]));
+ }
+ return expectedTypes.toString();
+ }
+
+ static String indexToPosition(int index) {
+ int i = index + 1;
+ switch (i % 100) {
+ case 11:
+ case 12:
+ case 13:
+ return i + "th";
+ default:
+ switch (i % 10) {
+ case 1:
+ return i + "st";
+ case 2:
+ return i + "nd";
+ case 3:
+ return i + "rd";
+ default:
+ return i + "th";
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/52671a2c/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/exceptions/IncompatibleTypeException.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/exceptions/IncompatibleTypeException.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/exceptions/IncompatibleTypeException.java
new file mode 100644
index 0000000..0dad96c
--- /dev/null
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/exceptions/IncompatibleTypeException.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.asterix.runtime.exceptions;
+
+import org.apache.asterix.common.exceptions.ErrorCode;
+import org.apache.asterix.common.exceptions.RuntimeDataException;
+import org.apache.asterix.om.types.EnumDeserializer;
+import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
+
+public class IncompatibleTypeException extends RuntimeDataException {
+
+ // Incompatible input parameters, e.g., "1.0" > 1.0
+ public IncompatibleTypeException(FunctionIdentifier fid, byte typeTagLeft, byte typeTagRight) {
+ super(ErrorCode.ERROR_TYPE_INCOMPATIBLE, fid.getName(),
+ EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(typeTagLeft),
+ EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(typeTagRight));
+ }
+
+ // Incompatible input parameters, e.g., "1.0" > 1.0
+ public IncompatibleTypeException(String functionName, byte typeTagLeft, byte typeTagRight) {
+ super(ErrorCode.ERROR_TYPE_INCOMPATIBLE, functionName,
+ EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(typeTagLeft),
+ EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(typeTagRight));
+ }
+}
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/52671a2c/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/exceptions/InvalidDataFormatException.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/exceptions/InvalidDataFormatException.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/exceptions/InvalidDataFormatException.java
new file mode 100644
index 0000000..0fdb1f0
--- /dev/null
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/exceptions/InvalidDataFormatException.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.asterix.runtime.exceptions;
+
+import org.apache.asterix.common.exceptions.ErrorCode;
+import org.apache.asterix.common.exceptions.RuntimeDataException;
+import org.apache.asterix.om.types.EnumDeserializer;
+import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
+
+public class InvalidDataFormatException extends RuntimeDataException {
+
+ public InvalidDataFormatException(FunctionIdentifier fid, byte expectedTypeTag) {
+ super(ErrorCode.ERROR_INVALID_FORMAT, fid.getName(),
+ EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(expectedTypeTag));
+ }
+
+ public InvalidDataFormatException(FunctionIdentifier fid, String expectedType) {
+ super(ErrorCode.ERROR_INVALID_FORMAT, fid.getName(), expectedType);
+ }
+
+ public InvalidDataFormatException(FunctionIdentifier fid, Throwable cause, byte expectedTypeTag) {
+ super(ErrorCode.ERROR_INVALID_FORMAT, fid.getName(), cause, expectedTypeTag);
+ addSuppressed(cause);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/52671a2c/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/exceptions/OverflowException.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/exceptions/OverflowException.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/exceptions/OverflowException.java
new file mode 100644
index 0000000..968a54f
--- /dev/null
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/exceptions/OverflowException.java
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.asterix.runtime.exceptions;
+
+import org.apache.asterix.common.exceptions.ErrorCode;
+import org.apache.asterix.common.exceptions.RuntimeDataException;
+import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
+
+public class OverflowException extends RuntimeDataException {
+
+ // Overflow.
+ public OverflowException(FunctionIdentifier fid) {
+ super(ErrorCode.ERROR_OVERFLOW, fid.getName());
+ }
+
+ // Overflow.
+ public OverflowException(String functionName) {
+ super(ErrorCode.ERROR_OVERFLOW, functionName);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/52671a2c/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/exceptions/TypeMismatchException.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/exceptions/TypeMismatchException.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/exceptions/TypeMismatchException.java
new file mode 100644
index 0000000..2a838a2
--- /dev/null
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/exceptions/TypeMismatchException.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.asterix.runtime.exceptions;
+
+import static org.apache.asterix.runtime.exceptions.ExceptionUtil.indexToPosition;
+import static org.apache.asterix.runtime.exceptions.ExceptionUtil.toExpectedTypeString;
+
+import org.apache.asterix.common.exceptions.ErrorCode;
+import org.apache.asterix.common.exceptions.RuntimeDataException;
+import org.apache.asterix.om.types.EnumDeserializer;
+import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
+
+public class TypeMismatchException extends RuntimeDataException {
+
+ // Parameter type mistmatch.
+ public TypeMismatchException(FunctionIdentifier fid, Integer i, byte actualTypeTag, byte... expectedTypeTags) {
+ super(ErrorCode.ERROR_TYPE_MISMATCH, fid.getName(), indexToPosition(i), toExpectedTypeString(expectedTypeTags),
+ EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(actualTypeTag));
+ }
+
+ // Parameter type mistmatch.
+ public TypeMismatchException(String functionName, Integer i, byte actualTypeTag, byte... expectedTypeTags) {
+ super(ErrorCode.ERROR_TYPE_MISMATCH, functionName, indexToPosition(i), toExpectedTypeString(expectedTypeTags),
+ EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(actualTypeTag));
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/52671a2c/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/exceptions/UnderflowException.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/exceptions/UnderflowException.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/exceptions/UnderflowException.java
new file mode 100644
index 0000000..fede04f
--- /dev/null
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/exceptions/UnderflowException.java
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.asterix.runtime.exceptions;
+
+import org.apache.asterix.common.exceptions.ErrorCode;
+import org.apache.asterix.common.exceptions.RuntimeDataException;
+import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
+
+public class UnderflowException extends RuntimeDataException {
+
+ // Underflow.
+ public UnderflowException(FunctionIdentifier fid) {
+ super(ErrorCode.ERROR_OVERFLOW, fid.getName());
+ }
+
+ // Underflow.
+ public UnderflowException(String functionName) {
+ super(ErrorCode.ERROR_OVERFLOW, functionName);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/52671a2c/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/exceptions/UnsupportedItemTypeException.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/exceptions/UnsupportedItemTypeException.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/exceptions/UnsupportedItemTypeException.java
new file mode 100644
index 0000000..79d9266
--- /dev/null
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/exceptions/UnsupportedItemTypeException.java
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.asterix.runtime.exceptions;
+
+import org.apache.asterix.common.exceptions.ErrorCode;
+import org.apache.asterix.common.exceptions.RuntimeDataException;
+import org.apache.asterix.om.types.EnumDeserializer;
+import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
+
+public class UnsupportedItemTypeException extends RuntimeDataException {
+
+ // Unsupported item type.
+ public UnsupportedItemTypeException(FunctionIdentifier fid, byte itemTypeTag) {
+ super(ErrorCode.ERROR_TYPE_ITEM, fid.getName(), EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(itemTypeTag));
+ }
+
+ // Unsupported item type.
+ public UnsupportedItemTypeException(String functionName, byte itemTypeTag) {
+ super(ErrorCode.ERROR_TYPE_ITEM, functionName, EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(itemTypeTag));
+ }
+}
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/52671a2c/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/exceptions/UnsupportedTypeException.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/exceptions/UnsupportedTypeException.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/exceptions/UnsupportedTypeException.java
new file mode 100644
index 0000000..6279fbc
--- /dev/null
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/exceptions/UnsupportedTypeException.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.asterix.runtime.exceptions;
+
+import org.apache.asterix.common.exceptions.ErrorCode;
+import org.apache.asterix.common.exceptions.RuntimeDataException;
+import org.apache.asterix.om.types.EnumDeserializer;
+import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
+
+public class UnsupportedTypeException extends RuntimeDataException {
+
+ // Unsupported input type.
+ public UnsupportedTypeException(FunctionIdentifier fid, byte actualTypeTag) {
+ super(ErrorCode.ERROR_TYPE_UNSUPPORTED, fid.getName(),
+ EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(actualTypeTag));
+ }
+
+ // Unsupported input type.
+ public UnsupportedTypeException(String funcName, byte actualTypeTag) {
+ super(ErrorCode.ERROR_TYPE_UNSUPPORTED, funcName,
+ EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(actualTypeTag));
+ }
+}
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/52671a2c/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/runningaggregates/std/TidRunningAggregateDescriptor.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/runningaggregates/std/TidRunningAggregateDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/runningaggregates/std/TidRunningAggregateDescriptor.java
index 9cdfa56..b3a17aa 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/runningaggregates/std/TidRunningAggregateDescriptor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/runningaggregates/std/TidRunningAggregateDescriptor.java
@@ -26,7 +26,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.runningaggregates.base.AbstractRunningAggregateFunctionDynamicDescriptor;
-import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
import org.apache.hyracks.algebricks.runtime.base.IRunningAggregateEvaluator;
import org.apache.hyracks.algebricks.runtime.base.IRunningAggregateEvaluatorFactory;
@@ -49,17 +48,14 @@ public class TidRunningAggregateDescriptor extends AbstractRunningAggregateFunct
};
@Override
- public IRunningAggregateEvaluatorFactory createRunningAggregateEvaluatorFactory(IScalarEvaluatorFactory[] args)
- throws AlgebricksException {
-
+ public IRunningAggregateEvaluatorFactory createRunningAggregateEvaluatorFactory(IScalarEvaluatorFactory[] args) {
return new IRunningAggregateEvaluatorFactory() {
-
private static final long serialVersionUID = 1L;
@SuppressWarnings("unchecked")
@Override
public IRunningAggregateEvaluator createRunningAggregateEvaluator(IHyracksTaskContext ctx)
- throws AlgebricksException {
+ throws HyracksDataException {
return new IRunningAggregateEvaluator() {
@@ -70,20 +66,16 @@ public class TidRunningAggregateDescriptor extends AbstractRunningAggregateFunct
private int cnt;
@Override
- public void step(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+ public void step(IFrameTupleReference tuple, IPointable result) throws HyracksDataException {
resultStorage.reset();
- try {
- m.setValue(cnt);
- serde.serialize(m, resultStorage.getDataOutput());
- } catch (HyracksDataException e) {
- throw new AlgebricksException(e);
- }
+ m.setValue(cnt);
+ serde.serialize(m, resultStorage.getDataOutput());
result.set(resultStorage);
++cnt;
}
@Override
- public void init() throws AlgebricksException {
+ public void init() throws HyracksDataException {
cnt = 1;
}
};
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/52671a2c/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/unnestingfunctions/std/RangeDescriptor.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/unnestingfunctions/std/RangeDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/unnestingfunctions/std/RangeDescriptor.java
index 2f3cd7e..6acb8d4 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/unnestingfunctions/std/RangeDescriptor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/unnestingfunctions/std/RangeDescriptor.java
@@ -26,7 +26,6 @@ import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
import org.apache.asterix.om.types.BuiltinType;
import org.apache.asterix.om.types.hierachy.ATypeHierarchy;
import org.apache.asterix.runtime.unnestingfunctions.base.AbstractUnnestingFunctionDynamicDescriptor;
-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;
@@ -57,17 +56,15 @@ public class RangeDescriptor extends AbstractUnnestingFunctionDynamicDescriptor
}
@Override
- public IUnnestingEvaluatorFactory createUnnestingEvaluatorFactory(final IScalarEvaluatorFactory[] args)
- throws AlgebricksException {
+ public IUnnestingEvaluatorFactory createUnnestingEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
return new IUnnestingEvaluatorFactory() {
private static final long serialVersionUID = 1L;
@Override
public IUnnestingEvaluator createUnnestingEvaluator(final IHyracksTaskContext ctx)
- throws AlgebricksException {
+ throws HyracksDataException {
return new IUnnestingEvaluator() {
-
private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
@SuppressWarnings("rawtypes")
private ISerializerDeserializer serde = AqlSerializerDeserializerProvider.INSTANCE
@@ -80,35 +77,25 @@ public class RangeDescriptor extends AbstractUnnestingFunctionDynamicDescriptor
private long max;
@Override
- public void init(IFrameTupleReference tuple) throws AlgebricksException {
+ public void init(IFrameTupleReference tuple) throws HyracksDataException {
eval0.evaluate(tuple, inputVal);
- try {
- current = ATypeHierarchy.getLongValue(inputVal.getByteArray(), inputVal.getStartOffset());
- } catch (HyracksDataException e) {
- throw new AlgebricksException(e);
- }
+ current = ATypeHierarchy.getLongValue(getIdentifier().getName(), 0, inputVal.getByteArray(),
+ inputVal.getStartOffset());
eval1.evaluate(tuple, inputVal);
- try {
- max = ATypeHierarchy.getLongValue(inputVal.getByteArray(), inputVal.getStartOffset());
- } catch (HyracksDataException e) {
- throw new AlgebricksException(e);
- }
+ max = ATypeHierarchy.getLongValue(getIdentifier().getName(), 1, inputVal.getByteArray(),
+ inputVal.getStartOffset());
}
@SuppressWarnings("unchecked")
@Override
- public boolean step(IPointable result) throws AlgebricksException {
+ public boolean step(IPointable result) throws HyracksDataException {
if (current > max) {
return false;
}
aInt64.setValue(current);
- try {
- resultStorage.reset();
- serde.serialize(aInt64, resultStorage.getDataOutput());
- result.set(resultStorage);
- } catch (HyracksDataException e) {
- throw new AlgebricksException(e);
- }
+ resultStorage.reset();
+ serde.serialize(aInt64, resultStorage.getDataOutput());
+ result.set(resultStorage);
current++;
return true;
}