@Override public IAggregateEvaluatorFactory createAggregateFunctionFactory(AggregateFunctionCallExpression expr, IVariableTypeEnvironment env, IOperatorSchema[] inputSchemas, JobGenContext context) throws AlgebricksException { Function fn = (Function) expr.getFunctionInfo(); IScalarEvaluatorFactory[] argFactories = createArgumentEvaluatorFactories(env, inputSchemas, context, expr.getArguments()); try { return fn.createAggregateEvaluatorFactory(argFactories); } catch (SystemException e) { throw new AlgebricksException(e); } }
@Override public String visitAggregateFunctionCallExpression(AggregateFunctionCallExpression expr, Integer indent) throws AlgebricksException { if (expr.isTwoStep()) { IFunctionInfo step1Agg = expr.getStepOneAggregate(); String step1 = (step1Agg != null ? step1Agg.getFunctionIdentifier().toString() : "null"); IFunctionInfo step2Agg = expr.getStepTwoAggregate(); String step2 = (step2Agg != null ? step2Agg.getFunctionIdentifier().toString() : "null"); StringBuilder sb = new StringBuilder(); sb.append("function-call: [" + step1 + "|" + step2 + "], Args:"); appendArguments(sb, expr.getArguments(), indent + 2); return sb.toString(); } else if (expr.getFunctionInfo() == null) { StringBuilder sb = new StringBuilder(); sb.append("function-call: [null], Args:"); appendArguments(sb, expr.getArguments(), indent + 2); return sb.toString(); } else { return appendFunction(new StringBuilder(), expr, indent).toString(); } }
@Override public ILogicalExpression visitAggregateFunctionCallExpression(AggregateFunctionCallExpression expr, Void arg) throws AlgebricksException { AggregateFunctionCallExpression exprCopy = new AggregateFunctionCallExpression(expr.getFunctionInfo(), expr.isTwoStep(), deepCopyExpressionReferenceList(expr.getArguments())); exprCopy.setStepOneAggregate(expr.getStepOneAggregate()); exprCopy.setStepTwoAggregate(expr.getStepTwoAggregate()); deepCopyAnnotations(expr, exprCopy); deepCopyOpaqueParameters(expr, exprCopy); copySourceLocation(expr, exprCopy); return exprCopy; }