Search in sources :

Example 1 with FunctionExpression

use of org.apache.phoenix.expression.function.FunctionExpression in project phoenix by apache.

the class ParseNodeFactory method initBuiltInFunctionMap.

/**
     * Reflect this class and populate static structures from it.
     * Don't initialize in static block because we have a circular dependency
     */
private static synchronized void initBuiltInFunctionMap() {
    if (!BUILT_IN_FUNCTION_MAP.isEmpty()) {
        return;
    }
    Class<? extends FunctionExpression> f = null;
    try {
        // Reflection based parsing which yields direct explicit function evaluation at runtime
        for (int i = 0; i < CLIENT_SIDE_BUILT_IN_FUNCTIONS.size(); i++) {
            f = CLIENT_SIDE_BUILT_IN_FUNCTIONS.get(i);
            addBuiltInFunction(f);
        }
        for (ExpressionType et : ExpressionType.values()) {
            Class<? extends Expression> ec = et.getExpressionClass();
            if (FunctionExpression.class.isAssignableFrom(ec)) {
                @SuppressWarnings("unchecked") Class<? extends FunctionExpression> c = (Class<? extends FunctionExpression>) ec;
                addBuiltInFunction(f = c);
            }
        }
    } catch (Exception e) {
        throw new RuntimeException("Failed initialization of built-in functions at class '" + f + "'", e);
    }
}
Also used : FunctionExpression(org.apache.phoenix.expression.function.FunctionExpression) ExpressionType(org.apache.phoenix.expression.ExpressionType) TypeMismatchException(org.apache.phoenix.schema.TypeMismatchException) SQLException(java.sql.SQLException)

Aggregations

SQLException (java.sql.SQLException)1 ExpressionType (org.apache.phoenix.expression.ExpressionType)1 FunctionExpression (org.apache.phoenix.expression.function.FunctionExpression)1 TypeMismatchException (org.apache.phoenix.schema.TypeMismatchException)1