addressed Vinayak's comments about r1394: added reasonable and user-friendly exception information for functions.
git-svn-id: https://asterixdb.googlecode.com/svn/branches/asterix_stabilization_func_type_check@1409 eaa15691-b419-025a-1212-ee371bd00084
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/common/AsterixFunctionInputTypeException.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/common/AsterixFunctionInputTypeException.java
new file mode 100644
index 0000000..d0014a2
--- /dev/null
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/common/AsterixFunctionInputTypeException.java
@@ -0,0 +1,29 @@
+package edu.uci.ics.asterix.runtime.evaluators.common;
+
+import edu.uci.ics.asterix.om.types.ATypeTag;
+import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
+import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
+
+public class AsterixFunctionInputTypeException extends AlgebricksException {
+
+ private static final long serialVersionUID = 1L;
+
+ public AsterixFunctionInputTypeException(FunctionIdentifier funcID, String message) {
+ super(funcID.getName() + ": " + message);
+ }
+
+ public AsterixFunctionInputTypeException(FunctionIdentifier funcID, String message, ATypeTag... inputTypes) {
+ super(getErrorMsg(funcID, message, inputTypes));
+ }
+
+ public static String getErrorMsg(FunctionIdentifier funcID, String message, ATypeTag[] inputTypes) {
+ StringBuilder sbder = new StringBuilder();
+ sbder.append(funcID.getName()).append(" (").append(inputTypes[0].name());
+ for (ATypeTag tTag : inputTypes) {
+ sbder.append(", ").append(tTag.name());
+ }
+ sbder.append(": ").append(message);
+ return sbder.toString();
+ }
+
+}
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/AbstractBinaryStringBoolEval.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/AbstractBinaryStringBoolEval.java
index fb3bf0f..a54e3b0 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/AbstractBinaryStringBoolEval.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/AbstractBinaryStringBoolEval.java
@@ -8,7 +8,9 @@
import edu.uci.ics.asterix.om.base.AString;
import edu.uci.ics.asterix.om.types.ATypeTag;
import edu.uci.ics.asterix.om.types.BuiltinType;
+import edu.uci.ics.asterix.om.types.EnumDeserializer;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
+import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluator;
import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
import edu.uci.ics.hyracks.api.dataflow.value.ISerializerDeserializer;
@@ -28,15 +30,17 @@
private ArrayBackedValueStorage array1 = new ArrayBackedValueStorage();
private ICopyEvaluator evalLeft;
private ICopyEvaluator evalRight;
+ private final FunctionIdentifier funcID;
@SuppressWarnings({ "rawtypes" })
private ISerializerDeserializer boolSerde = AqlSerializerDeserializerProvider.INSTANCE
.getSerializerDeserializer(BuiltinType.ABOOLEAN);
public AbstractBinaryStringBoolEval(DataOutput dout, ICopyEvaluatorFactory evalLeftFactory,
- ICopyEvaluatorFactory evalRightFactory) throws AlgebricksException {
+ ICopyEvaluatorFactory evalRightFactory, FunctionIdentifier funcID) throws AlgebricksException {
this.dout = dout;
this.evalLeft = evalLeftFactory.createEvaluator(array0);
this.evalRight = evalRightFactory.createEvaluator(array1);
+ this.funcID = funcID;
}
@SuppressWarnings("unchecked")
@@ -57,8 +61,9 @@
return;
} else if (array0.getByteArray()[0] != SER_STRING_TYPE_TAG
|| array1.getByteArray()[0] != SER_STRING_TYPE_TAG) {
- throw new AlgebricksException("Expects String or NULL Type (got " + array0.getByteArray()[0] + " and "
- + array1.getByteArray()[0] + ")!");
+ throw new AlgebricksException(funcID.getName() + ": expects input type STRING or NULL, but got "
+ + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(array0.getByteArray()[0]) + " and "
+ + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(array1.getByteArray()[0]) + ")!");
}
} catch (HyracksDataException e) {
throw new AlgebricksException(e);
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/AbstractNumericArithmeticEval.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/AbstractNumericArithmeticEval.java
index ce6a905..895e575 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/AbstractNumericArithmeticEval.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/AbstractNumericArithmeticEval.java
@@ -33,10 +33,10 @@
@SuppressWarnings("serial")
public abstract class AbstractNumericArithmeticEval extends AbstractScalarFunctionDynamicDescriptor {
-
abstract protected long evaluateInteger(long lhs, long rhs) throws HyracksDataException;
+
abstract protected double evaluateDouble(double lhs, double rhs) throws HyracksDataException;
-
+
@Override
public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
return new ICopyEvaluatorFactory() {
@@ -52,22 +52,21 @@
private ICopyEvaluator evalLeft = args[0].createEvaluator(argOut);
private ICopyEvaluator evalRight = args[1].createEvaluator(argOut);
private double[] operandsFloating = new double[args.length];
- private long[] operandsInteger = new long[args.length];
- private int resultType;
+ private long[] operandsInteger = new long[args.length];
+ private int resultType;
static protected final int typeInt8 = 1;
static protected final int typeInt16 = 2;
static protected final int typeInt32 = 3;
static protected final int typeInt64 = 4;
static protected final int typeFloat = 5;
static protected final int typeDouble = 6;
-
-
+
protected AMutableFloat aFloat = new AMutableFloat(0);
protected AMutableDouble aDouble = new AMutableDouble(0);
protected AMutableInt64 aInt64 = new AMutableInt64(0);
protected AMutableInt32 aInt32 = new AMutableInt32(0);
protected AMutableInt16 aInt16 = new AMutableInt16((short) 0);
- protected AMutableInt8 aInt8 = new AMutableInt8((byte) 0);
+ protected AMutableInt8 aInt8 = new AMutableInt8((byte) 0);
private ATypeTag typeTag;
@SuppressWarnings("rawtypes")
private ISerializerDeserializer serde;
@@ -87,38 +86,48 @@
evalRight.evaluate(tuple);
typeTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut.getByteArray()[0]);
switch (typeTag) {
- case INT8: {
+ case INT8: {
currentType = typeInt8;
- operandsInteger[i] = AInt8SerializerDeserializer.getByte(argOut.getByteArray(), 1);
- operandsFloating[i] = AInt8SerializerDeserializer.getByte(argOut.getByteArray(), 1);
+ operandsInteger[i] = AInt8SerializerDeserializer.getByte(argOut.getByteArray(),
+ 1);
+ operandsFloating[i] = AInt8SerializerDeserializer.getByte(
+ argOut.getByteArray(), 1);
break;
}
case INT16: {
currentType = typeInt16;
- operandsInteger[i] = AInt16SerializerDeserializer.getShort(argOut.getByteArray(), 1);
- operandsFloating[i] = AInt16SerializerDeserializer.getShort(argOut.getByteArray(), 1);
+ operandsInteger[i] = AInt16SerializerDeserializer.getShort(
+ argOut.getByteArray(), 1);
+ operandsFloating[i] = AInt16SerializerDeserializer.getShort(
+ argOut.getByteArray(), 1);
break;
}
case INT32: {
currentType = typeInt32;
- operandsInteger[i] = AInt32SerializerDeserializer.getInt(argOut.getByteArray(), 1);
- operandsFloating[i] = AInt32SerializerDeserializer.getInt(argOut.getByteArray(), 1);
+ operandsInteger[i] = AInt32SerializerDeserializer.getInt(argOut.getByteArray(),
+ 1);
+ operandsFloating[i] = AInt32SerializerDeserializer.getInt(
+ argOut.getByteArray(), 1);
break;
}
case INT64: {
currentType = typeInt64;
- operandsInteger[i] = AInt64SerializerDeserializer.getLong(argOut.getByteArray(), 1);
- operandsFloating[i] = AInt64SerializerDeserializer.getLong(argOut.getByteArray(), 1);
+ operandsInteger[i] = AInt64SerializerDeserializer.getLong(
+ argOut.getByteArray(), 1);
+ operandsFloating[i] = AInt64SerializerDeserializer.getLong(
+ argOut.getByteArray(), 1);
break;
}
case FLOAT: {
currentType = typeFloat;
- operandsFloating[i] = AFloatSerializerDeserializer.getFloat(argOut.getByteArray(), 1);
+ operandsFloating[i] = AFloatSerializerDeserializer.getFloat(
+ argOut.getByteArray(), 1);
break;
}
case DOUBLE: {
currentType = typeDouble;
- operandsFloating[i] = ADoubleSerializerDeserializer.getDouble(argOut.getByteArray(), 1);
+ operandsFloating[i] = ADoubleSerializerDeserializer.getDouble(
+ argOut.getByteArray(), 1);
break;
}
case NULL: {
@@ -128,88 +137,88 @@
return;
}
default: {
- throw new NotImplementedException(i == 0 ? "Left"
- : "Right"
- + " Operand can not be "
- + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut
- .getByteArray()[0]));
+ throw new NotImplementedException(getIdentifier().getName()
+ + (i == 0 ? ": Left" : ": Right")
+ + " operand expects INT8/INT16/INT32/INT64/FLOAT/DOUBLE/NULL, but got "
+ + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut
+ .getByteArray()[0]));
}
}
-
- if(resultType < currentType) {
+
+ if (resultType < currentType) {
resultType = currentType;
}
}
-
+
long lres = 0;
double dres = 0;
- switch(resultType) {
+ switch (resultType) {
case typeInt8:
serde = AqlSerializerDeserializerProvider.INSTANCE
- .getSerializerDeserializer(BuiltinType.AINT8);
+ .getSerializerDeserializer(BuiltinType.AINT8);
lres = evaluateInteger(operandsInteger[0], operandsInteger[1]);
- if(lres > Byte.MAX_VALUE) {
+ if (lres > Byte.MAX_VALUE) {
throw new AlgebricksException("Overflow happened.");
- }
- if(lres < Byte.MIN_VALUE) {
+ }
+ if (lres < Byte.MIN_VALUE) {
throw new AlgebricksException("Underflow happened.");
- }
- aInt8.setValue((byte)lres);
- serde.serialize(aInt8, out);
- break;
+ }
+ aInt8.setValue((byte) lres);
+ serde.serialize(aInt8, out);
+ break;
case typeInt16:
serde = AqlSerializerDeserializerProvider.INSTANCE
- .getSerializerDeserializer(BuiltinType.AINT16);
+ .getSerializerDeserializer(BuiltinType.AINT16);
lres = evaluateInteger(operandsInteger[0], operandsInteger[1]);
- if(lres > Short.MAX_VALUE) {
+ if (lres > Short.MAX_VALUE) {
throw new AlgebricksException("Overflow happened.");
- }
- if(lres < Short.MIN_VALUE) {
+ }
+ if (lres < Short.MIN_VALUE) {
throw new AlgebricksException("Underflow happened.");
- }
- aInt16.setValue((short)lres);
- serde.serialize(aInt16, out);
+ }
+ aInt16.setValue((short) lres);
+ serde.serialize(aInt16, out);
break;
case typeInt32:
serde = AqlSerializerDeserializerProvider.INSTANCE
- .getSerializerDeserializer(BuiltinType.AINT32);
+ .getSerializerDeserializer(BuiltinType.AINT32);
lres = evaluateInteger(operandsInteger[0], operandsInteger[1]);
- if(lres > Integer.MAX_VALUE) {
+ if (lres > Integer.MAX_VALUE) {
throw new AlgebricksException("Overflow happened.");
- }
- if(lres < Integer.MIN_VALUE) {
+ }
+ if (lres < Integer.MIN_VALUE) {
throw new AlgebricksException("Underflow happened.");
- }
- aInt32.setValue((int)lres);
- serde.serialize(aInt32, out);
+ }
+ aInt32.setValue((int) lres);
+ serde.serialize(aInt32, out);
break;
case typeInt64:
serde = AqlSerializerDeserializerProvider.INSTANCE
- .getSerializerDeserializer(BuiltinType.AINT64);
- lres = evaluateInteger(operandsInteger[0], operandsInteger[1]);
+ .getSerializerDeserializer(BuiltinType.AINT64);
+ lres = evaluateInteger(operandsInteger[0], operandsInteger[1]);
aInt64.setValue(lres);
- serde.serialize(aInt64, out);
+ serde.serialize(aInt64, out);
break;
case typeFloat:
serde = AqlSerializerDeserializerProvider.INSTANCE
- .getSerializerDeserializer(BuiltinType.AFLOAT);
+ .getSerializerDeserializer(BuiltinType.AFLOAT);
dres = evaluateDouble(operandsFloating[0], operandsFloating[1]);
- if(dres > Float.MAX_VALUE) {
+ if (dres > Float.MAX_VALUE) {
throw new AlgebricksException("Overflow happened.");
- }
- if(dres < - Float.MAX_VALUE) {
+ }
+ if (dres < -Float.MAX_VALUE) {
throw new AlgebricksException("Underflow happened.");
- }
- aFloat.setValue((float)dres);
- serde.serialize(aFloat, out);
- break;
+ }
+ aFloat.setValue((float) dres);
+ serde.serialize(aFloat, out);
+ break;
case typeDouble:
serde = AqlSerializerDeserializerProvider.INSTANCE
- .getSerializerDeserializer(BuiltinType.ADOUBLE);
+ .getSerializerDeserializer(BuiltinType.ADOUBLE);
aDouble.setValue(evaluateDouble(operandsFloating[0], operandsFloating[1]));
- serde.serialize(aDouble, out);
+ serde.serialize(aDouble, out);
break;
- }
+ }
} catch (HyracksDataException hde) {
throw new AlgebricksException(hde);
}
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/AbstractQuadStringStringEval.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/AbstractQuadStringStringEval.java
index 271cc09..ce9ecd2 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/AbstractQuadStringStringEval.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/AbstractQuadStringStringEval.java
@@ -14,7 +14,9 @@
import edu.uci.ics.asterix.om.base.AString;
import edu.uci.ics.asterix.om.types.ATypeTag;
import edu.uci.ics.asterix.om.types.BuiltinType;
+import edu.uci.ics.asterix.om.types.EnumDeserializer;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
+import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluator;
import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
import edu.uci.ics.hyracks.api.dataflow.value.ISerializerDeserializer;
@@ -39,6 +41,8 @@
private ICopyEvaluator eval2;
private ICopyEvaluator eval3;
+ private final FunctionIdentifier funcID;
+
private AMutableString resultBuffer = new AMutableString("");
@SuppressWarnings("rawtypes")
private ISerializerDeserializer nullSerde = AqlSerializerDeserializerProvider.INSTANCE
@@ -48,12 +52,14 @@
.getSerializerDeserializer(BuiltinType.ASTRING);
public AbstractQuadStringStringEval(DataOutput dout, ICopyEvaluatorFactory eval0, ICopyEvaluatorFactory eval1,
- ICopyEvaluatorFactory eval2, ICopyEvaluatorFactory eval3) throws AlgebricksException {
+ ICopyEvaluatorFactory eval2, ICopyEvaluatorFactory eval3, FunctionIdentifier funcID)
+ throws AlgebricksException {
this.dout = dout;
this.eval0 = eval0.createEvaluator(array0);
this.eval1 = eval1.createEvaluator(array1);
this.eval2 = eval2.createEvaluator(array2);
this.eval3 = eval3.createEvaluator(array3);
+ this.funcID = funcID;
}
@SuppressWarnings("unchecked")
@@ -76,8 +82,12 @@
if ((array1.getByteArray()[0] != SER_STRING_TYPE_TAG && array1.getByteArray()[0] != SER_NULL_TYPE_TAG)
|| (array2.getByteArray()[0] != SER_STRING_TYPE_TAG && array2.getByteArray()[0] != SER_NULL_TYPE_TAG)
|| (array3.getByteArray()[0] != SER_STRING_TYPE_TAG && array3.getByteArray()[0] != SER_NULL_TYPE_TAG)) {
- throw new AlgebricksException("Expects String or NULL Type (but got " + array1.getByteArray()[0]
- + ", " + array2.getByteArray()[0] + ", " + array3.getByteArray()[0] + ".");
+ throw new AlgebricksException(funcID.getName()
+ + ": expects input type (STRING/NULL, STRING/NULL, STRING/NULL, STRING/NULL), but got ("
+ + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(array0.getByteArray()[0]) + ", "
+ + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(array1.getByteArray()[0]) + ", "
+ + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(array2.getByteArray()[0]) + ", "
+ + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(array3.getByteArray()[0]) + ".");
}
} else {
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/AbstractStringContainsEval.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/AbstractStringContainsEval.java
index 872e841..81782c8 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/AbstractStringContainsEval.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/AbstractStringContainsEval.java
@@ -6,7 +6,9 @@
import edu.uci.ics.asterix.om.base.ABoolean;
import edu.uci.ics.asterix.om.types.ATypeTag;
import edu.uci.ics.asterix.om.types.BuiltinType;
+import edu.uci.ics.asterix.om.types.EnumDeserializer;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
+import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluator;
import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
import edu.uci.ics.hyracks.api.dataflow.value.ISerializerDeserializer;
@@ -30,11 +32,14 @@
private ISerializerDeserializer boolSerde = AqlSerializerDeserializerProvider.INSTANCE
.getSerializerDeserializer(BuiltinType.ABOOLEAN);
+ private final FunctionIdentifier funcID;
+
public AbstractStringContainsEval(DataOutput dout, ICopyEvaluatorFactory evalStringFactory,
- ICopyEvaluatorFactory evalPatternFactory) throws AlgebricksException {
+ ICopyEvaluatorFactory evalPatternFactory, FunctionIdentifier funcID) throws AlgebricksException {
this.dout = dout;
this.evalString = evalStringFactory.createEvaluator(array0);
this.evalPattern = evalPatternFactory.createEvaluator(array1);
+ this.funcID = funcID;
}
@SuppressWarnings("unchecked")
@@ -60,7 +65,10 @@
}
if (array0.getByteArray()[0] != SER_STRING_TYPE_TAG || array1.getByteArray()[0] != SER_STRING_TYPE_TAG) {
- throw new AlgebricksException("Expects String or NULL Type.");
+ throw new AlgebricksException(funcID.getName()
+ + ": expects input type (STRING/NULL, STRING/NULL), but got ("
+ + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(array0.getByteArray()[0]) + ", "
+ + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(array1.getByteArray()[0]) + ").");
}
} catch (HyracksDataException e) {
throw new AlgebricksException(e);
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/AbstractTripleStringBoolEval.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/AbstractTripleStringBoolEval.java
index dba46aa..a3be797 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/AbstractTripleStringBoolEval.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/AbstractTripleStringBoolEval.java
@@ -9,7 +9,9 @@
import edu.uci.ics.asterix.om.base.AString;
import edu.uci.ics.asterix.om.types.ATypeTag;
import edu.uci.ics.asterix.om.types.BuiltinType;
+import edu.uci.ics.asterix.om.types.EnumDeserializer;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
+import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluator;
import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
import edu.uci.ics.hyracks.api.dataflow.value.ISerializerDeserializer;
@@ -35,12 +37,15 @@
private ISerializerDeserializer boolSerde = AqlSerializerDeserializerProvider.INSTANCE
.getSerializerDeserializer(BuiltinType.ABOOLEAN);
+ private final FunctionIdentifier funcID;
+
public AbstractTripleStringBoolEval(DataOutput dout, ICopyEvaluatorFactory eval0, ICopyEvaluatorFactory eval1,
- ICopyEvaluatorFactory eval2) throws AlgebricksException {
+ ICopyEvaluatorFactory eval2, FunctionIdentifier funcID) throws AlgebricksException {
this.dout = dout;
this.eval0 = eval0.createEvaluator(array0);
this.eval1 = eval1.createEvaluator(array1);
this.eval2 = eval2.createEvaluator(array2);
+ this.funcID = funcID;
}
@SuppressWarnings("unchecked")
@@ -63,9 +68,13 @@
return;
}
- if (array0.getByteArray()[0] != SER_STRING_TYPE_TAG || array1.getByteArray()[0] != SER_STRING_TYPE_TAG) {
- throw new AlgebricksException(
- "Expects String or NULL Type for the first argument and String Type for the second argument.");
+ if (array0.getByteArray()[0] != SER_STRING_TYPE_TAG || array1.getByteArray()[0] != SER_STRING_TYPE_TAG
+ || array2.getByteArray()[0] != SER_STRING_TYPE_TAG) {
+ throw new AlgebricksException(funcID.getName()
+ + ": expects iput type (STRING/NULL, STRING/NULL, STRING) but got ("
+ + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(array0.getByteArray()[0]) + ", "
+ + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(array1.getByteArray()[0]) + ", "
+ + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(array2.getByteArray()[0]) + ")");
}
} catch (HyracksDataException e) {
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/AbstractTripleStringStringEval.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/AbstractTripleStringStringEval.java
index 9307d0e..41d0b3d 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/AbstractTripleStringStringEval.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/AbstractTripleStringStringEval.java
@@ -10,7 +10,9 @@
import edu.uci.ics.asterix.om.base.AString;
import edu.uci.ics.asterix.om.types.ATypeTag;
import edu.uci.ics.asterix.om.types.BuiltinType;
+import edu.uci.ics.asterix.om.types.EnumDeserializer;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
+import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluator;
import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
import edu.uci.ics.hyracks.api.dataflow.value.ISerializerDeserializer;
@@ -41,12 +43,15 @@
private ISerializerDeserializer strSerde = AqlSerializerDeserializerProvider.INSTANCE
.getSerializerDeserializer(BuiltinType.ASTRING);
+ private final FunctionIdentifier funcID;
+
public AbstractTripleStringStringEval(DataOutput dout, ICopyEvaluatorFactory eval0, ICopyEvaluatorFactory eval1,
- ICopyEvaluatorFactory eval2) throws AlgebricksException {
+ ICopyEvaluatorFactory eval2, FunctionIdentifier funcID) throws AlgebricksException {
this.dout = dout;
this.eval0 = eval0.createEvaluator(array0);
this.eval1 = eval1.createEvaluator(array1);
this.eval2 = eval2.createEvaluator(array2);
+ this.funcID = funcID;
}
@SuppressWarnings("unchecked")
@@ -71,7 +76,11 @@
if (array0.getByteArray()[0] != SER_STRING_TYPE_TAG || array1.getByteArray()[0] != SER_STRING_TYPE_TAG
|| array2.getByteArray()[0] != SER_STRING_TYPE_TAG) {
- throw new AlgebricksException("Expects String Type.");
+ throw new AlgebricksException(funcID.getName()
+ + ": expects input type (STRING/NULL, STRING, STRING), but got ("
+ + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(array0.getByteArray()[0]) + ", "
+ + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(array1.getByteArray()[0]) + ", "
+ + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(array2.getByteArray()[0]) + ").");
}
} catch (HyracksDataException e) {
throw new AlgebricksException(e);
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/AnyCollectionMemberDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/AnyCollectionMemberDescriptor.java
index e080a39..d704812 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/AnyCollectionMemberDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/AnyCollectionMemberDescriptor.java
@@ -87,7 +87,8 @@
}
if (serList[0] != SER_ORDEREDLIST_TYPE_TAG && serList[0] != SER_UNORDEREDLIST_TYPE_TAG) {
- throw new AlgebricksException("List's get-any-item is not defined for values of type"
+ throw new AlgebricksException(AsterixBuiltinFunctions.ANY_COLLECTION_MEMBER.getName()
+ + ": expects input type ORDEREDLIST/UNORDEREDLIST, but got "
+ EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(serList[0]));
}
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/CodePointToStringDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/CodePointToStringDescriptor.java
index 2a1d851..1a3e1b8 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/CodePointToStringDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/CodePointToStringDescriptor.java
@@ -33,6 +33,8 @@
}
};
private final static byte SER_ORDEREDLIST_TYPE_TAG = ATypeTag.ORDEREDLIST.serialize();
+ private final static byte SER_INT32_TYPE_TAG = ATypeTag.INT32.serialize();
+
private final static byte[] currentUTF8 = new byte[6];
private final byte stringTypeTag = ATypeTag.STRING.serialize();
@@ -44,7 +46,7 @@
private int codePointToUTF8(int c) {
if (c < 0x80) {
- currentUTF8[0] = (byte) (c & 0x7F /*mask 7 lsb: 0b1111111 */);
+ currentUTF8[0] = (byte) (c & 0x7F /* mask 7 lsb: 0b1111111 */);
return 1;
} else if (c < 0x0800) {
currentUTF8[0] = (byte) (c >> 6 & 0x1F | 0xC0);
@@ -95,8 +97,10 @@
outInputList.reset();
evalList.evaluate(tuple);
byte[] serOrderedList = outInputList.getByteArray();
- if (serOrderedList[0] != SER_ORDEREDLIST_TYPE_TAG) {
- throw new AlgebricksException("Expects an Integer List."
+ if (serOrderedList[0] != SER_ORDEREDLIST_TYPE_TAG
+ && serOrderedList[1] != SER_INT32_TYPE_TAG) {
+ throw new AlgebricksException(AsterixBuiltinFunctions.CODEPOINT_TO_STRING.getName()
+ + ": expects input type ORDEREDLIST but got "
+ EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(serOrderedList[0]));
}
int size = AOrderedListSerializerDeserializer.getNumberOfItems(serOrderedList);
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/ContainsDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/ContainsDescriptor.java
index f2bb83c..8fe59a8 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/ContainsDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/ContainsDescriptor.java
@@ -33,7 +33,7 @@
DataOutput dout = output.getDataOutput();
- return new AbstractStringContainsEval(dout, args[0], args[1]) {
+ return new AbstractStringContainsEval(dout, args[0], args[1], AsterixBuiltinFunctions.CONTAINS) {
@Override
protected boolean findMatch(byte[] strBytes, byte[] patternBytes) {
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/CreateCircleDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/CreateCircleDescriptor.java
index 85c6332..c188228 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/CreateCircleDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/CreateCircleDescriptor.java
@@ -15,6 +15,7 @@
import edu.uci.ics.asterix.om.functions.IFunctionDescriptorFactory;
import edu.uci.ics.asterix.om.types.ATypeTag;
import edu.uci.ics.asterix.om.types.BuiltinType;
+import edu.uci.ics.asterix.om.types.EnumDeserializer;
import edu.uci.ics.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
@@ -28,10 +29,10 @@
public class CreateCircleDescriptor extends AbstractScalarFunctionDynamicDescriptor {
private static final long serialVersionUID = 1L;
-
+
private static final byte SER_DOUBLE_TYPE_TAG = ATypeTag.DOUBLE.serialize();
private static final byte SER_POINT_TYPE_TAG = ATypeTag.POINT.serialize();
-
+
public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
public IFunctionDescriptor createFunctionDescriptor() {
return new CreateCircleDescriptor();
@@ -66,12 +67,17 @@
outInput1.reset();
eval1.evaluate(tuple);
-
// Type check: (point, double)
- if(outInput0.getByteArray()[0] != SER_POINT_TYPE_TAG || outInput1.getByteArray()[0] != SER_DOUBLE_TYPE_TAG){
- throw new AlgebricksException("Expects Type: (Point, Double).");
+ if (outInput0.getByteArray()[0] != SER_POINT_TYPE_TAG
+ || outInput1.getByteArray()[0] != SER_DOUBLE_TYPE_TAG) {
+ throw new AlgebricksException(AsterixBuiltinFunctions.CREATE_CIRCLE.getName()
+ + ": expects input type (POINT, DOUBLE) but got ("
+ + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(outInput0.getByteArray()[0])
+ + ", "
+ + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(outInput1.getByteArray()[0])
+ + ")");
}
-
+
try {
aPoint.setValue(ADoubleSerializerDeserializer.getDouble(outInput0.getByteArray(),
APointSerializerDeserializer.getCoordinateOffset(Coordinate.X)),
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/CreateLineDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/CreateLineDescriptor.java
index f74ae36..3021d70 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/CreateLineDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/CreateLineDescriptor.java
@@ -15,6 +15,7 @@
import edu.uci.ics.asterix.om.functions.IFunctionDescriptorFactory;
import edu.uci.ics.asterix.om.types.ATypeTag;
import edu.uci.ics.asterix.om.types.BuiltinType;
+import edu.uci.ics.asterix.om.types.EnumDeserializer;
import edu.uci.ics.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
@@ -69,7 +70,12 @@
// type-check: (point, point)
if (outInput0.getByteArray()[0] != SER_POINT_TYPE_TAG
|| outInput1.getByteArray()[0] != SER_POINT_TYPE_TAG) {
- throw new AlgebricksException("Expects Types: (Point, Point).");
+ throw new AlgebricksException(AsterixBuiltinFunctions.CREATE_LINE.getName()
+ + ": expects input type: (POINT, POINT) but got ("
+ + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(outInput0.getByteArray()[0])
+ + ", "
+ + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(outInput1.getByteArray()[0])
+ + ").");
}
try {
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/CreatePointDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/CreatePointDescriptor.java
index 61a6283..e660815 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/CreatePointDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/CreatePointDescriptor.java
@@ -12,6 +12,7 @@
import edu.uci.ics.asterix.om.functions.IFunctionDescriptorFactory;
import edu.uci.ics.asterix.om.types.ATypeTag;
import edu.uci.ics.asterix.om.types.BuiltinType;
+import edu.uci.ics.asterix.om.types.EnumDeserializer;
import edu.uci.ics.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
@@ -65,7 +66,12 @@
// type-check: (double, double)
if (outInput0.getByteArray()[0] != SER_DOUBLE_TYPE_TAG
|| outInput1.getByteArray()[0] != SER_DOUBLE_TYPE_TAG) {
- throw new AlgebricksException("Expects Type: (Double, Double).");
+ throw new AlgebricksException(AsterixBuiltinFunctions.CREATE_POINT.getName()
+ + ": expects input type: (DOUBLE, DOUBLE) but got ("
+ + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(outInput0.getByteArray()[0])
+ + ", "
+ + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(outInput1.getByteArray()[0])
+ + ").");
}
try {
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/CreateRectangleDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/CreateRectangleDescriptor.java
index 1b13fb0..a9c3b09 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/CreateRectangleDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/CreateRectangleDescriptor.java
@@ -15,6 +15,7 @@
import edu.uci.ics.asterix.om.functions.IFunctionDescriptorFactory;
import edu.uci.ics.asterix.om.types.ATypeTag;
import edu.uci.ics.asterix.om.types.BuiltinType;
+import edu.uci.ics.asterix.om.types.EnumDeserializer;
import edu.uci.ics.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
@@ -67,7 +68,12 @@
if (outInput0.getByteArray()[0] != SER_POINT_TYPE_TAG
|| outInput1.getByteArray()[0] != SER_POINT_TYPE_TAG) {
- throw new AlgebricksException("Expects Types: (Point, Point).");
+ throw new AlgebricksException(AsterixBuiltinFunctions.CREATE_RECTANGLE.getName()
+ + ": expects input type: (POINT, POINT) but got ("
+ + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(outInput0.getByteArray()[0])
+ + ", "
+ + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(outInput1.getByteArray()[0])
+ + ".");
}
try {
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/EditDistanceCheckDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/EditDistanceCheckDescriptor.java
index ca61b5b..028c31b 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/EditDistanceCheckDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/EditDistanceCheckDescriptor.java
@@ -92,8 +92,8 @@
}
default: {
- throw new AlgebricksException("Invalid type " + argType
- + " passed as argument to edit distance function.");
+ throw new AlgebricksException(AsterixBuiltinFunctions.EDIT_DISTANCE_CHECK.getName()
+ + ": expects input type as STRING or ORDEREDLIST but got " + argType + ".");
}
}
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/EditDistanceListIsFilterable.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/EditDistanceListIsFilterable.java
index 7c47cad..5866bf7 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/EditDistanceListIsFilterable.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/EditDistanceListIsFilterable.java
@@ -94,9 +94,9 @@
break;
}
default: {
- throw new AlgebricksException(
- "Expected type 'ORDEREDLIST' or 'UNORDEREDLIST' as first argument. Encountered '"
- + typeTag.toString() + "'.");
+ throw new AlgebricksException(AsterixBuiltinFunctions.EDIT_DISTANCE_LIST_IS_FILTERABLE.getName()
+ + ": expects input type ORDEREDLIST or UNORDEREDLIST as the first argument, but got "
+ + typeTag + ".");
}
}
@@ -105,8 +105,8 @@
edThreshEval.evaluate(tuple);
typeTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argBuf.getByteArray()[0]);
if (!typeTag.equals(ATypeTag.INT32)) {
- throw new AlgebricksException("Expected type 'INT32' as second argument. Encountered '"
- + typeTag.toString() + "'.");
+ throw new AlgebricksException(AsterixBuiltinFunctions.EDIT_DISTANCE_LIST_IS_FILTERABLE.getName()
+ + ": expected type INT32 as the second argument, but got " + typeTag + ".");
}
int edThresh = IntegerSerializerDeserializer.getInt(argBuf.getByteArray(), 1);
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/EditDistanceStringIsFilterable.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/EditDistanceStringIsFilterable.java
index e8571bf..512a76b 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/EditDistanceStringIsFilterable.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/EditDistanceStringIsFilterable.java
@@ -88,8 +88,8 @@
stringEval.evaluate(tuple);
typeTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argBuf.getByteArray()[0]);
if (!typeTag.equals(ATypeTag.STRING)) {
- throw new AlgebricksException("Expected type 'STRING' as first argument. Encountered '"
- + typeTag.toString() + "'.");
+ throw new AlgebricksException(AsterixBuiltinFunctions.EDIT_DISTANCE_STRING_IS_FILTERABLE.getName()
+ + ": expects input type STRING as first argument, but got " + typeTag + ".");
}
int utf8Length = UTF8StringPointable.getUTFLength(argBuf.getByteArray(), 1);
int pos = 3;
@@ -105,8 +105,8 @@
edThreshEval.evaluate(tuple);
typeTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argBuf.getByteArray()[0]);
if (!typeTag.equals(ATypeTag.INT32)) {
- throw new AlgebricksException("Expected type 'INT32' as second argument. Encountered '"
- + typeTag.toString() + "'.");
+ throw new AlgebricksException(AsterixBuiltinFunctions.EDIT_DISTANCE_STRING_IS_FILTERABLE.getName()
+ + ": expects input type INT32 as second argument, but got " + typeTag + ".");
}
int edThresh = IntegerSerializerDeserializer.getInt(argBuf.getByteArray(), 1);
@@ -115,8 +115,8 @@
gramLenEval.evaluate(tuple);
typeTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argBuf.getByteArray()[0]);
if (!typeTag.equals(ATypeTag.INT32)) {
- throw new AlgebricksException("Expected type 'INT32' as third argument. Encountered '"
- + typeTag.toString() + "'.");
+ throw new AlgebricksException(AsterixBuiltinFunctions.EDIT_DISTANCE_STRING_IS_FILTERABLE.getName()
+ + ": expects input type INT32 as third argument, but got " + typeTag + ".");
}
int gramLen = IntegerSerializerDeserializer.getInt(argBuf.getByteArray(), 1);
@@ -125,8 +125,8 @@
usePrePostEval.evaluate(tuple);
typeTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argBuf.getByteArray()[0]);
if (!typeTag.equals(ATypeTag.BOOLEAN)) {
- throw new AlgebricksException("Expected type 'BOOLEAN' as fourth argument. Encountered '"
- + typeTag.toString() + "'.");
+ throw new AlgebricksException(AsterixBuiltinFunctions.EDIT_DISTANCE_STRING_IS_FILTERABLE.getName()
+ + ": expects input type BOOLEAN as fourth argument, but got " + typeTag + ".");
}
boolean usePrePost = BooleanSerializerDeserializer.getBoolean(argBuf.getByteArray(), 1);
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/EndsWithDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/EndsWithDescriptor.java
index d5d74bb..bd5757d 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/EndsWithDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/EndsWithDescriptor.java
@@ -33,7 +33,7 @@
DataOutput dout = output.getDataOutput();
- return new AbstractStringContainsEval(dout, args[0], args[1]) {
+ return new AbstractStringContainsEval(dout, args[0], args[1], AsterixBuiltinFunctions.ENDS_WITH) {
@Override
protected boolean findMatch(byte[] strBytes, byte[] patternBytes) {
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/FieldAccessByNameDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/FieldAccessByNameDescriptor.java
index 306d7fd..09a9940 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/FieldAccessByNameDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/FieldAccessByNameDescriptor.java
@@ -92,7 +92,8 @@
}
if (serRecord[0] != SER_RECORD_TYPE_TAG) {
- throw new AlgebricksException("Field accessor is not defined for values of type"
+ throw new AlgebricksException(AsterixBuiltinFunctions.FIELD_ACCESS_BY_NAME.getName()
+ + ": expects input type NULL or RECORD, but got "
+ EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(serRecord[0]));
}
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/GetItemDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/GetItemDescriptor.java
index ca65c11..b41347d 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/GetItemDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/GetItemDescriptor.java
@@ -52,6 +52,7 @@
private ICopyEvaluatorFactory indexEvalFactory;
private final static byte SER_ORDEREDLIST_TYPE_TAG = ATypeTag.ORDEREDLIST.serialize();
private final static byte SER_NULL_TYPE_TAG = ATypeTag.NULL.serialize();
+ private final static byte SER_INT32_TYPE_TAG = ATypeTag.INT32.serialize();
private byte serItemTypeTag;
private ATypeTag itemTag;
private boolean selfDescList = false;
@@ -92,9 +93,13 @@
return;
}
- if (serOrderedList[0] != SER_ORDEREDLIST_TYPE_TAG) {
- throw new AlgebricksException("List's get-item can not be called on values of type"
- + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(serOrderedList[0]));
+ if (serOrderedList[0] != SER_ORDEREDLIST_TYPE_TAG
+ || outInputIdx.getByteArray()[0] != SER_INT32_TYPE_TAG) {
+ throw new AlgebricksException(AsterixBuiltinFunctions.GET_ITEM.getName()
+ + ": expects input type (NULL/ORDEREDLIST, INT32), but got ("
+ + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(serOrderedList[0]) + ", "
+ + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(outInputIdx.getByteArray()[0])
+ + ").");
}
itemIndex = IntegerSerializerDeserializer.getInt(outInputIdx.getByteArray(), 1);
@@ -103,7 +108,8 @@
return;
}
if (itemIndex < 0)
- throw new AlgebricksException("Item index can be negative !!");
+ throw new AlgebricksException(AsterixBuiltinFunctions.GET_ITEM.getName()
+ + ": item index can be negative!");
itemTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(serOrderedList[1]);
if (itemTag == ATypeTag.ANY)
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/InjectFailureDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/InjectFailureDescriptor.java
index 3247475..e35c56f 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/InjectFailureDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/InjectFailureDescriptor.java
@@ -58,7 +58,8 @@
if (typeTag == ATypeTag.BOOLEAN) {
boolean argResult = ABooleanSerializerDeserializer.getBoolean(argOut.getByteArray(), 1);
if (argResult)
- throw new AlgebricksException("Injecting a intended failure");
+ throw new AlgebricksException(AsterixBuiltinFunctions.INJECT_FAILURE
+ + ": injecting a intended failure");
}
// evaluate the real evaluator
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/LenDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/LenDescriptor.java
index abea4e3..48e575a 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/LenDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/LenDescriptor.java
@@ -14,6 +14,7 @@
import edu.uci.ics.asterix.om.functions.IFunctionDescriptorFactory;
import edu.uci.ics.asterix.om.types.ATypeTag;
import edu.uci.ics.asterix.om.types.BuiltinType;
+import edu.uci.ics.asterix.om.types.EnumDeserializer;
import edu.uci.ics.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
@@ -78,7 +79,9 @@
}
if (serList[0] != SER_ORDEREDLIST_TYPE_TAG && serList[0] != SER_UNORDEREDLIST_TYPE_TAG) {
- throw new AlgebricksException("len() can only be called on ordered or unordered lists.");
+ throw new AlgebricksException(AsterixBuiltinFunctions.LEN.getName()
+ + ": expects input type ORDEREDLIST/UNORDEREDLIST but got "
+ + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(serList[0]));
}
int numberOfitems = 0;
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/LikeDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/LikeDescriptor.java
index 62d83d0..58b5b7b 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/LikeDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/LikeDescriptor.java
@@ -18,6 +18,7 @@
import edu.uci.ics.asterix.om.functions.IFunctionDescriptorFactory;
import edu.uci.ics.asterix.om.types.ATypeTag;
import edu.uci.ics.asterix.om.types.BuiltinType;
+import edu.uci.ics.asterix.om.types.EnumDeserializer;
import edu.uci.ics.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
@@ -99,7 +100,10 @@
return;
}
if (array0.getByteArray()[0] != SER_STRING_TYPE_TAG) {
- throw new AlgebricksException("Expects Types: String/Null, String/Null");
+ throw new AlgebricksException(AsterixBuiltinFunctions.LIKE
+ + ": expects input type STRING/NULL for the first argument but got "
+ + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(array0.getByteArray()[0])
+ + ".");
}
boolean newPattern = false;
if (first) {
@@ -129,7 +133,10 @@
return;
}
if (array0.getByteArray()[0] != SER_STRING_TYPE_TAG) {
- throw new AlgebricksException("Expects Types: String/Null, String/Null");
+ throw new AlgebricksException(AsterixBuiltinFunctions.LIKE
+ + ": expects input type (STRING/NULL, STRING/NULL) but got (STRING, "
+ + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(array0.getByteArray()[0])
+ + ").");
}
carSeq.reset(array0, 1);
if (newPattern) {
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/NotDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/NotDescriptor.java
index 41ec790..1553a1a 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/NotDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/NotDescriptor.java
@@ -53,7 +53,8 @@
private ArrayBackedValueStorage argOut = new ArrayBackedValueStorage();
private ICopyEvaluator eval = args[0].createEvaluator(argOut);
- private String errorMessage = "Not() can only be applied on boolean";
+ private String errorMessage = AsterixBuiltinFunctions.NOT.getName()
+ + ": expects input type BOOLEAN/NULL";
@SuppressWarnings("unchecked")
private ISerializerDeserializer<ABoolean> booleanSerde = AqlSerializerDeserializerProvider.INSTANCE
.getSerializerDeserializer(BuiltinType.ABOOLEAN);
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/NotNullDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/NotNullDescriptor.java
index 12e73f6..6c4126f 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/NotNullDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/NotNullDescriptor.java
@@ -57,7 +57,8 @@
private DataOutput out = output.getDataOutput();
private ArrayBackedValueStorage outInput = new ArrayBackedValueStorage();
private ICopyEvaluator eval = args[0].createEvaluator(outInput);
- private String errorMessage = "The input value cannot be null!";
+ private String errorMessage = AsterixBuiltinFunctions.NOT_NULL
+ + ": the input value cannot be NULL.";
@Override
public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/NumericAbsDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/NumericAbsDescriptor.java
index c013750..4ba5d40 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/NumericAbsDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/NumericAbsDescriptor.java
@@ -129,7 +129,8 @@
aDouble.setValue((val <= 0.0D) ? 0.0D - val : val);
serde.serialize(aDouble, out);
} else {
- throw new NotImplementedException("Numeric Abs is not implemented for "
+ throw new NotImplementedException(AsterixBuiltinFunctions.NUMERIC_ABS.getName()
+ + ": not implemented for "
+ EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut.getByteArray()[0]));
}
} catch (HyracksDataException e) {
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/NumericCeilingDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/NumericCeilingDescriptor.java
index 14d1f78..c5ae80b 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/NumericCeilingDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/NumericCeilingDescriptor.java
@@ -130,7 +130,8 @@
aDouble.setValue(Math.ceil(val));
serde.serialize(aDouble, out);
} else {
- throw new NotImplementedException("Numeric Ceiling is not implemented for "
+ throw new NotImplementedException(AsterixBuiltinFunctions.NUMERIC_CEILING.getName()
+ + ": not implemented for "
+ EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut.getByteArray()[0]));
}
} catch (HyracksDataException e) {
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/NumericFloorDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/NumericFloorDescriptor.java
index 99dd240..89deafd 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/NumericFloorDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/NumericFloorDescriptor.java
@@ -129,7 +129,7 @@
aDouble.setValue(Math.floor(val));
serde.serialize(aDouble, out);
} else {
- throw new NotImplementedException("Numeric Floor is not implemented for "
+ throw new NotImplementedException(AsterixBuiltinFunctions.NUMERIC_FLOOR.getName() + ": not implemented for "
+ EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut.getByteArray()[0]));
}
} catch (HyracksDataException e) {
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/NumericModuloDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/NumericModuloDescriptor.java
index b7fba62..3dff635 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/NumericModuloDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/NumericModuloDescriptor.java
@@ -142,8 +142,9 @@
return;
}
default: {
- throw new NotImplementedException(i == 0 ? "Left" : "Right"
- + " Operand of Modulo can not be "
+ throw new NotImplementedException(AsterixBuiltinFunctions.NUMERIC_MOD.getName()
+ + (i == 0 ? ": left" : ": right")
+ + " operand can not be "
+ EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut
.getByteArray()[0]));
}
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/NumericRoundDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/NumericRoundDescriptor.java
index bc565ce..505277e 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/NumericRoundDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/NumericRoundDescriptor.java
@@ -131,7 +131,8 @@
aDouble.setValue(val);
serde.serialize(aDouble, out);
} else {
- throw new NotImplementedException("Numeric Round is not implemented for "
+ throw new NotImplementedException(AsterixBuiltinFunctions.NUMERIC_ROUND.getName()
+ + ": not implemented for "
+ EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut.getByteArray()[0]));
}
} catch (HyracksDataException e) {
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/NumericRoundHalfToEven2Descriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/NumericRoundHalfToEven2Descriptor.java
index e205bf5..6613994 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/NumericRoundHalfToEven2Descriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/NumericRoundHalfToEven2Descriptor.java
@@ -99,8 +99,8 @@
} else if (argOut.getByteArray()[0] == serInt64TypeTag) {
return (int) AInt64SerializerDeserializer.getLong(argOut.getByteArray(), 1);
} else {
- throw new AlgebricksException(
- "The precision argument for round-half-to-even should be an integer.");
+ throw new AlgebricksException(AsterixBuiltinFunctions.NUMERIC_ROUND_HALF_TO_EVEN2.getName()
+ + ": the precision argument should be an INT8/INT16/INT32/INT64.");
}
}
@@ -166,8 +166,11 @@
serde.serialize(aDouble, out);
}
} else {
- throw new NotImplementedException("Numeric Round Half to Even is not implemented for "
- + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut.getByteArray()[0]));
+ throw new NotImplementedException(
+ AsterixBuiltinFunctions.NUMERIC_ROUND_HALF_TO_EVEN2.getName()
+ + ": not implemented for "
+ + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut
+ .getByteArray()[0]));
}
} catch (HyracksDataException e) {
throw new AlgebricksException(e);
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/NumericRoundHalfToEvenDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/NumericRoundHalfToEvenDescriptor.java
index 1b54090..69cd990 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/NumericRoundHalfToEvenDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/NumericRoundHalfToEvenDescriptor.java
@@ -130,8 +130,11 @@
aDouble.setValue(Math.rint(val));
serde.serialize(aDouble, out);
} else {
- throw new NotImplementedException("Numeric Round Half to Even is not implemented for "
- + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut.getByteArray()[0]));
+ throw new NotImplementedException(
+ AsterixBuiltinFunctions.NUMERIC_ROUND_HALF_TO_EVEN.getName()
+ + ": not implemented for "
+ + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut
+ .getByteArray()[0]));
}
} catch (HyracksDataException e) {
throw new AlgebricksException(e);
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/NumericSubtractDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/NumericSubtractDescriptor.java
index 7ce452e..ca68215 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/NumericSubtractDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/NumericSubtractDescriptor.java
@@ -125,10 +125,12 @@
return;
}
default: {
- throw new NotImplementedException(i == 0 ? "Left" : "Right"
- + " Operand of Substraction can not be "
- + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut
- .getByteArray()[0]));
+ throw new NotImplementedException(
+ AsterixBuiltinFunctions.NUMERIC_SUBTRACT.getName()
+ + (i == 0 ? ": left" : ": right")
+ + " operand can not be "
+ + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut
+ .getByteArray()[0]));
}
}
}
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/NumericUnaryMinusDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/NumericUnaryMinusDescriptor.java
index 6fec336..4192b6d 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/NumericUnaryMinusDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/NumericUnaryMinusDescriptor.java
@@ -114,7 +114,8 @@
aDouble.setValue(-ADoubleSerializerDeserializer.getDouble(argOut.getByteArray(), 1));
serde.serialize(aDouble, out);
} else {
- throw new NotImplementedException("Unary minus is not implemented for "
+ throw new NotImplementedException(AsterixBuiltinFunctions.NUMERIC_UNARY_MINUS.getName()
+ + ": not implemented for "
+ EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut.getByteArray()[0]));
}
} catch (HyracksDataException e) {
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/PrefixLenDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/PrefixLenDescriptor.java
index 5d0888e..10d8ff0 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/PrefixLenDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/PrefixLenDescriptor.java
@@ -12,6 +12,7 @@
import edu.uci.ics.asterix.om.functions.IFunctionDescriptorFactory;
import edu.uci.ics.asterix.om.types.ATypeTag;
import edu.uci.ics.asterix.om.types.BuiltinType;
+import edu.uci.ics.asterix.om.types.EnumDeserializer;
import edu.uci.ics.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
import edu.uci.ics.asterix.runtime.evaluators.common.SimilarityFiltersCache;
import edu.uci.ics.fuzzyjoin.similarity.SimilarityFilters;
@@ -28,13 +29,14 @@
public class PrefixLenDescriptor extends AbstractScalarFunctionDynamicDescriptor {
private static final long serialVersionUID = 1L;
-
+
// allowed input types
private final static byte SER_INT32_TYPE_TAG = ATypeTag.INT32.serialize();
private final static byte SER_DOUBLE_TYPE_TAG = ATypeTag.DOUBLE.serialize();
private final static byte SER_STRING_TYPE_TAG = ATypeTag.STRING.serialize();
-
- private final static FunctionIdentifier FID = new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "prefix-len@3", 3);
+
+ private final static FunctionIdentifier FID = new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "prefix-len@3",
+ 3);
public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
public IFunctionDescriptor createFunctionDescriptor() {
return new PrefixLenDescriptor();
@@ -71,16 +73,20 @@
// length
inputVal.reset();
evalLen.evaluate(tuple);
- if(inputVal.getByteArray()[0] != SER_INT32_TYPE_TAG){
- throw new AlgebricksException("Expects Int32 Type for the first argument of PrefixLen.");
+ if (inputVal.getByteArray()[0] != SER_INT32_TYPE_TAG) {
+ throw new AlgebricksException(FID.getName()
+ + ": expects type Int32 for the first argument, but got "
+ + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(inputVal.getByteArray()[0]));
}
int length = IntegerSerializerDeserializer.getInt(inputVal.getByteArray(), 1);
// similarity threshold
inputVal.reset();
evalThreshold.evaluate(tuple);
- if(inputVal.getByteArray()[0] != SER_DOUBLE_TYPE_TAG){
- throw new AlgebricksException("Expects Double Type for the second argument of PrefixLen.");
+ if (inputVal.getByteArray()[0] != SER_DOUBLE_TYPE_TAG) {
+ throw new AlgebricksException(FID.getName()
+ + ": expects type DOUBLE for the second argument, but got "
+ + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(inputVal.getByteArray()[0]));
}
float similarityThreshold = (float) ADoubleSerializerDeserializer.getDouble(
inputVal.getByteArray(), 1);
@@ -88,8 +94,10 @@
// similarity name
inputVal.reset();
evalSimilarity.evaluate(tuple);
- if(inputVal.getByteArray()[0] != SER_STRING_TYPE_TAG){
- throw new AlgebricksException("Expects String Type for the third argument of PrefixLen.");
+ if (inputVal.getByteArray()[0] != SER_STRING_TYPE_TAG) {
+ throw new AlgebricksException(FID.getName()
+ + ": expects type STRING for the third argument, but got "
+ + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(inputVal.getByteArray()[0]));
}
SimilarityFilters similarityFilters = similarityFiltersCache.get(similarityThreshold,
inputVal.getByteArray());
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/PrefixLenJaccardDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/PrefixLenJaccardDescriptor.java
index c6da64f..3e4a515 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/PrefixLenJaccardDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/PrefixLenJaccardDescriptor.java
@@ -12,6 +12,7 @@
import edu.uci.ics.asterix.om.functions.IFunctionDescriptorFactory;
import edu.uci.ics.asterix.om.types.ATypeTag;
import edu.uci.ics.asterix.om.types.BuiltinType;
+import edu.uci.ics.asterix.om.types.EnumDeserializer;
import edu.uci.ics.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
import edu.uci.ics.fuzzyjoin.similarity.SimilarityFiltersJaccard;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
@@ -68,16 +69,20 @@
// length
inputVal.reset();
evalLen.evaluate(tuple);
- if(inputVal.getByteArray()[0] != SER_INT32_TYPE_TAG){
- throw new AlgebricksException("Expects Int32 Type for the first argument of PrefixLenJaccard.");
+ if (inputVal.getByteArray()[0] != SER_INT32_TYPE_TAG) {
+ throw new AlgebricksException(AsterixBuiltinFunctions.PREFIX_LEN_JACCARD.getName()
+ + ": expects type Int32 the first argument but got "
+ + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(inputVal.getByteArray()[0]));
}
int length = IntegerSerializerDeserializer.getInt(inputVal.getByteArray(), 1);
// similarity threshold
inputVal.reset();
evalThreshold.evaluate(tuple);
- if(inputVal.getByteArray()[0] != SER_FLOAT_TYPE_TAG){
- throw new AlgebricksException("Expects Float Type for the second argument of PrefixLenJaccard.");
+ if (inputVal.getByteArray()[0] != SER_FLOAT_TYPE_TAG) {
+ throw new AlgebricksException(AsterixBuiltinFunctions.PREFIX_LEN_JACCARD.getName()
+ + ": expects type FLOAT the first argument but got "
+ + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(inputVal.getByteArray()[0]));
}
float similarityThreshold = (float) AFloatSerializerDeserializer.getFloat(
inputVal.getByteArray(), 1);
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/RegExpDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/RegExpDescriptor.java
index 2099a55..c91bcb2 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/RegExpDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/RegExpDescriptor.java
@@ -17,6 +17,7 @@
import edu.uci.ics.asterix.om.functions.IFunctionDescriptorFactory;
import edu.uci.ics.asterix.om.types.ATypeTag;
import edu.uci.ics.asterix.om.types.BuiltinType;
+import edu.uci.ics.asterix.om.types.EnumDeserializer;
import edu.uci.ics.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
@@ -38,11 +39,11 @@
public class RegExpDescriptor extends AbstractScalarFunctionDynamicDescriptor {
private static final long serialVersionUID = 1L;
-
+
// allowed input types
private final static byte SER_NULL_TYPE_TAG = ATypeTag.NULL.serialize();
private final static byte SER_STRING_TYPE_TAG = ATypeTag.STRING.serialize();
-
+
public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
public IFunctionDescriptor createFunctionDescriptor() {
return new RegExpDescriptor();
@@ -97,8 +98,10 @@
nullSerde.serialize(ANull.NULL, dout);
return;
}
- if(array0.getByteArray()[0] != SER_STRING_TYPE_TAG) {
- throw new AlgebricksException("Expects String/Null Type for RegExp function.");
+ if (array0.getByteArray()[0] != SER_STRING_TYPE_TAG) {
+ throw new AlgebricksException(AsterixBuiltinFunctions.REG_EXP.getName()
+ + ": expects type STRING/NULL for the first input argument but got "
+ + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(array0.getByteArray()[0]));
}
boolean newPattern = false;
if (first) {
@@ -127,8 +130,10 @@
nullSerde.serialize(ANull.NULL, dout);
return;
}
- if(array0.getByteArray()[0] != SER_STRING_TYPE_TAG) {
- throw new AlgebricksException("Expects String/Null Type for RegExp function.");
+ if (array0.getByteArray()[0] != SER_STRING_TYPE_TAG) {
+ throw new AlgebricksException(AsterixBuiltinFunctions.REG_EXP.getName()
+ + ": expects type STRING/NULL for the second input argument but got "
+ + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(array0.getByteArray()[0]));
}
carSeq.reset(array0, 1);
if (newPattern) {
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/SimilarityDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/SimilarityDescriptor.java
index 959b250..123e653 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/SimilarityDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/SimilarityDescriptor.java
@@ -35,14 +35,15 @@
public class SimilarityDescriptor extends AbstractScalarFunctionDynamicDescriptor {
private static final long serialVersionUID = 1L;
- private final static FunctionIdentifier FID = new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "similarity@7", 7);
+ private final static FunctionIdentifier FID = new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "similarity@7",
+ 7);
private final static byte SER_DOUBLE_TYPE_TAG = ATypeTag.DOUBLE.serialize();
private final static byte SER_STRING_TYPE_TAG = ATypeTag.STRING.serialize();
private final static byte SER_INT32_TYPE_TAG = ATypeTag.INT32.serialize();
private final static byte SER_ORDEREDLIST_TYPE_TAG = ATypeTag.ORDEREDLIST.serialize();
private final static byte SER_UNORDEREDLIST_TYPE_TAG = ATypeTag.UNORDEREDLIST.serialize();
-
+
public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
public IFunctionDescriptor createFunctionDescriptor() {
return new SimilarityDescriptor();
@@ -87,8 +88,10 @@
// similarity threshold
inputVal.reset();
evalThreshold.evaluate(tuple);
- if(inputVal.getByteArray()[0] != SER_DOUBLE_TYPE_TAG) {
- throw new AlgebricksException("Expects Double Type for the first argument of Similarity Function.");
+ if (inputVal.getByteArray()[0] != SER_DOUBLE_TYPE_TAG) {
+ throw new AlgebricksException(FID.getName()
+ + ": expects type DOUBLE for the first argument but got "
+ + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(inputVal.getByteArray()[0]));
}
float similarityThreshold = (float) ADoubleSerializerDeserializer.getDouble(
inputVal.getByteArray(), 1);
@@ -96,23 +99,29 @@
// similarity name
inputVal.reset();
evalSimilarity.evaluate(tuple);
- if(inputVal.getByteArray()[0] != SER_STRING_TYPE_TAG) {
- throw new AlgebricksException("Expects String Type for the second argument of Similarity Function.");
+ if (inputVal.getByteArray()[0] != SER_STRING_TYPE_TAG) {
+ throw new AlgebricksException(FID.getName()
+ + ": expects type STRING for the second argument but got "
+ + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(inputVal.getByteArray()[0]));
}
SimilarityFilters similarityFilters = similarityFiltersCache.get(similarityThreshold,
inputVal.getByteArray());
inputVal.reset();
evalLen1.evaluate(tuple);
- if(inputVal.getByteArray()[0] != SER_INT32_TYPE_TAG) {
- throw new AlgebricksException("Expects Int32 Type for the third argument of Similarity Function.");
+ if (inputVal.getByteArray()[0] != SER_INT32_TYPE_TAG) {
+ throw new AlgebricksException(FID.getName()
+ + ": expects type INT32 for the thrid argument but got "
+ + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(inputVal.getByteArray()[0]));
}
int length1 = IntegerSerializerDeserializer.getInt(inputVal.getByteArray(), 1);
inputVal.reset();
evalLen2.evaluate(tuple);
- if(inputVal.getByteArray()[0] != SER_INT32_TYPE_TAG) {
- throw new AlgebricksException("Expects Int32 Type for the fourth argument of Similarity Function.");
+ if (inputVal.getByteArray()[0] != SER_INT32_TYPE_TAG) {
+ throw new AlgebricksException(FID.getName()
+ + ": expects type INT32 for the fourth argument but got "
+ + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(inputVal.getByteArray()[0]));
}
int length2 = IntegerSerializerDeserializer.getInt(inputVal.getByteArray(), 1);
@@ -131,7 +140,7 @@
byte[] serList = inputVal.getByteArray();
if (serList[0] != SER_ORDEREDLIST_TYPE_TAG && serList[0] != SER_UNORDEREDLIST_TYPE_TAG) {
- throw new AlgebricksException("Scan collection is not defined for values of type"
+ throw new AlgebricksException(FID.getName() + ": not defined for values of type"
+ EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(serList[0]));
}
@@ -175,7 +184,7 @@
serList = inputVal.getByteArray();
if (serList[0] != SER_ORDEREDLIST_TYPE_TAG && serList[0] != SER_UNORDEREDLIST_TYPE_TAG) {
- throw new AlgebricksException("Scan collection is not defined for values of type"
+ throw new AlgebricksException(FID.getName() + ": not defined for values of type"
+ EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(serList[0]));
}
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/SpatialAreaDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/SpatialAreaDescriptor.java
index d887894..15e4b40 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/SpatialAreaDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/SpatialAreaDescriptor.java
@@ -70,7 +70,8 @@
int numOfPoints = AInt16SerializerDeserializer.getShort(argOut.getByteArray(), 1);
if (numOfPoints < 3) {
- throw new AlgebricksException("Polygon must have at least 3 points");
+ throw new AlgebricksException(AsterixBuiltinFunctions.SPATIAL_AREA.getName()
+ + ": polygon must have at least 3 points");
}
area = Math.abs(SpatialUtils.polygonArea(argOut.getByteArray(), numOfPoints));
out.writeByte(ATypeTag.DOUBLE.serialize());
@@ -105,8 +106,9 @@
nullSerde.serialize(ANull.NULL, out);
break;
default:
- throw new NotImplementedException("spatial-area does not support the type: " + tag
- + " It is only implemented for POLYGON, CIRCLE and RECTANGLE.");
+ throw new NotImplementedException(AsterixBuiltinFunctions.SPATIAL_AREA.getName()
+ + ": does not support the type: " + tag
+ + "; it is only implemented for POLYGON, CIRCLE and RECTANGLE.");
}
} catch (HyracksDataException hde) {
throw new AlgebricksException(hde);
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/SpatialCellDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/SpatialCellDescriptor.java
index 6583f19..9b8d1a4 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/SpatialCellDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/SpatialCellDescriptor.java
@@ -103,8 +103,8 @@
} else if (tag == ATypeTag.NULL) {
nullSerde.serialize(ANull.NULL, out);
} else {
- throw new NotImplementedException("spatial-cell does not support the type: " + tag
- + " It is only implemented for POINT.");
+ throw new NotImplementedException(AsterixBuiltinFunctions.SPATIAL_CELL.getName()
+ + ": does not support the type: " + tag + "; it is only implemented for POINT.");
}
} catch (IOException e1) {
throw new AlgebricksException(e1);
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/SpatialDistanceDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/SpatialDistanceDescriptor.java
index 688a72c..c1b965d 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/SpatialDistanceDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/SpatialDistanceDescriptor.java
@@ -79,14 +79,17 @@
APointSerializerDeserializer.getCoordinateOffset(Coordinate.Y));
distance = Math.sqrt(Math.pow(x2 - x1, 2) + Math.pow(y2 - y1, 2));
} else {
- throw new NotImplementedException("spatial-distance does not support the type: "
- + tag1 + " It is only implemented for POINT.");
+ throw new NotImplementedException(
+ AsterixBuiltinFunctions.SPATIAL_DISTANCE.getName()
+ + ": does not support the type: " + tag1
+ + "; it is only implemented for POINT.");
}
} else if (tag0 == ATypeTag.NULL || tag1 == ATypeTag.NULL) {
nullSerde.serialize(ANull.NULL, out);
} else {
- throw new NotImplementedException("spatial-distance does not support the type: " + tag0
- + " It is only implemented for POINT.");
+ throw new NotImplementedException(AsterixBuiltinFunctions.SPATIAL_DISTANCE.getName()
+ + ": does not support the type: " + tag1
+ + "; it is only implemented for POINT.");
}
out.writeByte(ATypeTag.DOUBLE.serialize());
out.writeDouble(distance);
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/SpatialIntersectDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/SpatialIntersectDescriptor.java
index 7b10ed3d8..55acc01 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/SpatialIntersectDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/SpatialIntersectDescriptor.java
@@ -36,7 +36,7 @@
public class SpatialIntersectDescriptor extends AbstractScalarFunctionDynamicDescriptor {
private static final long serialVersionUID = 1L;
-
+
public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
public IFunctionDescriptor createFunctionDescriptor() {
return new SpatialIntersectDescriptor();
@@ -68,7 +68,7 @@
private final DoubleArray trianglesY1 = new DoubleArray();
private boolean pointOnLine(byte[] bytes0, byte[] bytes1) throws HyracksDataException {
-
+
double startX = ADoubleSerializerDeserializer.getDouble(bytes0,
ALineSerializerDeserializer.getStartPointCoordinateOffset(Coordinate.X));
double startY = ADoubleSerializerDeserializer.getDouble(bytes0,
@@ -114,7 +114,8 @@
APolygonSerializerDeserializer.getNumberOfPointsOffset());
if (numOfPoints1 < 3) {
- throw new HyracksDataException("Polygon must have at least 3 points.");
+ throw new HyracksDataException(AsterixBuiltinFunctions.SPATIAL_INTERSECT.getName()
+ + ": polygon must have at least 3 points.");
}
int counter = 0;
@@ -220,7 +221,8 @@
APolygonSerializerDeserializer.getNumberOfPointsOffset());
if (numOfPoints1 < 3) {
- throw new HyracksDataException("Polygon must have at least 3 points.");
+ throw new HyracksDataException(AsterixBuiltinFunctions.SPATIAL_INTERSECT.getName()
+ + ": polygon must have at least 3 points.");
}
for (int i = 0; i < numOfPoints1; i++) {
double startX2 = ADoubleSerializerDeserializer.getDouble(bytes1,
@@ -371,7 +373,8 @@
int v = middleVertex;
while (!foundEar) {
if (0 >= (nonSimplePolygonDetection--)) {
- throw new NotImplementedException("Non-simple polygons are not supported.");
+ throw new HyracksDataException(AsterixBuiltinFunctions.SPATIAL_INTERSECT.getName()
+ + ": non-simple polygons are not supported.");
}
int u = v;
if (numOfPoints <= u) {
@@ -660,7 +663,8 @@
APolygonSerializerDeserializer.getNumberOfPointsOffset());
if (numOfPoints1 < 3) {
- throw new AlgebricksException("Polygon must have at least 3 points.");
+ throw new HyracksDataException(AsterixBuiltinFunctions.SPATIAL_INTERSECT.getName()
+ + ": polygon must have at least 3 points.");
}
getCounterClockWisePolygon(bytes1, pointsOffsets1, numOfPoints1);
@@ -711,7 +715,8 @@
APolygonSerializerDeserializer.getNumberOfPointsOffset());
if (numOfPoints < 3) {
- throw new AlgebricksException("Polygon must have at least 3 points.");
+ throw new HyracksDataException(AsterixBuiltinFunctions.SPATIAL_INTERSECT.getName()
+ + ": polygon must have at least 3 points.");
}
getCounterClockWisePolygon(bytes0, pointsOffsets0, numOfPoints);
@@ -790,9 +795,10 @@
break;
default:
throw new NotImplementedException(
- "spatial-intersection does not support the type: "
+ AsterixBuiltinFunctions.SPATIAL_INTERSECT.getName()
+ + ": does not support the type: "
+ tag1
- + " It is only implemented for POINT, ALINE, POLYGON, and CIRCLE.");
+ + "; it is only implemented for POINT, ALINE, POLYGON, and CIRCLE.");
}
break;
case LINE:
@@ -846,9 +852,10 @@
break;
default:
throw new NotImplementedException(
- "spatial-intersection does not support the type: "
+ AsterixBuiltinFunctions.SPATIAL_INTERSECT.getName()
+ + ": does not support the type: "
+ tag1
- + " It is only implemented for POINT, ALINE, POLYGON, and CIRCLE.");
+ + "; it is only implemented for POINT, ALINE, POLYGON, and CIRCLE.");
}
break;
case POLYGON:
@@ -947,9 +954,10 @@
break;
default:
throw new NotImplementedException(
- "spatial-intersection does not support the type: "
+ AsterixBuiltinFunctions.SPATIAL_INTERSECT.getName()
+ + ": does not support the type: "
+ tag1
- + " It is only implemented for POINT, ALINE, POLYGON, and CIRCLE.");
+ + "; it is only implemented for POINT, ALINE, POLYGON, and CIRCLE.");
}
break;
case CIRCLE:
@@ -978,9 +986,10 @@
break;
default:
throw new NotImplementedException(
- "spatial-intersection does not support the type: "
+ AsterixBuiltinFunctions.SPATIAL_INTERSECT.getName()
+ + ": does not support the type: "
+ tag1
- + " It is only implemented for POINT, ALINE, POLYGON, and CIRCLE.");
+ + "; it is only implemented for POINT, ALINE, POLYGON, and CIRCLE.");
}
break;
case RECTANGLE:
@@ -1032,9 +1041,10 @@
break;
default:
throw new NotImplementedException(
- "spatial-intersection does not support the type: "
+ AsterixBuiltinFunctions.SPATIAL_INTERSECT.getName()
+ + ": does not support the type: "
+ tag1
- + " It is only implemented for POINT, ALINE, POLYGON, and CIRCLE.");
+ + "; it is only implemented for POINT, ALINE, POLYGON, and CIRCLE.");
}
break;
case NULL:
@@ -1042,8 +1052,9 @@
break;
default:
throw new NotImplementedException(
- "spatial-intersection does not support the type: " + tag0
- + " It is only implemented for POINT, ALINE, POLYGON, and CIRCLE.");
+ AsterixBuiltinFunctions.SPATIAL_INTERSECT.getName()
+ + ": does not support the type: " + tag1
+ + "; it is only implemented for POINT, ALINE, POLYGON, and CIRCLE.");
}
ABoolean aResult = res ? (ABoolean.TRUE) : (ABoolean.FALSE);
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/StartsWithDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/StartsWithDescriptor.java
index 4ac02cf..9358030 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/StartsWithDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/StartsWithDescriptor.java
@@ -33,7 +33,7 @@
DataOutput dout = output.getDataOutput();
- return new AbstractStringContainsEval(dout, args[0], args[1]) {
+ return new AbstractStringContainsEval(dout, args[0], args[1], AsterixBuiltinFunctions.STARTS_WITH) {
@Override
protected boolean findMatch(byte[] strBytes, byte[] patternBytes) {
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/StringConcatDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/StringConcatDescriptor.java
index f53ebe8..bcd199c 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/StringConcatDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/StringConcatDescriptor.java
@@ -11,6 +11,7 @@
import edu.uci.ics.asterix.om.functions.IFunctionDescriptorFactory;
import edu.uci.ics.asterix.om.types.ATypeTag;
import edu.uci.ics.asterix.om.types.BuiltinType;
+import edu.uci.ics.asterix.om.types.EnumDeserializer;
import edu.uci.ics.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
import edu.uci.ics.asterix.runtime.evaluators.common.AsterixListAccessor;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
@@ -30,6 +31,10 @@
public class StringConcatDescriptor extends AbstractScalarFunctionDynamicDescriptor {
private static final long serialVersionUID = 1L;
+
+ private static final byte SER_ORDEREDLIST_TYPE_TAG = ATypeTag.ORDEREDLIST.serialize();
+ private static final byte SER_UNORDEREDLIST_TYPE_TAG = ATypeTag.UNORDEREDLIST.serialize();
+
public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
public IFunctionDescriptor createFunctionDescriptor() {
return new StringConcatDescriptor();
@@ -61,6 +66,11 @@
outInputList.reset();
evalList.evaluate(tuple);
byte[] listBytes = outInputList.getByteArray();
+ if (listBytes[0] != SER_ORDEREDLIST_TYPE_TAG && listBytes[0] != SER_UNORDEREDLIST_TYPE_TAG) {
+ throw new AlgebricksException(AsterixBuiltinFunctions.STRING_CONCAT.getName()
+ + ": expects input type ORDEREDLIST/UNORDEREDLIST, but got "
+ + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(listBytes[0]));
+ }
try {
listAccessor.reset(listBytes, 0);
} catch (AsterixException e) {
@@ -77,8 +87,8 @@
nullSerde.serialize(ANull.NULL, out);
return;
}
- throw new AlgebricksException("Unsupported type " + itemType
- + " in list passed to string-concat function.");
+ throw new AlgebricksException(AsterixBuiltinFunctions.STRING_CONCAT.getName()
+ + ": expects type STRING/NULL for the list item but got " + itemType);
}
utf8Len += UTF8StringPointable.getUTFLength(listBytes, itemOffset);
}
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/StringEndWithDescrtiptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/StringEndWithDescrtiptor.java
index aed2199..6d0eaad 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/StringEndWithDescrtiptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/StringEndWithDescrtiptor.java
@@ -41,7 +41,7 @@
DataOutput dout = output.getDataOutput();
- return new AbstractBinaryStringBoolEval(dout, args[0], args[1]) {
+ return new AbstractBinaryStringBoolEval(dout, args[0], args[1], AsterixBuiltinFunctions.STRING_END_WITH) {
@Override
protected boolean compute(byte[] lBytes, int lLen, int lStart, byte[] rBytes, int rLen, int rStart,
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/StringEqualDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/StringEqualDescriptor.java
index f71b09f..e921e45 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/StringEqualDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/StringEqualDescriptor.java
@@ -37,7 +37,7 @@
DataOutput dout = output.getDataOutput();
- return new AbstractBinaryStringBoolEval(dout, args[0], args[1]) {
+ return new AbstractBinaryStringBoolEval(dout, args[0], args[1], AsterixBuiltinFunctions.STRING_EQUAL) {
@Override
protected boolean compute(byte[] lBytes, int lLen, int lStart, byte[] rBytes, int rLen, int rStart,
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/StringJoinDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/StringJoinDescriptor.java
index 67334ce..9c2f960 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/StringJoinDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/StringJoinDescriptor.java
@@ -64,13 +64,16 @@
outInputSep.reset();
evalSep.evaluate(tuple);
byte[] serSep = outInputSep.getByteArray();
- if (serOrderedList[0] != SER_ORDEREDLIST_TYPE_TAG) {
- throw new AlgebricksException("Expects String List but got "
+ if (serOrderedList[0] != SER_ORDEREDLIST_TYPE_TAG
+ && serOrderedList[1] != SER_STRING_TYPE_TAG) {
+ throw new AlgebricksException(AsterixBuiltinFunctions.STRING_JOIN.getName()
+ + ": expects input type ORDEREDLIST but got "
+ EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(serOrderedList[0]));
}
if (serSep[0] != SER_STRING_TYPE_TAG) {
- throw new AlgebricksException("Expects String as Seperator but got "
+ throw new AlgebricksException(AsterixBuiltinFunctions.STRING_JOIN.getName()
+ + ": expects STRING type for the seperator but got "
+ EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(serSep[0]));
}
@@ -83,6 +86,7 @@
for (int i = 0; i < size; i++) {
int itemOffset = AOrderedListSerializerDeserializer
.getItemOffset(serOrderedList, i);
+
int currentSize = UTF8StringPointable.getUTFLength(serOrderedList, itemOffset);
if (i != size - 1 && currentSize != 0) {
utf_8_len += sep_len;
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/StringLengthDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/StringLengthDescriptor.java
index bb39b49..a81d53d 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/StringLengthDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/StringLengthDescriptor.java
@@ -12,6 +12,7 @@
import edu.uci.ics.asterix.om.functions.IFunctionDescriptorFactory;
import edu.uci.ics.asterix.om.types.ATypeTag;
import edu.uci.ics.asterix.om.types.BuiltinType;
+import edu.uci.ics.asterix.om.types.EnumDeserializer;
import edu.uci.ics.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
@@ -46,7 +47,6 @@
private DataOutput out = output.getDataOutput();
private ArrayBackedValueStorage outInput = new ArrayBackedValueStorage();
private ICopyEvaluator eval = args[0].createEvaluator(outInput);
- private String errorMessage = "This can not be an instance of string";
@SuppressWarnings("unchecked")
private ISerializerDeserializer<ANull> nullSerde = AqlSerializerDeserializerProvider.INSTANCE
.getSerializerDeserializer(BuiltinType.ANULL);
@@ -68,10 +68,12 @@
} else if (serString[0] == SER_NULL_TYPE_TAG)
nullSerde.serialize(ANull.NULL, out);
else {
- throw new AlgebricksException(errorMessage);
+ throw new AlgebricksException(AsterixBuiltinFunctions.STRING_LENGTH.getName()
+ + ": expects input type STRING/NULL but got "
+ + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(serString[0]));
}
} catch (IOException e1) {
- throw new AlgebricksException(errorMessage);
+ throw new AlgebricksException(e1);
}
}
};
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/StringLowerCaseDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/StringLowerCaseDescriptor.java
index 4aaf8aa..5e188d3 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/StringLowerCaseDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/StringLowerCaseDescriptor.java
@@ -10,6 +10,7 @@
import edu.uci.ics.asterix.om.functions.IFunctionDescriptorFactory;
import edu.uci.ics.asterix.om.types.ATypeTag;
import edu.uci.ics.asterix.om.types.BuiltinType;
+import edu.uci.ics.asterix.om.types.EnumDeserializer;
import edu.uci.ics.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
@@ -48,7 +49,7 @@
private DataOutput out = output.getDataOutput();
private ArrayBackedValueStorage outInput = new ArrayBackedValueStorage();
private ICopyEvaluator eval = args[0].createEvaluator(outInput);
- private String errorMessage = "This is not an instance of string";
+
private final byte stt = ATypeTag.STRING.serialize();
@SuppressWarnings("unchecked")
@@ -80,9 +81,11 @@
} else if (serString[0] == SER_NULL_TYPE_TAG)
nullSerde.serialize(ANull.NULL, out);
else
- throw new AlgebricksException(errorMessage);
+ throw new AlgebricksException(AsterixBuiltinFunctions.STRING_LOWERCASE.getName()
+ + ": expects input type STRING/NULL but got "
+ + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(serString[0]));
} catch (IOException e1) {
- throw new AlgebricksException(errorMessage);
+ throw new AlgebricksException(e1);
}
}
};
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/StringMatchesDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/StringMatchesDescriptor.java
index 75814df..03a3545 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/StringMatchesDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/StringMatchesDescriptor.java
@@ -49,7 +49,7 @@
DataOutput dout = output.getDataOutput();
- return new AbstractBinaryStringBoolEval(dout, args[0], args[1]) {
+ return new AbstractBinaryStringBoolEval(dout, args[0], args[1], AsterixBuiltinFunctions.STRING_MATCHES) {
private Pattern pattern = null;
private Matcher matcher = null;
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/StringMatchesWithFlagDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/StringMatchesWithFlagDescriptor.java
index 31dde5b..93dc342 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/StringMatchesWithFlagDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/StringMatchesWithFlagDescriptor.java
@@ -54,7 +54,8 @@
DataOutput dout = output.getDataOutput();
- return new AbstractTripleStringBoolEval(dout, args[0], args[1], args[2]) {
+ return new AbstractTripleStringBoolEval(dout, args[0], args[1], args[2],
+ AsterixBuiltinFunctions.STRING_MATCHES_WITH_FLAG) {
private Pattern pattern = null;
private Matcher matcher = null;
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/StringReplaceDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/StringReplaceDescriptor.java
index 3350048..230eb34 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/StringReplaceDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/StringReplaceDescriptor.java
@@ -50,7 +50,8 @@
DataOutput dout = output.getDataOutput();
- return new AbstractTripleStringStringEval(dout, args[0], args[1], args[2]) {
+ return new AbstractTripleStringStringEval(dout, args[0], args[1], args[2],
+ AsterixBuiltinFunctions.STRING_REPLACE) {
private Pattern pattern = null;
private Matcher matcher = null;
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/StringReplaceWithFlagsDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/StringReplaceWithFlagsDescriptor.java
index e665654..4f18863 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/StringReplaceWithFlagsDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/StringReplaceWithFlagsDescriptor.java
@@ -50,7 +50,8 @@
DataOutput dout = output.getDataOutput();
- return new AbstractQuadStringStringEval(dout, args[0], args[1], args[2], args[3]) {
+ return new AbstractQuadStringStringEval(dout, args[0], args[1], args[2], args[3],
+ AsterixBuiltinFunctions.STRING_REPLACE_WITH_FLAG) {
private Pattern pattern = null;
private Matcher matcher = null;
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/StringStartWithDescrtiptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/StringStartWithDescrtiptor.java
index e7f2576..601c3d0 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/StringStartWithDescrtiptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/StringStartWithDescrtiptor.java
@@ -37,7 +37,8 @@
DataOutput dout = output.getDataOutput();
- return new AbstractBinaryStringBoolEval(dout, args[0], args[1]) {
+ return new AbstractBinaryStringBoolEval(dout, args[0], args[1],
+ AsterixBuiltinFunctions.STRING_START_WITH) {
@Override
protected boolean compute(byte[] lBytes, int lLen, int lStart, byte[] rBytes, int rLen, int rStart,
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/StringToCodePointDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/StringToCodePointDescriptor.java
index 3d845e1..e001d9e 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/StringToCodePointDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/StringToCodePointDescriptor.java
@@ -13,6 +13,7 @@
import edu.uci.ics.asterix.om.types.AOrderedListType;
import edu.uci.ics.asterix.om.types.ATypeTag;
import edu.uci.ics.asterix.om.types.BuiltinType;
+import edu.uci.ics.asterix.om.types.EnumDeserializer;
import edu.uci.ics.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
@@ -119,7 +120,9 @@
}
listBuilder.write(out, true);
} else
- throw new AlgebricksException("Expects String Type.");
+ throw new AlgebricksException(AsterixBuiltinFunctions.STRING_TO_CODEPOINT.getName()
+ + ": expects input type STRING but got "
+ + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(serString[0]));
} catch (IOException e1) {
throw new AlgebricksException(e1.getMessage());
}
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/Substring2Descriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/Substring2Descriptor.java
index 3d71f50..5a84401 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/Substring2Descriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/Substring2Descriptor.java
@@ -7,6 +7,7 @@
import edu.uci.ics.asterix.om.functions.IFunctionDescriptor;
import edu.uci.ics.asterix.om.functions.IFunctionDescriptorFactory;
import edu.uci.ics.asterix.om.types.ATypeTag;
+import edu.uci.ics.asterix.om.types.EnumDeserializer;
import edu.uci.ics.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
@@ -21,11 +22,11 @@
public class Substring2Descriptor extends AbstractScalarFunctionDynamicDescriptor {
private static final long serialVersionUID = 1L;
-
+
// allowed input types
private static final byte SER_INT32_TYPE_TAG = ATypeTag.INT32.serialize();
private static final byte SER_STRING_TYPE_TAG = ATypeTag.STRING.serialize();
-
+
public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
public IFunctionDescriptor createFunctionDescriptor() {
return new Substring2Descriptor();
@@ -51,16 +52,20 @@
public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
argOut.reset();
evalStart.evaluate(tuple);
- if(argOut.getByteArray()[0] != SER_INT32_TYPE_TAG){
- throw new AlgebricksException("Expects Int32 Type for the first argument of Substring.");
+ if (argOut.getByteArray()[0] != SER_INT32_TYPE_TAG) {
+ throw new AlgebricksException(AsterixBuiltinFunctions.SUBSTRING2.getName()
+ + ": expects type INT32 for the second argument but got "
+ + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut.getByteArray()[0]));
}
int start = IntegerSerializerDeserializer.getInt(argOut.getByteArray(), 1) - 1;
argOut.reset();
evalString.evaluate(tuple);
byte[] bytes = argOut.getByteArray();
- if(bytes[0] != SER_STRING_TYPE_TAG){
- throw new AlgebricksException("Expects String Type for the second argument of Substring.");
+ if (bytes[0] != SER_STRING_TYPE_TAG) {
+ throw new AlgebricksException(AsterixBuiltinFunctions.SUBSTRING2.getName()
+ + ": expects type STRING for the first argument but got "
+ + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut.getByteArray()[0]));
}
int utflen = UTF8StringPointable.getUTFLength(bytes, 1);
int sStart = 3;
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/SubstringAfterDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/SubstringAfterDescriptor.java
index 2d45d3c..7584e4d 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/SubstringAfterDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/SubstringAfterDescriptor.java
@@ -7,6 +7,7 @@
import edu.uci.ics.asterix.om.functions.IFunctionDescriptor;
import edu.uci.ics.asterix.om.functions.IFunctionDescriptorFactory;
import edu.uci.ics.asterix.om.types.ATypeTag;
+import edu.uci.ics.asterix.om.types.EnumDeserializer;
import edu.uci.ics.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
@@ -59,8 +60,10 @@
if ((src[0] != SER_STRING_TYPE_TAG && src[0] != SER_NULL_TYPE_TAG)
|| (pattern[0] != SER_STRING_TYPE_TAG && pattern[0] != SER_NULL_TYPE_TAG)) {
- throw new AlgebricksException(
- "Expects Types: (String, String) for substring-after function. ");
+ throw new AlgebricksException(AsterixBuiltinFunctions.SUBSTRING_AFTER.getName()
+ + ": expects input type (STRING/NULL, STRING/NULL) but got ("
+ + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(src[0]) + ", "
+ + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(pattern[0]) + ").");
}
int srcLen = UTF8StringPointable.getUTFLength(src, 1);
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/SubstringBeforeDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/SubstringBeforeDescriptor.java
index 6c42ed1..77911af 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/SubstringBeforeDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/SubstringBeforeDescriptor.java
@@ -7,6 +7,7 @@
import edu.uci.ics.asterix.om.functions.IFunctionDescriptor;
import edu.uci.ics.asterix.om.functions.IFunctionDescriptorFactory;
import edu.uci.ics.asterix.om.types.ATypeTag;
+import edu.uci.ics.asterix.om.types.EnumDeserializer;
import edu.uci.ics.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
@@ -59,8 +60,10 @@
if ((src[0] != SER_STRING_TYPE_TAG && src[0] != SER_NULL_TYPE_TAG)
|| (pattern[0] != SER_STRING_TYPE_TAG && pattern[0] != SER_NULL_TYPE_TAG)) {
- throw new AlgebricksException(
- "Expects Types: (String, String) for substring-before function. ");
+ throw new AlgebricksException(AsterixBuiltinFunctions.SUBSTRING_BEFORE.getName()
+ + ": expects input type (STRING/NULL, STRING/NULL) but got ("
+ + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(src[0]) + ", "
+ + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(pattern[0]) + ").");
}
int srcLen = UTF8StringPointable.getUTFLength(src, 1);
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/SubstringDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/SubstringDescriptor.java
index 681b401..77741fb 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/SubstringDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/SubstringDescriptor.java
@@ -7,6 +7,7 @@
import edu.uci.ics.asterix.om.functions.IFunctionDescriptor;
import edu.uci.ics.asterix.om.functions.IFunctionDescriptorFactory;
import edu.uci.ics.asterix.om.types.ATypeTag;
+import edu.uci.ics.asterix.om.types.EnumDeserializer;
import edu.uci.ics.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
@@ -53,15 +54,17 @@
argOut.reset();
evalStart.evaluate(tuple);
if (argOut.getByteArray()[0] != SER_INT32_TYPE_TAG) {
- throw new AlgebricksException(
- "Expects Types (String, Int32, Int32) for substring function. ");
+ throw new AlgebricksException(AsterixBuiltinFunctions.SUBSTRING.getName()
+ + ": expects type INT32 for the second argument but got "
+ + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut.getByteArray()[0]));
}
int start = IntegerSerializerDeserializer.getInt(argOut.getByteArray(), 1) - 1;
argOut.reset();
evalLen.evaluate(tuple);
if (argOut.getByteArray()[0] != SER_INT32_TYPE_TAG) {
- throw new AlgebricksException(
- "Expects Types (String, Int32, Int32) for substring function. ");
+ throw new AlgebricksException(AsterixBuiltinFunctions.SUBSTRING.getName()
+ + ": expects type INT32 for the third argument but got "
+ + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut.getByteArray()[0]));
}
int len = IntegerSerializerDeserializer.getInt(argOut.getByteArray(), 1);
@@ -71,8 +74,9 @@
byte[] bytes = argOut.getByteArray();
if (bytes[0] != SER_STRING_TYPE_TAG) {
- throw new AlgebricksException(
- "Expects Types (String, Int32, Int32) for substring function. ");
+ throw new AlgebricksException(AsterixBuiltinFunctions.SUBSTRING.getName()
+ + ": expects type STRING for the first argument but got "
+ + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut.getByteArray()[0]));
}
int utflen = UTF8StringPointable.getUTFLength(bytes, 1);
int sStart = 3;
@@ -91,8 +95,9 @@
}
if (idxPos2 < len) {
- throw new AlgebricksException("substring: start=" + start + "\tlen=" + len
- + "\tgoing past the input length=" + (idxPos1 + idxPos2) + ".");
+ throw new AlgebricksException(AsterixBuiltinFunctions.SUBSTRING.getName() + ": start="
+ + start + "\tlen=" + len + "\tgoing past the input length=" + (idxPos1 + idxPos2)
+ + ".");
}
int substrByteLen = c - startSubstr;
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/AbstractIntervalLogicFuncDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/AbstractIntervalLogicFuncDescriptor.java
index 241e2e0..e2286fc 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/AbstractIntervalLogicFuncDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/AbstractIntervalLogicFuncDescriptor.java
@@ -22,6 +22,7 @@
import edu.uci.ics.asterix.om.base.ANull;
import edu.uci.ics.asterix.om.types.ATypeTag;
import edu.uci.ics.asterix.om.types.BuiltinType;
+import edu.uci.ics.asterix.om.types.EnumDeserializer;
import edu.uci.ics.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluator;
@@ -84,14 +85,18 @@
if (argOut0.getByteArray()[0] != SER_INTERVAL_TYPE_TAG
|| argOut1.getByteArray()[0] != SER_INTERVAL_TYPE_TAG) {
- throw new AlgebricksException("Inapplicable input type for parameters: ("
- + argOut0.getByteArray()[0] + ", " + argOut1.getByteArray()[0] + ")");
+ throw new AlgebricksException(getIdentifier().getName()
+ + ": expects input type (INTERVAL, INTERVAL) but got ("
+ + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut0.getByteArray()[0])
+ + ", "
+ + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut1.getByteArray()[0])
+ + ")");
}
if (AIntervalSerializerDeserializer.getIntervalTimeType(argOut0.getByteArray(), 1) != AIntervalSerializerDeserializer
.getIntervalTimeType(argOut1.getByteArray(), 1)) {
- throw new AlgebricksException(
- "Failed to compare to intervals with different internal time type.");
+ throw new AlgebricksException(getIdentifier().getName()
+ + ": failed to compare intervals with different internal time type.");
}
ABoolean res = (compareIntervals(
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/AddDateDurationDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/AddDateDurationDescriptor.java
index 7417f2b..a9f66a2 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/AddDateDurationDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/AddDateDurationDescriptor.java
@@ -16,7 +16,6 @@
import java.io.DataOutput;
-import edu.uci.ics.asterix.common.functions.FunctionConstants;
import edu.uci.ics.asterix.dataflow.data.nontagged.serde.ADateSerializerDeserializer;
import edu.uci.ics.asterix.dataflow.data.nontagged.serde.ADurationSerializerDeserializer;
import edu.uci.ics.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
@@ -25,10 +24,12 @@
import edu.uci.ics.asterix.om.base.ANull;
import edu.uci.ics.asterix.om.base.temporal.DurationArithmeticOperations;
import edu.uci.ics.asterix.om.base.temporal.GregorianCalendarSystem;
+import edu.uci.ics.asterix.om.functions.AsterixBuiltinFunctions;
import edu.uci.ics.asterix.om.functions.IFunctionDescriptor;
import edu.uci.ics.asterix.om.functions.IFunctionDescriptorFactory;
import edu.uci.ics.asterix.om.types.ATypeTag;
import edu.uci.ics.asterix.om.types.BuiltinType;
+import edu.uci.ics.asterix.om.types.EnumDeserializer;
import edu.uci.ics.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
@@ -43,8 +44,7 @@
public class AddDateDurationDescriptor extends AbstractScalarFunctionDynamicDescriptor {
private final static long serialVersionUID = 1L;
- public final static FunctionIdentifier FID = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
- "add-date-duration", 2);
+ public final static FunctionIdentifier FID = AsterixBuiltinFunctions.ADD_DATE_DURATION;
// allowed input types
private final static byte SER_NULL_TYPE_TAG = ATypeTag.NULL.serialize();
@@ -100,17 +100,15 @@
}
if (argOut0.getByteArray()[0] != SER_DATE_TYPE_TAG) {
- throw new AlgebricksException(
- "Inapplicable input type for parameter 0: expecting a Date ("
- + SER_DATE_TYPE_TAG + ") or null (" + SER_NULL_TYPE_TAG
- + "), but got: " + argOut0.getByteArray()[0]);
+ throw new AlgebricksException(FID.getName()
+ + ": expects type DATE/NULL for parameter 0 but got "
+ + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut0.getByteArray()[0]));
}
if (argOut1.getByteArray()[0] != SER_DURATION_TYPE_TAG) {
- throw new AlgebricksException(
- "Inapplicable input type for parameter 1: expecting a Duration ("
- + SER_DURATION_TYPE_TAG + ") or null (" + SER_NULL_TYPE_TAG
- + "), but got: " + argOut1.getByteArray()[0]);
+ throw new AlgebricksException(FID.getName()
+ + ": expects type DURATION/NULL for parameter 1 but got "
+ + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut1.getByteArray()[0]));
}
// get duration fields: yearMonth field and dayTime field
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/AddDatetimeDurationDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/AddDatetimeDurationDescriptor.java
index 4f04da3..ca27455 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/AddDatetimeDurationDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/AddDatetimeDurationDescriptor.java
@@ -16,7 +16,6 @@
import java.io.DataOutput;
-import edu.uci.ics.asterix.common.functions.FunctionConstants;
import edu.uci.ics.asterix.dataflow.data.nontagged.serde.ADateTimeSerializerDeserializer;
import edu.uci.ics.asterix.dataflow.data.nontagged.serde.ADurationSerializerDeserializer;
import edu.uci.ics.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
@@ -24,10 +23,12 @@
import edu.uci.ics.asterix.om.base.AMutableDateTime;
import edu.uci.ics.asterix.om.base.ANull;
import edu.uci.ics.asterix.om.base.temporal.DurationArithmeticOperations;
+import edu.uci.ics.asterix.om.functions.AsterixBuiltinFunctions;
import edu.uci.ics.asterix.om.functions.IFunctionDescriptor;
import edu.uci.ics.asterix.om.functions.IFunctionDescriptorFactory;
import edu.uci.ics.asterix.om.types.ATypeTag;
import edu.uci.ics.asterix.om.types.BuiltinType;
+import edu.uci.ics.asterix.om.types.EnumDeserializer;
import edu.uci.ics.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
@@ -42,8 +43,7 @@
public class AddDatetimeDurationDescriptor extends AbstractScalarFunctionDynamicDescriptor {
private final static long serialVersionUID = 1L;
- public final static FunctionIdentifier FID = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
- "add-datetime-duration", 2);
+ public final static FunctionIdentifier FID = AsterixBuiltinFunctions.ADD_DATETIME_DURATION;
// allowed input types
private final static byte SER_NULL_TYPE_TAG = ATypeTag.NULL.serialize();
@@ -102,17 +102,15 @@
}
if (argOut0.getByteArray()[0] != SER_DATETIME_TYPE_TAG) {
- throw new AlgebricksException(
- "Inapplicable input type for parameter 0: expecting a DateTime ("
- + SER_DATETIME_TYPE_TAG + ") or null (" + SER_NULL_TYPE_TAG
- + "), but got: " + argOut0.getByteArray()[0]);
+ throw new AlgebricksException(FID.getName()
+ + ": expects type DATETIME/NULL for parameter 0 but got "
+ + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut0.getByteArray()[0]));
}
if (argOut1.getByteArray()[0] != SER_DURATION_TYPE_TAG) {
- throw new AlgebricksException(
- "Inapplicable input type for parameter 1: expecting a Duration ("
- + SER_DURATION_TYPE_TAG + ") or null (" + SER_NULL_TYPE_TAG
- + "), but got: " + argOut1.getByteArray()[0]);
+ throw new AlgebricksException(FID.getName()
+ + ": expects type DURATION/NULL for parameter 1 but got "
+ + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut1.getByteArray()[0]));
}
// get duration fields: yearMonth field and dayTime field
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/AddTimeDurationDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/AddTimeDurationDescriptor.java
index e6b6ebd..e7a4fc4 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/AddTimeDurationDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/AddTimeDurationDescriptor.java
@@ -16,7 +16,6 @@
import java.io.DataOutput;
-import edu.uci.ics.asterix.common.functions.FunctionConstants;
import edu.uci.ics.asterix.dataflow.data.nontagged.serde.ADurationSerializerDeserializer;
import edu.uci.ics.asterix.dataflow.data.nontagged.serde.ATimeSerializerDeserializer;
import edu.uci.ics.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
@@ -24,10 +23,12 @@
import edu.uci.ics.asterix.om.base.ANull;
import edu.uci.ics.asterix.om.base.ATime;
import edu.uci.ics.asterix.om.base.temporal.DurationArithmeticOperations;
+import edu.uci.ics.asterix.om.functions.AsterixBuiltinFunctions;
import edu.uci.ics.asterix.om.functions.IFunctionDescriptor;
import edu.uci.ics.asterix.om.functions.IFunctionDescriptorFactory;
import edu.uci.ics.asterix.om.types.ATypeTag;
import edu.uci.ics.asterix.om.types.BuiltinType;
+import edu.uci.ics.asterix.om.types.EnumDeserializer;
import edu.uci.ics.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
@@ -42,8 +43,7 @@
public class AddTimeDurationDescriptor extends AbstractScalarFunctionDynamicDescriptor {
private final static long serialVersionUID = 1L;
- public final static FunctionIdentifier FID = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
- "add-time-duration", 2);
+ public final static FunctionIdentifier FID = AsterixBuiltinFunctions.ADD_TIME_DURATION;
// allowed input types
private final static byte SER_NULL_TYPE_TAG = ATypeTag.NULL.serialize();
@@ -102,17 +102,15 @@
}
if (argOut0.getByteArray()[0] != SER_TIME_TYPE_TAG) {
- throw new AlgebricksException(
- "Inapplicable input type for parameter 0: expecting a Time ("
- + SER_TIME_TYPE_TAG + ") or null (" + SER_NULL_TYPE_TAG
- + "), but got: " + argOut0.getByteArray()[0]);
+ throw new AlgebricksException(FID.getName()
+ + ": expects type TIME/NULL for parameter 0 but got "
+ + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut0.getByteArray()[0]));
}
if (argOut1.getByteArray()[0] != SER_DURATION_TYPE_TAG) {
- throw new AlgebricksException(
- "Inapplicable input type for parameter 1: expecting a Duration ("
- + SER_DURATION_TYPE_TAG + ") or null (" + SER_DURATION_TYPE_TAG
- + "), but got: " + argOut1.getByteArray()[0]);
+ throw new AlgebricksException(FID.getName()
+ + ": expects type DURATION/NULL for parameter 1 but got "
+ + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut1.getByteArray()[0]));
}
// get duration fields: yearMonth field and dayTime field
@@ -120,7 +118,8 @@
// cannot add a year-month duration to a time value
if (yearMonth != 0) {
- throw new AlgebricksException("ATime cannot be added by a year-month duration.");
+ throw new AlgebricksException(FID.getName()
+ + ": a TIME value cannot be added by a DURATION value with year-month field.");
}
long dayTime = ADurationSerializerDeserializer.getDayTime(argOut1.getByteArray(), 1);
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/AdjustDateTimeForTimeZoneDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/AdjustDateTimeForTimeZoneDescriptor.java
index 21d098a..441d20a 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/AdjustDateTimeForTimeZoneDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/AdjustDateTimeForTimeZoneDescriptor.java
@@ -16,17 +16,18 @@
import java.io.DataOutput;
-import edu.uci.ics.asterix.common.functions.FunctionConstants;
import edu.uci.ics.asterix.dataflow.data.nontagged.serde.ADateTimeSerializerDeserializer;
import edu.uci.ics.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
import edu.uci.ics.asterix.om.base.ANull;
import edu.uci.ics.asterix.om.base.temporal.ATimeParserFactory;
import edu.uci.ics.asterix.om.base.temporal.GregorianCalendarSystem;
import edu.uci.ics.asterix.om.base.temporal.GregorianCalendarSystem.Fields;
+import edu.uci.ics.asterix.om.functions.AsterixBuiltinFunctions;
import edu.uci.ics.asterix.om.functions.IFunctionDescriptor;
import edu.uci.ics.asterix.om.functions.IFunctionDescriptorFactory;
import edu.uci.ics.asterix.om.types.ATypeTag;
import edu.uci.ics.asterix.om.types.BuiltinType;
+import edu.uci.ics.asterix.om.types.EnumDeserializer;
import edu.uci.ics.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
@@ -40,8 +41,7 @@
public class AdjustDateTimeForTimeZoneDescriptor extends AbstractScalarFunctionDynamicDescriptor {
private final static long serialVersionUID = 1L;
- public final static FunctionIdentifier FID = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
- "adjust-datetime-for-timezone", 2);
+ public final static FunctionIdentifier FID = AsterixBuiltinFunctions.ADJUST_DATETIME_FOR_TIMEZONE;
// allowed input types
private final static byte SER_NULL_TYPE_TAG = ATypeTag.NULL.serialize();
@@ -97,21 +97,21 @@
}
if (argOut0.getByteArray()[0] != SER_DATETIME_TYPE_TAG) {
- throw new AlgebricksException(
- "Inapplicable input type for parameter 0: expecting a Datetime, but got: "
- + argOut0.getByteArray()[0]);
+ throw new AlgebricksException(FID.getName()
+ + ": expects type DATETIME/NULL for parameter 0 but got "
+ + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut0.getByteArray()[0]));
}
if (argOut1.getByteArray()[0] != SER_STRING_TYPE_TAG) {
- throw new AlgebricksException(
- "Inapplicable input type for parameter 0: expecting a String, but got: "
- + argOut1.getByteArray()[0]);
+ throw new AlgebricksException(FID.getName()
+ + ": expects type STRING/NULL for parameter 1 but got "
+ + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut1.getByteArray()[0]));
}
int timezone = ATimeParserFactory.parseTimezonePart(argOut1.getByteArray(), 3);
if (!calInstance.validateTimeZone(timezone)) {
- throw new AlgebricksException("Wrong format for a time zone string!");
+ throw new AlgebricksException(FID.getName() + ": wrong format for a time zone string!");
}
long chronon = ADateTimeSerializerDeserializer.getChronon(argOut0.getByteArray(), 1);
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/AdjustTimeForTimeZoneDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/AdjustTimeForTimeZoneDescriptor.java
index 1f8842e..1ca64c6 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/AdjustTimeForTimeZoneDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/AdjustTimeForTimeZoneDescriptor.java
@@ -16,17 +16,18 @@
import java.io.DataOutput;
-import edu.uci.ics.asterix.common.functions.FunctionConstants;
import edu.uci.ics.asterix.dataflow.data.nontagged.serde.ATimeSerializerDeserializer;
import edu.uci.ics.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
import edu.uci.ics.asterix.om.base.ANull;
import edu.uci.ics.asterix.om.base.temporal.ATimeParserFactory;
import edu.uci.ics.asterix.om.base.temporal.GregorianCalendarSystem;
import edu.uci.ics.asterix.om.base.temporal.GregorianCalendarSystem.Fields;
+import edu.uci.ics.asterix.om.functions.AsterixBuiltinFunctions;
import edu.uci.ics.asterix.om.functions.IFunctionDescriptor;
import edu.uci.ics.asterix.om.functions.IFunctionDescriptorFactory;
import edu.uci.ics.asterix.om.types.ATypeTag;
import edu.uci.ics.asterix.om.types.BuiltinType;
+import edu.uci.ics.asterix.om.types.EnumDeserializer;
import edu.uci.ics.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
@@ -40,8 +41,7 @@
public class AdjustTimeForTimeZoneDescriptor extends AbstractScalarFunctionDynamicDescriptor {
private final static long serialVersionUID = 1L;
- public final static FunctionIdentifier FID = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
- "adjust-time-for-timezone", 2);
+ public final static FunctionIdentifier FID = AsterixBuiltinFunctions.ADJUST_TIME_FOR_TIMEZONE;
// allowed input types
private final static byte SER_NULL_TYPE_TAG = ATypeTag.NULL.serialize();
@@ -97,21 +97,21 @@
}
if (argOut0.getByteArray()[0] != SER_TIME_TYPE_TAG) {
- throw new AlgebricksException(
- "Inapplicable input type for parameter 0: expecting a Time, but got: "
- + argOut0.getByteArray()[0]);
+ throw new AlgebricksException(FID.getName()
+ + ": expects type TIME/NULL for parameter 0 but got "
+ + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut0.getByteArray()[0]));
}
if (argOut1.getByteArray()[0] != SER_STRING_TYPE_TAG) {
- throw new AlgebricksException(
- "Inapplicable input type for parameter 0: expecting a String, but got: "
- + argOut1.getByteArray()[0]);
+ throw new AlgebricksException(FID.getName()
+ + ": expects type STRING/NULL for parameter 1 but got "
+ + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut1.getByteArray()[0]));
}
int timezone = ATimeParserFactory.parseTimezonePart(argOut1.getByteArray(), 3);
if (!calInstance.validateTimeZone(timezone)) {
- throw new AlgebricksException("Wrong format for a time zone string!");
+ throw new AlgebricksException(FID.getName() + ": wrong format for a time zone string!");
}
int chronon = ATimeSerializerDeserializer.getChronon(argOut0.getByteArray(), 1);
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/CalendarDuartionFromDateDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/CalendarDuartionFromDateDescriptor.java
index cbd600f..c6da17e 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/CalendarDuartionFromDateDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/CalendarDuartionFromDateDescriptor.java
@@ -16,7 +16,6 @@
import java.io.DataOutput;
-import edu.uci.ics.asterix.common.functions.FunctionConstants;
import edu.uci.ics.asterix.dataflow.data.nontagged.serde.ADateSerializerDeserializer;
import edu.uci.ics.asterix.dataflow.data.nontagged.serde.ADurationSerializerDeserializer;
import edu.uci.ics.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
@@ -25,10 +24,12 @@
import edu.uci.ics.asterix.om.base.ANull;
import edu.uci.ics.asterix.om.base.temporal.DurationArithmeticOperations;
import edu.uci.ics.asterix.om.base.temporal.GregorianCalendarSystem;
+import edu.uci.ics.asterix.om.functions.AsterixBuiltinFunctions;
import edu.uci.ics.asterix.om.functions.IFunctionDescriptor;
import edu.uci.ics.asterix.om.functions.IFunctionDescriptorFactory;
import edu.uci.ics.asterix.om.types.ATypeTag;
import edu.uci.ics.asterix.om.types.BuiltinType;
+import edu.uci.ics.asterix.om.types.EnumDeserializer;
import edu.uci.ics.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
@@ -43,8 +44,7 @@
public class CalendarDuartionFromDateDescriptor extends AbstractScalarFunctionDynamicDescriptor {
private final static long serialVersionUID = 1L;
- public final static FunctionIdentifier FID = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
- "calendar-duration-from-date", 2);
+ public final static FunctionIdentifier FID = AsterixBuiltinFunctions.CALENDAR_DURATION_FROM_DATE;
// allowed input types
private final static byte SER_NULL_TYPE_TAG = ATypeTag.NULL.serialize();
@@ -107,15 +107,15 @@
}
if (argOut0.getByteArray()[0] != SER_DATE_TYPE_TAG) {
- throw new AlgebricksException(
- "Inapplicable input type for parameter 0: expecting a Date, but got: "
- + argOut0.getByteArray()[0]);
+ throw new AlgebricksException(FID.getName()
+ + ": expects type DATE/NULL for parameter 0 but got "
+ + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut0.getByteArray()[0]));
}
if (argOut1.getByteArray()[0] != SER_DURATION_TYPE_TAG) {
- throw new AlgebricksException(
- "Inapplicable input type for parameter 1: expecting a Date, but got: "
- + argOut1.getByteArray()[0]);
+ throw new AlgebricksException(FID.getName()
+ + ": expects type DURATION/NULL for parameter 1 but got "
+ + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut1.getByteArray()[0]));
}
int yearMonthDurationInMonths = ADurationSerializerDeserializer.getYearMonth(
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/CalendarDurationFromDateTimeDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/CalendarDurationFromDateTimeDescriptor.java
index 8df3c7f..e09f1da 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/CalendarDurationFromDateTimeDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/CalendarDurationFromDateTimeDescriptor.java
@@ -16,7 +16,6 @@
import java.io.DataOutput;
-import edu.uci.ics.asterix.common.functions.FunctionConstants;
import edu.uci.ics.asterix.dataflow.data.nontagged.serde.ADateTimeSerializerDeserializer;
import edu.uci.ics.asterix.dataflow.data.nontagged.serde.ADurationSerializerDeserializer;
import edu.uci.ics.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
@@ -25,10 +24,12 @@
import edu.uci.ics.asterix.om.base.ANull;
import edu.uci.ics.asterix.om.base.temporal.DurationArithmeticOperations;
import edu.uci.ics.asterix.om.base.temporal.GregorianCalendarSystem;
+import edu.uci.ics.asterix.om.functions.AsterixBuiltinFunctions;
import edu.uci.ics.asterix.om.functions.IFunctionDescriptor;
import edu.uci.ics.asterix.om.functions.IFunctionDescriptorFactory;
import edu.uci.ics.asterix.om.types.ATypeTag;
import edu.uci.ics.asterix.om.types.BuiltinType;
+import edu.uci.ics.asterix.om.types.EnumDeserializer;
import edu.uci.ics.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
@@ -49,11 +50,9 @@
* 2. Calculate the differences by fields between two different time points;<br/>
* 3. Re-format the duration into a human-readable one.
* <p/>
- * Here "human-readable" means the value of each field of the duration is within the value range of the field in the
- * calendar system. For example, month would be in [0, 12), and hour would be in [0, 24).
+ * Here "human-readable" means the value of each field of the duration is within the value range of the field in the calendar system. For example, month would be in [0, 12), and hour would be in [0, 24).
* <p/>
- * The result can be considered as a "field-based" difference between the two datetime value, but all negative values
- * would be converted to be non-negative.
+ * The result can be considered as a "field-based" difference between the two datetime value, but all negative values would be converted to be non-negative.
* <p/>
* In the implementation, we always do the subtraction from the later time point, resulting a positive duration always.
* <p/>
@@ -61,8 +60,7 @@
public class CalendarDurationFromDateTimeDescriptor extends AbstractScalarFunctionDynamicDescriptor {
private final static long serialVersionUID = 1L;
- public final static FunctionIdentifier FID = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
- "calendar-duration-from-datetime", 2);
+ public final static FunctionIdentifier FID = AsterixBuiltinFunctions.CALENDAR_DURATION_FROM_DATETIME;
// allowed input types
private final static byte SER_NULL_TYPE_TAG = ATypeTag.NULL.serialize();
@@ -123,15 +121,15 @@
}
if (argOut0.getByteArray()[0] != SER_DATETIME_TYPE_TAG) {
- throw new AlgebricksException(
- "Inapplicable input type for parameter 0: expecting Datetime, but got: "
- + argOut0.getByteArray()[0]);
+ throw new AlgebricksException(FID.getName()
+ + ": expects type DATETIME/NULL for parameter 0 but got "
+ + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut0.getByteArray()[0]));
}
if (argOut1.getByteArray()[0] != SER_DURATION_TYPE_TAG) {
- throw new AlgebricksException(
- "Inapplicable input type for parameter 1: expecting Duration, but got: "
- + argOut1.getByteArray()[0]);
+ throw new AlgebricksException(FID.getName()
+ + ": expects type DURATION/NULL for parameter 1 but got "
+ + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut1.getByteArray()[0]));
}
int yearMonthDurationInMonths = ADurationSerializerDeserializer.getYearMonth(
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/CurrentDateDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/CurrentDateDescriptor.java
index 0cb47b5..21103d6 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/CurrentDateDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/CurrentDateDescriptor.java
@@ -16,11 +16,11 @@
import java.io.DataOutput;
-import edu.uci.ics.asterix.common.functions.FunctionConstants;
import edu.uci.ics.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
import edu.uci.ics.asterix.om.base.ADate;
import edu.uci.ics.asterix.om.base.AMutableDate;
import edu.uci.ics.asterix.om.base.temporal.GregorianCalendarSystem;
+import edu.uci.ics.asterix.om.functions.AsterixBuiltinFunctions;
import edu.uci.ics.asterix.om.functions.IFunctionDescriptor;
import edu.uci.ics.asterix.om.functions.IFunctionDescriptorFactory;
import edu.uci.ics.asterix.om.types.BuiltinType;
@@ -37,8 +37,7 @@
public class CurrentDateDescriptor extends AbstractScalarFunctionDynamicDescriptor {
private static final long serialVersionUID = 1L;
- private final static FunctionIdentifier FID = new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "current-date",
- 0);
+ private final static FunctionIdentifier FID = AsterixBuiltinFunctions.CURRENT_DATE;
public final static IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/CurrentDateTimeDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/CurrentDateTimeDescriptor.java
index 9209cae..cd0af68 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/CurrentDateTimeDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/CurrentDateTimeDescriptor.java
@@ -16,10 +16,10 @@
import java.io.DataOutput;
-import edu.uci.ics.asterix.common.functions.FunctionConstants;
import edu.uci.ics.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
import edu.uci.ics.asterix.om.base.ADateTime;
import edu.uci.ics.asterix.om.base.AMutableDateTime;
+import edu.uci.ics.asterix.om.functions.AsterixBuiltinFunctions;
import edu.uci.ics.asterix.om.functions.IFunctionDescriptor;
import edu.uci.ics.asterix.om.functions.IFunctionDescriptorFactory;
import edu.uci.ics.asterix.om.types.BuiltinType;
@@ -36,8 +36,7 @@
public class CurrentDateTimeDescriptor extends AbstractScalarFunctionDynamicDescriptor {
private static final long serialVersionUID = 1L;
- private final static FunctionIdentifier FID = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
- "current-datetime", 0);
+ private final static FunctionIdentifier FID = AsterixBuiltinFunctions.CURRENT_DATETIME;
public final static IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/CurrentTimeDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/CurrentTimeDescriptor.java
index c7078b9..2e012a3 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/CurrentTimeDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/CurrentTimeDescriptor.java
@@ -16,11 +16,11 @@
import java.io.DataOutput;
-import edu.uci.ics.asterix.common.functions.FunctionConstants;
import edu.uci.ics.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
import edu.uci.ics.asterix.om.base.AMutableTime;
import edu.uci.ics.asterix.om.base.ATime;
import edu.uci.ics.asterix.om.base.temporal.GregorianCalendarSystem;
+import edu.uci.ics.asterix.om.functions.AsterixBuiltinFunctions;
import edu.uci.ics.asterix.om.functions.IFunctionDescriptor;
import edu.uci.ics.asterix.om.functions.IFunctionDescriptorFactory;
import edu.uci.ics.asterix.om.types.BuiltinType;
@@ -37,7 +37,7 @@
public class CurrentTimeDescriptor extends AbstractScalarFunctionDynamicDescriptor {
private static final long serialVersionUID = 1L;
- public final static FunctionIdentifier FID = new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "current-time", 0);
+ public final static FunctionIdentifier FID = AsterixBuiltinFunctions.CURRENT_TIME;
public final static IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/DateFromDatetimeDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/DateFromDatetimeDescriptor.java
index 4ef52d9..b0ced1c 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/DateFromDatetimeDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/DateFromDatetimeDescriptor.java
@@ -2,17 +2,18 @@
import java.io.DataOutput;
-import edu.uci.ics.asterix.common.functions.FunctionConstants;
import edu.uci.ics.asterix.dataflow.data.nontagged.serde.ADateTimeSerializerDeserializer;
import edu.uci.ics.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
import edu.uci.ics.asterix.om.base.ADate;
import edu.uci.ics.asterix.om.base.AMutableDate;
import edu.uci.ics.asterix.om.base.ANull;
import edu.uci.ics.asterix.om.base.temporal.GregorianCalendarSystem;
+import edu.uci.ics.asterix.om.functions.AsterixBuiltinFunctions;
import edu.uci.ics.asterix.om.functions.IFunctionDescriptor;
import edu.uci.ics.asterix.om.functions.IFunctionDescriptorFactory;
import edu.uci.ics.asterix.om.types.ATypeTag;
import edu.uci.ics.asterix.om.types.BuiltinType;
+import edu.uci.ics.asterix.om.types.EnumDeserializer;
import edu.uci.ics.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
@@ -27,8 +28,7 @@
public class DateFromDatetimeDescriptor extends AbstractScalarFunctionDynamicDescriptor {
private static final long serialVersionUID = 1L;
- public final static FunctionIdentifier FID = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
- "date-from-datetime", 1);
+ public final static FunctionIdentifier FID = AsterixBuiltinFunctions.DATE_FROM_DATETIME;
// allowed input types
private final static byte SER_NULL_TYPE_TAG = ATypeTag.NULL.serialize();
@@ -77,9 +77,10 @@
} else {
if (argOut.getByteArray()[0] != SER_DATETIME_TYPE_TAG) {
throw new AlgebricksException(
- "Inapplicable input type for function date_from_datetime: expecting ADateTime ("
- + SER_DATETIME_TYPE_TAG + ") or null (" + SER_NULL_TYPE_TAG
- + "), but got: " + argOut.getByteArray()[0]);
+ FID.getName()
+ + ": expects input type DATETIME/NULL but got "
+ + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut
+ .getByteArray()[0]));
}
long datetimeChronon = ADateTimeSerializerDeserializer.getChronon(
argOut.getByteArray(), 1);
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/DateFromUnixTimeInDaysDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/DateFromUnixTimeInDaysDescriptor.java
index c69207a..5743ff9 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/DateFromUnixTimeInDaysDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/DateFromUnixTimeInDaysDescriptor.java
@@ -16,7 +16,6 @@
import java.io.DataOutput;
-import edu.uci.ics.asterix.common.functions.FunctionConstants;
import edu.uci.ics.asterix.dataflow.data.nontagged.serde.AInt16SerializerDeserializer;
import edu.uci.ics.asterix.dataflow.data.nontagged.serde.AInt32SerializerDeserializer;
import edu.uci.ics.asterix.dataflow.data.nontagged.serde.AInt8SerializerDeserializer;
@@ -24,10 +23,12 @@
import edu.uci.ics.asterix.om.base.ADate;
import edu.uci.ics.asterix.om.base.AMutableDate;
import edu.uci.ics.asterix.om.base.ANull;
+import edu.uci.ics.asterix.om.functions.AsterixBuiltinFunctions;
import edu.uci.ics.asterix.om.functions.IFunctionDescriptor;
import edu.uci.ics.asterix.om.functions.IFunctionDescriptorFactory;
import edu.uci.ics.asterix.om.types.ATypeTag;
import edu.uci.ics.asterix.om.types.BuiltinType;
+import edu.uci.ics.asterix.om.types.EnumDeserializer;
import edu.uci.ics.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
@@ -42,9 +43,8 @@
public class DateFromUnixTimeInDaysDescriptor extends AbstractScalarFunctionDynamicDescriptor {
private final static long serialVersionUID = 1L;
- public final static FunctionIdentifier FID = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
- "date-from-unix-time-in-days", 1);
-
+ public final static FunctionIdentifier FID = AsterixBuiltinFunctions.DATE_FROM_UNIX_TIME_IN_DAYS;
+
// allowed input types
private static final byte SER_NULL_TYPE_TAG = ATypeTag.NULL.serialize();
private static final byte SER_INT8_TYPE_TAG = ATypeTag.INT8.serialize();
@@ -99,8 +99,10 @@
aDate.setValue(AInt32SerializerDeserializer.getInt(argOut.getByteArray(), 1));
} else {
throw new AlgebricksException(
- "Inapplicable input type for function date-from-unix-time-in-days: expecting integer or null type, but got "
- + argOut.getByteArray()[0]);
+ FID.getName()
+ + ": expects type INT8/INT16/INT32/INT64/NULL but got "
+ + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut
+ .getByteArray()[0]));
}
dateSerde.serialize(aDate, out);
}
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/DatetimeFromDateAndTimeDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/DatetimeFromDateAndTimeDescriptor.java
index 2ade4b7..7854a2b 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/DatetimeFromDateAndTimeDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/DatetimeFromDateAndTimeDescriptor.java
@@ -16,7 +16,6 @@
import java.io.DataOutput;
-import edu.uci.ics.asterix.common.functions.FunctionConstants;
import edu.uci.ics.asterix.dataflow.data.nontagged.serde.ADateSerializerDeserializer;
import edu.uci.ics.asterix.dataflow.data.nontagged.serde.ATimeSerializerDeserializer;
import edu.uci.ics.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
@@ -24,10 +23,12 @@
import edu.uci.ics.asterix.om.base.AMutableDateTime;
import edu.uci.ics.asterix.om.base.ANull;
import edu.uci.ics.asterix.om.base.temporal.GregorianCalendarSystem;
+import edu.uci.ics.asterix.om.functions.AsterixBuiltinFunctions;
import edu.uci.ics.asterix.om.functions.IFunctionDescriptor;
import edu.uci.ics.asterix.om.functions.IFunctionDescriptorFactory;
import edu.uci.ics.asterix.om.types.ATypeTag;
import edu.uci.ics.asterix.om.types.BuiltinType;
+import edu.uci.ics.asterix.om.types.EnumDeserializer;
import edu.uci.ics.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
@@ -42,8 +43,7 @@
public class DatetimeFromDateAndTimeDescriptor extends AbstractScalarFunctionDynamicDescriptor {
private static final long serialVersionUID = 1L;
- public final static FunctionIdentifier FID = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
- "datetime-from-date-time", 2);
+ public final static FunctionIdentifier FID = AsterixBuiltinFunctions.DATETIME_FROM_DATE_TIME;
// allowed input types
private final static byte SER_NULL_TYPE_TAG = ATypeTag.NULL.serialize();
@@ -100,20 +100,17 @@
|| argOut1.getByteArray()[0] == SER_NULL_TYPE_TAG) {
nullSerde.serialize(ANull.NULL, out);
} else {
- if (argOut0.getByteArray()[0] != SER_DATE_TYPE_TAG) {
+ if (argOut0.getByteArray()[0] != SER_DATE_TYPE_TAG
+ && argOut1.getByteArray()[0] != SER_TIME_TYPE_TAG) {
throw new AlgebricksException(
- "Inapplicable input type for function datetime-from-date-time: expecting a Date ("
- + SER_DATE_TYPE_TAG + ") or null (" + SER_NULL_TYPE_TAG
- + ") for the first parameter, but got: "
- + argOut0.getByteArray()[0]);
- }
+ FID.getName()
+ + ": expects input type (DATE/NULL, TIME/NULL) but got ("
+ + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut0
+ .getByteArray()[0])
+ + ", "
+ + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut1
+ .getByteArray()[0]) + ").");
- if (argOut1.getByteArray()[0] != SER_TIME_TYPE_TAG) {
- throw new AlgebricksException(
- "Inapplicable input type for function datetime-from-date-time: expecting a Time ("
- + SER_TIME_TYPE_TAG + ") or null (" + SER_NULL_TYPE_TAG
- + ") for the secon parameter, but got: "
- + argOut1.getByteArray()[0]);
}
long datetimeChronon = ADateSerializerDeserializer
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/DatetimeFromUnixTimeInMsDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/DatetimeFromUnixTimeInMsDescriptor.java
index dbd34f2..447184e 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/DatetimeFromUnixTimeInMsDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/DatetimeFromUnixTimeInMsDescriptor.java
@@ -16,7 +16,6 @@
import java.io.DataOutput;
-import edu.uci.ics.asterix.common.functions.FunctionConstants;
import edu.uci.ics.asterix.dataflow.data.nontagged.serde.AInt16SerializerDeserializer;
import edu.uci.ics.asterix.dataflow.data.nontagged.serde.AInt32SerializerDeserializer;
import edu.uci.ics.asterix.dataflow.data.nontagged.serde.AInt64SerializerDeserializer;
@@ -25,10 +24,12 @@
import edu.uci.ics.asterix.om.base.ADateTime;
import edu.uci.ics.asterix.om.base.AMutableDateTime;
import edu.uci.ics.asterix.om.base.ANull;
+import edu.uci.ics.asterix.om.functions.AsterixBuiltinFunctions;
import edu.uci.ics.asterix.om.functions.IFunctionDescriptor;
import edu.uci.ics.asterix.om.functions.IFunctionDescriptorFactory;
import edu.uci.ics.asterix.om.types.ATypeTag;
import edu.uci.ics.asterix.om.types.BuiltinType;
+import edu.uci.ics.asterix.om.types.EnumDeserializer;
import edu.uci.ics.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
@@ -43,8 +44,7 @@
public class DatetimeFromUnixTimeInMsDescriptor extends AbstractScalarFunctionDynamicDescriptor {
private final static long serialVersionUID = 1L;
- public final static FunctionIdentifier FID = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
- "datetime-from-unix-time-in-ms", 1);
+ public final static FunctionIdentifier FID = AsterixBuiltinFunctions.DATETIME_FROM_UNIX_TIME_IN_MS;
// allowed input types
private final static byte SER_NULL_TYPE_TAG = ATypeTag.NULL.serialize();
@@ -106,8 +106,10 @@
aDatetime.setValue(AInt64SerializerDeserializer.getLong(argOut.getByteArray(), 1));
} else {
throw new AlgebricksException(
- "Inapplicable input type for function datetime-from-unix-time-in-ms: expecting integer or null type, but got "
- + argOut.getByteArray()[0]);
+ FID.getName()
+ + ": expects type INT8/INT16/INT32/INT64/NULL but got "
+ + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut
+ .getByteArray()[0]));
}
datetimeSerde.serialize(aDatetime, out);
}
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/IntervalAfterDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/IntervalAfterDescriptor.java
index 85bb378..9c44e19 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/IntervalAfterDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/IntervalAfterDescriptor.java
@@ -14,7 +14,7 @@
*/
package edu.uci.ics.asterix.runtime.evaluators.functions.temporal;
-import edu.uci.ics.asterix.common.functions.FunctionConstants;
+import edu.uci.ics.asterix.om.functions.AsterixBuiltinFunctions;
import edu.uci.ics.asterix.om.functions.IFunctionDescriptor;
import edu.uci.ics.asterix.om.functions.IFunctionDescriptorFactory;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
@@ -22,8 +22,7 @@
public class IntervalAfterDescriptor extends AbstractIntervalLogicFuncDescriptor {
private final static long serialVersionUID = 1L;
- public final static FunctionIdentifier FID = new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "interval-after",
- 2);
+ public final static FunctionIdentifier FID = AsterixBuiltinFunctions.INTERVAL_AFTER;
public final static IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/IntervalBeforeDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/IntervalBeforeDescriptor.java
index 2da48ee..dc908b9 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/IntervalBeforeDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/IntervalBeforeDescriptor.java
@@ -14,7 +14,7 @@
*/
package edu.uci.ics.asterix.runtime.evaluators.functions.temporal;
-import edu.uci.ics.asterix.common.functions.FunctionConstants;
+import edu.uci.ics.asterix.om.functions.AsterixBuiltinFunctions;
import edu.uci.ics.asterix.om.functions.IFunctionDescriptor;
import edu.uci.ics.asterix.om.functions.IFunctionDescriptorFactory;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
@@ -22,8 +22,7 @@
public class IntervalBeforeDescriptor extends AbstractIntervalLogicFuncDescriptor {
private final static long serialVersionUID = 1L;
- public final static FunctionIdentifier FID = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
- "interval-before", 2);
+ public final static FunctionIdentifier FID = AsterixBuiltinFunctions.INTERVAL_BEFORE;
public final static IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/IntervalCoveredByDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/IntervalCoveredByDescriptor.java
index 1064e59..bc17852 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/IntervalCoveredByDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/IntervalCoveredByDescriptor.java
@@ -14,7 +14,7 @@
*/
package edu.uci.ics.asterix.runtime.evaluators.functions.temporal;
-import edu.uci.ics.asterix.common.functions.FunctionConstants;
+import edu.uci.ics.asterix.om.functions.AsterixBuiltinFunctions;
import edu.uci.ics.asterix.om.functions.IFunctionDescriptor;
import edu.uci.ics.asterix.om.functions.IFunctionDescriptorFactory;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
@@ -22,8 +22,7 @@
public class IntervalCoveredByDescriptor extends AbstractIntervalLogicFuncDescriptor {
private final static long serialVersionUID = 1L;
- public final static FunctionIdentifier FID = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
- "interval-covered-by", 2);
+ public final static FunctionIdentifier FID = AsterixBuiltinFunctions.INTERVAL_COVERED_BY;
public final static IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/IntervalCoversDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/IntervalCoversDescriptor.java
index 5b1cfa5..844ef75 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/IntervalCoversDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/IntervalCoversDescriptor.java
@@ -14,7 +14,7 @@
*/
package edu.uci.ics.asterix.runtime.evaluators.functions.temporal;
-import edu.uci.ics.asterix.common.functions.FunctionConstants;
+import edu.uci.ics.asterix.om.functions.AsterixBuiltinFunctions;
import edu.uci.ics.asterix.om.functions.IFunctionDescriptor;
import edu.uci.ics.asterix.om.functions.IFunctionDescriptorFactory;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
@@ -22,8 +22,7 @@
public class IntervalCoversDescriptor extends AbstractIntervalLogicFuncDescriptor {
private final static long serialVersionUID = 1L;
- public final static FunctionIdentifier FID = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
- "interval-covers", 2);
+ public final static FunctionIdentifier FID = AsterixBuiltinFunctions.INTERVAL_COVERS;
public final static IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/IntervalEndedByDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/IntervalEndedByDescriptor.java
index 4610c89..98c7833f 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/IntervalEndedByDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/IntervalEndedByDescriptor.java
@@ -14,7 +14,7 @@
*/
package edu.uci.ics.asterix.runtime.evaluators.functions.temporal;
-import edu.uci.ics.asterix.common.functions.FunctionConstants;
+import edu.uci.ics.asterix.om.functions.AsterixBuiltinFunctions;
import edu.uci.ics.asterix.om.functions.IFunctionDescriptor;
import edu.uci.ics.asterix.om.functions.IFunctionDescriptorFactory;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
@@ -22,8 +22,7 @@
public class IntervalEndedByDescriptor extends AbstractIntervalLogicFuncDescriptor {
private final static long serialVersionUID = 1L;
- public final static FunctionIdentifier FID = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
- "interval-ended-by", 2);
+ public final static FunctionIdentifier FID = AsterixBuiltinFunctions.INTERVAL_ENDED_BY;
public final static IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/IntervalEndsDecriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/IntervalEndsDecriptor.java
index 9853c62..140583a 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/IntervalEndsDecriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/IntervalEndsDecriptor.java
@@ -14,7 +14,7 @@
*/
package edu.uci.ics.asterix.runtime.evaluators.functions.temporal;
-import edu.uci.ics.asterix.common.functions.FunctionConstants;
+import edu.uci.ics.asterix.om.functions.AsterixBuiltinFunctions;
import edu.uci.ics.asterix.om.functions.IFunctionDescriptor;
import edu.uci.ics.asterix.om.functions.IFunctionDescriptorFactory;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
@@ -22,8 +22,7 @@
public class IntervalEndsDecriptor extends AbstractIntervalLogicFuncDescriptor {
private final static long serialVersionUID = 1L;
- public final static FunctionIdentifier FID = new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "interval-ends",
- 2);
+ public final static FunctionIdentifier FID = AsterixBuiltinFunctions.INTERVAL_ENDS;
public final static IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/IntervalMeetsDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/IntervalMeetsDescriptor.java
index 0263edb..a2232a8 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/IntervalMeetsDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/IntervalMeetsDescriptor.java
@@ -14,7 +14,7 @@
*/
package edu.uci.ics.asterix.runtime.evaluators.functions.temporal;
-import edu.uci.ics.asterix.common.functions.FunctionConstants;
+import edu.uci.ics.asterix.om.functions.AsterixBuiltinFunctions;
import edu.uci.ics.asterix.om.functions.IFunctionDescriptor;
import edu.uci.ics.asterix.om.functions.IFunctionDescriptorFactory;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
@@ -22,8 +22,7 @@
public class IntervalMeetsDescriptor extends AbstractIntervalLogicFuncDescriptor {
private final static long serialVersionUID = 1L;
- public final static FunctionIdentifier FID = new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "interval-meets",
- 2);
+ public final static FunctionIdentifier FID = AsterixBuiltinFunctions.INTERVAL_MEETS;
public final static IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/IntervalMetByDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/IntervalMetByDescriptor.java
index 4cab864..377d033 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/IntervalMetByDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/IntervalMetByDescriptor.java
@@ -14,7 +14,7 @@
*/
package edu.uci.ics.asterix.runtime.evaluators.functions.temporal;
-import edu.uci.ics.asterix.common.functions.FunctionConstants;
+import edu.uci.ics.asterix.om.functions.AsterixBuiltinFunctions;
import edu.uci.ics.asterix.om.functions.IFunctionDescriptor;
import edu.uci.ics.asterix.om.functions.IFunctionDescriptorFactory;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
@@ -22,8 +22,7 @@
public class IntervalMetByDescriptor extends AbstractIntervalLogicFuncDescriptor {
private final static long serialVersionUID = 1L;
- public final static FunctionIdentifier FID = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
- "interval-met-by", 2);
+ public final static FunctionIdentifier FID = AsterixBuiltinFunctions.INTERVAL_MET_BY;
public final static IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/IntervalOverlappedByDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/IntervalOverlappedByDescriptor.java
index 17e7612..f5d82f0 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/IntervalOverlappedByDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/IntervalOverlappedByDescriptor.java
@@ -14,7 +14,7 @@
*/
package edu.uci.ics.asterix.runtime.evaluators.functions.temporal;
-import edu.uci.ics.asterix.common.functions.FunctionConstants;
+import edu.uci.ics.asterix.om.functions.AsterixBuiltinFunctions;
import edu.uci.ics.asterix.om.functions.IFunctionDescriptor;
import edu.uci.ics.asterix.om.functions.IFunctionDescriptorFactory;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
@@ -22,8 +22,7 @@
public class IntervalOverlappedByDescriptor extends AbstractIntervalLogicFuncDescriptor {
private final static long serialVersionUID = 1L;
- public final static FunctionIdentifier FID = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
- "interval-overlapped-by", 2);
+ public final static FunctionIdentifier FID = AsterixBuiltinFunctions.INTERVAL_OVERLAPPED_BY;
public final static IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/IntervalOverlapsDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/IntervalOverlapsDescriptor.java
index ee62711..d244010 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/IntervalOverlapsDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/IntervalOverlapsDescriptor.java
@@ -14,7 +14,7 @@
*/
package edu.uci.ics.asterix.runtime.evaluators.functions.temporal;
-import edu.uci.ics.asterix.common.functions.FunctionConstants;
+import edu.uci.ics.asterix.om.functions.AsterixBuiltinFunctions;
import edu.uci.ics.asterix.om.functions.IFunctionDescriptor;
import edu.uci.ics.asterix.om.functions.IFunctionDescriptorFactory;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
@@ -22,8 +22,7 @@
public class IntervalOverlapsDescriptor extends AbstractIntervalLogicFuncDescriptor {
private final static long serialVersionUID = 1L;
- public final static FunctionIdentifier FID = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
- "interval-overlaps", 2);
+ public final static FunctionIdentifier FID = AsterixBuiltinFunctions.INTERVAL_OVERLAPS;
public final static IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/IntervalStartedByDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/IntervalStartedByDescriptor.java
index 7e5e0fe..94b01a1 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/IntervalStartedByDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/IntervalStartedByDescriptor.java
@@ -14,7 +14,7 @@
*/
package edu.uci.ics.asterix.runtime.evaluators.functions.temporal;
-import edu.uci.ics.asterix.common.functions.FunctionConstants;
+import edu.uci.ics.asterix.om.functions.AsterixBuiltinFunctions;
import edu.uci.ics.asterix.om.functions.IFunctionDescriptor;
import edu.uci.ics.asterix.om.functions.IFunctionDescriptorFactory;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
@@ -22,8 +22,7 @@
public class IntervalStartedByDescriptor extends AbstractIntervalLogicFuncDescriptor {
private final static long serialVersionUID = 1L;
- public final static FunctionIdentifier FID = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
- "interval-started-by", 2);
+ public final static FunctionIdentifier FID = AsterixBuiltinFunctions.INTERVAL_STARTED_BY;
public final static IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/IntervalStartsDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/IntervalStartsDescriptor.java
index c2ca32e..ce27742 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/IntervalStartsDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/IntervalStartsDescriptor.java
@@ -14,7 +14,7 @@
*/
package edu.uci.ics.asterix.runtime.evaluators.functions.temporal;
-import edu.uci.ics.asterix.common.functions.FunctionConstants;
+import edu.uci.ics.asterix.om.functions.AsterixBuiltinFunctions;
import edu.uci.ics.asterix.om.functions.IFunctionDescriptor;
import edu.uci.ics.asterix.om.functions.IFunctionDescriptorFactory;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
@@ -22,8 +22,7 @@
public class IntervalStartsDescriptor extends AbstractIntervalLogicFuncDescriptor {
private final static long serialVersionUID = 1L;
- public final static FunctionIdentifier FID = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
- "interval-starts", 2);
+ public final static FunctionIdentifier FID = AsterixBuiltinFunctions.INTERVAL_STARTS;
public final static IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/OverlapDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/OverlapDescriptor.java
index 80479cd..2919f90 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/OverlapDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/OverlapDescriptor.java
@@ -14,7 +14,7 @@
*/
package edu.uci.ics.asterix.runtime.evaluators.functions.temporal;
-import edu.uci.ics.asterix.common.functions.FunctionConstants;
+import edu.uci.ics.asterix.om.functions.AsterixBuiltinFunctions;
import edu.uci.ics.asterix.om.functions.IFunctionDescriptor;
import edu.uci.ics.asterix.om.functions.IFunctionDescriptorFactory;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
@@ -22,7 +22,7 @@
public class OverlapDescriptor extends AbstractIntervalLogicFuncDescriptor {
private final static long serialVersionUID = 1L;
- public final static FunctionIdentifier FID = new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "overlap", 2);
+ public final static FunctionIdentifier FID = AsterixBuiltinFunctions.OVERLAP;
public final static IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/SubtractDateDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/SubtractDateDescriptor.java
index 67d8ef3..6f54162 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/SubtractDateDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/SubtractDateDescriptor.java
@@ -16,17 +16,18 @@
import java.io.DataOutput;
-import edu.uci.ics.asterix.common.functions.FunctionConstants;
import edu.uci.ics.asterix.dataflow.data.nontagged.serde.ADateSerializerDeserializer;
import edu.uci.ics.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
import edu.uci.ics.asterix.om.base.ADuration;
import edu.uci.ics.asterix.om.base.AMutableDuration;
import edu.uci.ics.asterix.om.base.ANull;
import edu.uci.ics.asterix.om.base.temporal.GregorianCalendarSystem;
+import edu.uci.ics.asterix.om.functions.AsterixBuiltinFunctions;
import edu.uci.ics.asterix.om.functions.IFunctionDescriptor;
import edu.uci.ics.asterix.om.functions.IFunctionDescriptorFactory;
import edu.uci.ics.asterix.om.types.ATypeTag;
import edu.uci.ics.asterix.om.types.BuiltinType;
+import edu.uci.ics.asterix.om.types.EnumDeserializer;
import edu.uci.ics.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
@@ -41,8 +42,7 @@
public class SubtractDateDescriptor extends AbstractScalarFunctionDynamicDescriptor {
private final static long serialVersionUID = 1L;
- public final static FunctionIdentifier FID = new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "subtract-date",
- 2);
+ public final static FunctionIdentifier FID = AsterixBuiltinFunctions.SUBTRACT_DATE;
// allowed input types
private final static byte SER_NULL_TYPE_TAG = ATypeTag.NULL.serialize();
@@ -96,18 +96,14 @@
return;
}
- if (argOut0.getByteArray()[0] != SER_DATE_TYPE_TAG) {
- throw new AlgebricksException(
- "Inapplicable input type for parameter 0: expecting a Date ("
- + SER_DATE_TYPE_TAG + ") or null (" + SER_NULL_TYPE_TAG
- + "), but got: " + argOut0.getByteArray()[0]);
- }
-
- if (argOut1.getByteArray()[0] != SER_DATE_TYPE_TAG) {
- throw new AlgebricksException(
- "Inapplicable input type for parameter 1: expecting a Date ("
- + SER_DATE_TYPE_TAG + ") or null (" + SER_NULL_TYPE_TAG
- + "), but got: " + argOut1.getByteArray()[0]);
+ if (argOut0.getByteArray()[0] != SER_DATE_TYPE_TAG
+ && argOut1.getByteArray()[0] != SER_DATE_TYPE_TAG) {
+ throw new AlgebricksException(FID.getName()
+ + ": expects input type (DATE/NULL, DATE/NULL) but got ("
+ + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut0.getByteArray()[0])
+ + ", "
+ + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut1.getByteArray()[0])
+ + ").");
}
long durationChronon = (ADateSerializerDeserializer.getChronon(argOut0.getByteArray(), 1) - ADateSerializerDeserializer
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/SubtractDatetimeDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/SubtractDatetimeDescriptor.java
index 5b77709..dc677b5 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/SubtractDatetimeDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/SubtractDatetimeDescriptor.java
@@ -16,16 +16,17 @@
import java.io.DataOutput;
-import edu.uci.ics.asterix.common.functions.FunctionConstants;
import edu.uci.ics.asterix.dataflow.data.nontagged.serde.ADateTimeSerializerDeserializer;
import edu.uci.ics.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
import edu.uci.ics.asterix.om.base.ADuration;
import edu.uci.ics.asterix.om.base.AMutableDuration;
import edu.uci.ics.asterix.om.base.ANull;
+import edu.uci.ics.asterix.om.functions.AsterixBuiltinFunctions;
import edu.uci.ics.asterix.om.functions.IFunctionDescriptor;
import edu.uci.ics.asterix.om.functions.IFunctionDescriptorFactory;
import edu.uci.ics.asterix.om.types.ATypeTag;
import edu.uci.ics.asterix.om.types.BuiltinType;
+import edu.uci.ics.asterix.om.types.EnumDeserializer;
import edu.uci.ics.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
@@ -40,8 +41,7 @@
public class SubtractDatetimeDescriptor extends AbstractScalarFunctionDynamicDescriptor {
private final static long serialVersionUID = 1L;
- public final static FunctionIdentifier FID = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
- "subtract-datetime", 2);
+ public final static FunctionIdentifier FID = AsterixBuiltinFunctions.SUBTRACT_DATETIME;
// allowed input types
private final static byte SER_NULL_TYPE_TAG = ATypeTag.NULL.serialize();
@@ -98,16 +98,14 @@
return;
}
- if (argOut0.getByteArray()[0] != SER_DATETIME_TYPE_TAG) {
- throw new AlgebricksException(
- "Inapplicable input type for parameter 0: expecting a DateTime, but got: "
- + argOut0.getByteArray()[0]);
- }
-
- if (argOut1.getByteArray()[0] != SER_DATETIME_TYPE_TAG) {
- throw new AlgebricksException(
- "Inapplicable input type for parameter 1: expecting a DateTime, but got: "
- + argOut1.getByteArray()[0]);
+ if (argOut0.getByteArray()[0] != SER_DATETIME_TYPE_TAG
+ && argOut1.getByteArray()[0] != SER_DATETIME_TYPE_TAG) {
+ throw new AlgebricksException(FID.getName()
+ + ": expects input type (DATETIME/NULL, DATETIME/NULL) but got ("
+ + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut0.getByteArray()[0])
+ + ", "
+ + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut1.getByteArray()[0])
+ + ").");
}
long durationChronon = ADateTimeSerializerDeserializer
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/SubtractTimeDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/SubtractTimeDescriptor.java
index 323033e..579030d 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/SubtractTimeDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/SubtractTimeDescriptor.java
@@ -16,16 +16,17 @@
import java.io.DataOutput;
-import edu.uci.ics.asterix.common.functions.FunctionConstants;
import edu.uci.ics.asterix.dataflow.data.nontagged.serde.ATimeSerializerDeserializer;
import edu.uci.ics.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
import edu.uci.ics.asterix.om.base.ADuration;
import edu.uci.ics.asterix.om.base.AMutableDuration;
import edu.uci.ics.asterix.om.base.ANull;
+import edu.uci.ics.asterix.om.functions.AsterixBuiltinFunctions;
import edu.uci.ics.asterix.om.functions.IFunctionDescriptor;
import edu.uci.ics.asterix.om.functions.IFunctionDescriptorFactory;
import edu.uci.ics.asterix.om.types.ATypeTag;
import edu.uci.ics.asterix.om.types.BuiltinType;
+import edu.uci.ics.asterix.om.types.EnumDeserializer;
import edu.uci.ics.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
@@ -40,8 +41,7 @@
public class SubtractTimeDescriptor extends AbstractScalarFunctionDynamicDescriptor {
private final static long serialVersionUID = 1L;
- public final static FunctionIdentifier FID = new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "subtract-time",
- 2);
+ public final static FunctionIdentifier FID = AsterixBuiltinFunctions.SUBTRACT_TIME;
// allowed input types
private final static byte SER_NULL_TYPE_TAG = ATypeTag.NULL.serialize();
@@ -98,18 +98,14 @@
return;
}
- if (argOut0.getByteArray()[0] != SER_TIME_TYPE_TAG) {
- throw new AlgebricksException(
- "Inapplicable input type for parameter 0: expecting a Time ("
- + SER_TIME_TYPE_TAG + ") or null (" + SER_NULL_TYPE_TAG
- + "), but got: " + argOut0.getByteArray()[0]);
- }
-
- if (argOut1.getByteArray()[0] != SER_TIME_TYPE_TAG) {
- throw new AlgebricksException(
- "Inapplicable input type for parameter 1: expecting a Time ("
- + SER_TIME_TYPE_TAG + ") or null (" + SER_NULL_TYPE_TAG
- + "), but got: " + argOut1.getByteArray()[0]);
+ if (argOut0.getByteArray()[0] != SER_TIME_TYPE_TAG
+ && argOut1.getByteArray()[0] != SER_TIME_TYPE_TAG) {
+ throw new AlgebricksException(FID.getName()
+ + ": expects input type (TIME/NULL, TIME/NULL) but got ("
+ + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut0.getByteArray()[0])
+ + ", "
+ + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut1.getByteArray()[0])
+ + ").");
}
int durationChronon = ATimeSerializerDeserializer.getChronon(argOut0.getByteArray(), 1)
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/TimeFromDatetimeDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/TimeFromDatetimeDescriptor.java
index b1053a4..00fe414 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/TimeFromDatetimeDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/TimeFromDatetimeDescriptor.java
@@ -16,17 +16,18 @@
import java.io.DataOutput;
-import edu.uci.ics.asterix.common.functions.FunctionConstants;
import edu.uci.ics.asterix.dataflow.data.nontagged.serde.ADateTimeSerializerDeserializer;
import edu.uci.ics.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
import edu.uci.ics.asterix.om.base.AMutableTime;
import edu.uci.ics.asterix.om.base.ANull;
import edu.uci.ics.asterix.om.base.ATime;
import edu.uci.ics.asterix.om.base.temporal.GregorianCalendarSystem;
+import edu.uci.ics.asterix.om.functions.AsterixBuiltinFunctions;
import edu.uci.ics.asterix.om.functions.IFunctionDescriptor;
import edu.uci.ics.asterix.om.functions.IFunctionDescriptorFactory;
import edu.uci.ics.asterix.om.types.ATypeTag;
import edu.uci.ics.asterix.om.types.BuiltinType;
+import edu.uci.ics.asterix.om.types.EnumDeserializer;
import edu.uci.ics.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
@@ -41,8 +42,7 @@
public class TimeFromDatetimeDescriptor extends AbstractScalarFunctionDynamicDescriptor {
private static final long serialVersionUID = 1L;
- public final static FunctionIdentifier FID = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
- "time-from-datetime", 1);
+ public final static FunctionIdentifier FID = AsterixBuiltinFunctions.TIME_FROM_DATETIME;
// allowed input types
private final static byte SER_NULL_TYPE_TAG = ATypeTag.NULL.serialize();
@@ -94,9 +94,10 @@
} else {
if (argOut.getByteArray()[0] != SER_DATETIME_TYPE_TAG) {
throw new AlgebricksException(
- "Inapplicable input type for function time-from-datetime: expecting a DataTime ("
- + SER_DATETIME_TYPE_TAG + ") or null (" + SER_NULL_TYPE_TAG
- + "), but got: " + argOut.getByteArray()[0]);
+ FID.getName()
+ + ": expects input type DATETIME/NULL but got "
+ + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut
+ .getByteArray()[0]));
}
long datetimeChronon = ADateTimeSerializerDeserializer.getChronon(
argOut.getByteArray(), 1);
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/TimeFromUnixTimeInMsDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/TimeFromUnixTimeInMsDescriptor.java
index b3fbc0e..98fd75f 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/TimeFromUnixTimeInMsDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/TimeFromUnixTimeInMsDescriptor.java
@@ -16,7 +16,6 @@
import java.io.DataOutput;
-import edu.uci.ics.asterix.common.functions.FunctionConstants;
import edu.uci.ics.asterix.dataflow.data.nontagged.serde.AInt16SerializerDeserializer;
import edu.uci.ics.asterix.dataflow.data.nontagged.serde.AInt32SerializerDeserializer;
import edu.uci.ics.asterix.dataflow.data.nontagged.serde.AInt8SerializerDeserializer;
@@ -24,10 +23,12 @@
import edu.uci.ics.asterix.om.base.AMutableTime;
import edu.uci.ics.asterix.om.base.ANull;
import edu.uci.ics.asterix.om.base.ATime;
+import edu.uci.ics.asterix.om.functions.AsterixBuiltinFunctions;
import edu.uci.ics.asterix.om.functions.IFunctionDescriptor;
import edu.uci.ics.asterix.om.functions.IFunctionDescriptorFactory;
import edu.uci.ics.asterix.om.types.ATypeTag;
import edu.uci.ics.asterix.om.types.BuiltinType;
+import edu.uci.ics.asterix.om.types.EnumDeserializer;
import edu.uci.ics.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
@@ -42,8 +43,7 @@
public class TimeFromUnixTimeInMsDescriptor extends AbstractScalarFunctionDynamicDescriptor {
private final static long serialVersionUID = 1L;
- public final static FunctionIdentifier FID = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
- "time-from-unix-time-in-ms", 1);
+ public final static FunctionIdentifier FID = AsterixBuiltinFunctions.TIME_FROM_UNIX_TIME_IN_MS;
// allowed input types
private final static byte SER_NULL_TYPE_TAG = ATypeTag.NULL.serialize();
@@ -102,8 +102,10 @@
aTime.setValue(AInt32SerializerDeserializer.getInt(argOut.getByteArray(), 1));
} else {
throw new AlgebricksException(
- "Inapplicable input type for function time-from-unix-time-in-ms: expecting integer or null type, but got "
- + argOut.getByteArray()[0]);
+ FID.getName()
+ + ": expects input type INT8/INT16/INT32/NULL but got "
+ + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut
+ .getByteArray()[0]));
}
timeSerde.serialize(aTime, out);
}