use of org.apache.asterix.external.classad.AMutableNumberFactor in project asterixdb by apache.
the class ClassAdParser method evaluateFunction.
public ExprTree evaluateFunction(String functionName, ExprList argList) throws HyracksDataException {
Value val = objectPool.valuePool.get();
AMutableNumberFactor factor = objectPool.numFactorPool.get();
ExprTreeHolder tree = objectPool.mutableExprPool.get();
((Literal) argList.get(0)).getComponents(val, factor);
AMutableCharArrayString string_value = objectPool.strPool.get();
if (val.isStringValue(string_value)) {
if (functionName.equalsIgnoreCase("absTime")) {
tree.setInnerTree(Literal.createAbsTime(string_value, objectPool));
} else if (functionName.equalsIgnoreCase("relTime")) {
tree.setInnerTree(Literal.createRelTime(string_value, objectPool));
} else {
tree.setInnerTree(FunctionCall.createFunctionCall(functionName, argList, objectPool));
}
} else {
tree.setInnerTree(FunctionCall.createFunctionCall(functionName, argList, objectPool));
}
return tree;
}
use of org.apache.asterix.external.classad.AMutableNumberFactor in project asterixdb by apache.
the class ClassAdParser method shouldEvaluateAtParseTime.
public boolean shouldEvaluateAtParseTime(String functionName, ExprList argList) throws HyracksDataException {
boolean should_eval = false;
if (functionName.equalsIgnoreCase("absTime") || functionName.equalsIgnoreCase("relTime")) {
if (argList.size() == 1 && argList.get(0).getKind() == NodeKind.LITERAL_NODE) {
Value val = objectPool.valuePool.get();
AMutableNumberFactor factor = objectPool.numFactorPool.get();
((Literal) argList.get(0)).getComponents(val, factor);
if (val.isStringValue()) {
should_eval = true;
}
}
}
return should_eval;
}
Aggregations