Search in sources :

Example 1 with IExternalFunctionInfo

use of org.apache.asterix.om.functions.IExternalFunctionInfo in project asterixdb by apache.

the class QueryLogicalExpressionJobGen method createScalarFunctionEvaluatorFactory.

private IScalarEvaluatorFactory createScalarFunctionEvaluatorFactory(AbstractFunctionCallExpression expr, IVariableTypeEnvironment env, IOperatorSchema[] inputSchemas, JobGenContext context) throws AlgebricksException {
    IScalarEvaluatorFactory[] args = codegenArguments(expr, env, inputSchemas, context);
    IFunctionDescriptor fd = null;
    if (!(expr.getFunctionInfo() instanceof IExternalFunctionInfo)) {
        IDataFormat format = FormatUtils.getDefaultFormat();
        fd = format.resolveFunction(expr, env);
    } else {
        ICcApplicationContext appCtx = (ICcApplicationContext) context.getAppContext();
        fd = ExternalFunctionDescriptorProvider.getExternalFunctionDescriptor((IExternalFunctionInfo) expr.getFunctionInfo(), appCtx);
    }
    return fd.createEvaluatorFactory(args);
}
Also used : IFunctionDescriptor(org.apache.asterix.om.functions.IFunctionDescriptor) ICcApplicationContext(org.apache.asterix.common.dataflow.ICcApplicationContext) IDataFormat(org.apache.asterix.formats.base.IDataFormat) IExternalFunctionInfo(org.apache.asterix.om.functions.IExternalFunctionInfo) IScalarEvaluatorFactory(org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory)

Aggregations

ICcApplicationContext (org.apache.asterix.common.dataflow.ICcApplicationContext)1 IDataFormat (org.apache.asterix.formats.base.IDataFormat)1 IExternalFunctionInfo (org.apache.asterix.om.functions.IExternalFunctionInfo)1 IFunctionDescriptor (org.apache.asterix.om.functions.IFunctionDescriptor)1 IScalarEvaluatorFactory (org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory)1