public abstract class AbstractAggregateFunction extends AbstractFunction
This object handles full expressions being passed as parameters to the aggregate function. The expression is evaluated for each set in the group. Therefore the aggregate function, avg(length(description)) will find the average length of the description column. sum(price * quantity) will find the sum of the price * quantity of each set in the group.
Constructor and Description |
---|
AbstractAggregateFunction(String name,
Expression[] params)
Constructs an aggregate function.
|
Modifier and Type | Method and Description |
---|---|
abstract TObject |
evalAggregate(GroupResolver group,
QueryContext context,
TObject val1,
TObject val2)
Evaluates the aggregate function for the given values and returns the
result.
|
TObject |
evaluate(GroupResolver group,
VariableResolver resolver,
QueryContext context)
Evaluates the function and returns a TObject that represents the result
of the function.
|
TObject |
postEvalAggregate(GroupResolver group,
QueryContext context,
TObject result)
Called just before the value is returned to the parent.
|
allElements, allVariables, getName, getParameter, init, isAggregate, isGlob, parameterCount, prepareParameters, returnTType, returnTType, setAggregate, toString
public AbstractAggregateFunction(String name, Expression[] params)
public abstract TObject evalAggregate(GroupResolver group, QueryContext context, TObject val1, TObject val2)
NOTE: This first time this method is called on a set, 'val1' is 'null' and 'val2' contains the first value in the set.
public TObject postEvalAggregate(GroupResolver group, QueryContext context, TObject result)
public final TObject evaluate(GroupResolver group, VariableResolver resolver, QueryContext context)
Function
Copyright © 2015. All rights reserved.