private static ILogicalExpression afce(Function fn, boolean isTwoStep, ILogicalExpression... argExprs) { List<Mutable<ILogicalExpression>> args = new ArrayList<Mutable<ILogicalExpression>>(); for (ILogicalExpression e : argExprs) { args.add(mutable(e)); } return new AggregateFunctionCallExpression(fn, isTwoStep, args); }
private AggregateOperator getAggregateOperator(IFunctionInfo aggregateFunction, Mutable<ILogicalExpression> aggregateArgs, LogicalVariable aggregateVariable) { List<LogicalVariable> aggregateVariables = new ArrayList<LogicalVariable>(); aggregateVariables.add(aggregateVariable); List<Mutable<ILogicalExpression>> aggregateSequenceArgs = new ArrayList<Mutable<ILogicalExpression>>(); aggregateSequenceArgs.add(aggregateArgs); List<Mutable<ILogicalExpression>> exprs = new ArrayList<Mutable<ILogicalExpression>>(); ILogicalExpression aggregateExp = new AggregateFunctionCallExpression(aggregateFunction, true, aggregateSequenceArgs); Mutable<ILogicalExpression> aggregateExpRef = new MutableObject<ILogicalExpression>(aggregateExp); exprs.add(aggregateExpRef); return new AggregateOperator(aggregateVariables, exprs); }
public static AggregateFunctionCallExpression makeAggregateFunctionExpression(FunctionIdentifier fi, List<Mutable<ILogicalExpression>> args) { IFunctionInfo finfo = getAsterixFunctionInfo(fi); IFunctionInfo fiLocal = aggregateToLocalAggregate.get(finfo); IFunctionInfo fiGlobal = aggregateToGlobalAggregate.get(finfo); if (fiLocal != null && fiGlobal != null) { AggregateFunctionCallExpression fun = new AggregateFunctionCallExpression(finfo, true, args); fun.setStepTwoAggregate(fiGlobal); fun.setStepOneAggregate(fiLocal); return fun; } else { return new AggregateFunctionCallExpression(finfo, false, args); } }
public static AggregateFunctionCallExpression makeSerializableAggregateFunctionExpression(FunctionIdentifier fi, List<Mutable<ILogicalExpression>> args) { IFunctionInfo finfo = getAsterixFunctionInfo(fi); IFunctionInfo serializableFinfo = aggregateToSerializableAggregate.get(finfo); if (serializableFinfo == null) { throw new IllegalStateException( "no serializable implementation for aggregate function " + serializableFinfo); } IFunctionInfo fiLocal = aggregateToLocalAggregate.get(serializableFinfo); IFunctionInfo fiGlobal = aggregateToGlobalAggregate.get(serializableFinfo); if (fiLocal != null && fiGlobal != null) { AggregateFunctionCallExpression fun = new AggregateFunctionCallExpression(serializableFinfo, true, args); fun.setStepTwoAggregate(fiGlobal); fun.setStepOneAggregate(fiLocal); return fun; } else { return new AggregateFunctionCallExpression(serializableFinfo, false, args); } }
private AggregateOperator getAggregateOperator(LogicalVariable unnestVariable, LogicalVariable aggregateVariable) { List<LogicalVariable> aggregateVariables = new ArrayList<LogicalVariable>(); aggregateVariables.add(aggregateVariable); List<Mutable<ILogicalExpression>> aggregateSequenceArgs = new ArrayList<Mutable<ILogicalExpression>>(); Mutable<ILogicalExpression> unnestVariableRef = new MutableObject<ILogicalExpression>( new VariableReferenceExpression(unnestVariable)); aggregateSequenceArgs.add(unnestVariableRef); List<Mutable<ILogicalExpression>> exprs = new ArrayList<Mutable<ILogicalExpression>>(); ILogicalExpression aggregateExp = new AggregateFunctionCallExpression(BuiltinOperators.SEQUENCE, false, aggregateSequenceArgs); Mutable<ILogicalExpression> aggregateExpRef = new MutableObject<ILogicalExpression>(aggregateExp); exprs.add(aggregateExpRef); return new AggregateOperator(aggregateVariables, exprs); }
@Override public AggregateFunctionCallExpression cloneExpression() { cloneAnnotations(); List<Mutable<ILogicalExpression>> clonedArgs = cloneArguments(); AggregateFunctionCallExpression fun = new AggregateFunctionCallExpression(finfo, twoStep, clonedArgs); fun.setStepTwoAggregate(stepTwoAggregate); fun.setStepOneAggregate(stepOneAggregate); fun.setSourceLocation(sourceLoc); // opaqueParameters are not really cloned fun.setOpaqueParameters(getOpaqueParameters()); return fun; }
new AggregateFunctionCallExpression(samplingFun, false, sampledFields); samplingExp.setSourceLocation(sourceLocation); LogicalVariable samplingResultVar = context.newVar(); AbstractFunctionCallExpression rangeMapExp = new AggregateFunctionCallExpression(rangeMapFun, true, arg); rangeMapExp.setSourceLocation(sourceLocation); globalResultVariables.add(context.newVar());
recordVarRef.setSourceLocation(sourceLoc); aggArgList.add(new MutableObject<>(recordVarRef)); AggregateFunctionCallExpression aggExpr = new AggregateFunctionCallExpression( FunctionUtil.getFunctionInfo(BuiltinFunctions.LISTIFY), false, aggArgList); aggExpr.setSourceLocation(sourceLoc);
@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; }
inf.simAggs = new ArrayList<>(); toReplaceSet.add(inf); AggregateFunctionCallExpression aggLocal = new AggregateFunctionCallExpression(fi1, false, newArgs); aggLocal.setSourceLocation(aggFunSourceLoc); pushedExprs.add(new MutableObject<>(aggLocal));
Mutable<ILogicalExpression> aggArgExprRef = new MutableObject<>(unnestVarRef); AggregateFunctionCallExpression aggExpr = new AggregateFunctionCallExpression(FunctionUtil.getFunctionInfo(BuiltinFunctions.LISTIFY), false, new ArrayList<>(Collections.singletonList(aggArgExprRef))); aggExpr.setSourceLocation(sourceLoc);
pBranchVarRef.setSourceLocation(branchExpression.getSourceLocation()); AggregateFunctionCallExpression listifyExpr = new AggregateFunctionCallExpression(FunctionUtil.getFunctionInfo(BuiltinFunctions.LISTIFY), false, Collections.singletonList(new MutableObject<>(pBranchVarRef))); listifyExpr.setSourceLocation(branchExpression.getSourceLocation());