Class AbstractAggregationExpression<T,R>
- java.lang.Object
-
- org.apache.qpid.server.query.engine.parsing.expression.AbstractExpressionNode<T,R>
-
- org.apache.qpid.server.query.engine.parsing.expression.function.AbstractFunctionExpression<T,R>
-
- org.apache.qpid.server.query.engine.parsing.expression.function.aggregation.AbstractAggregationExpression<T,R>
-
- Type Parameters:
T- Input parameter typeR- Output parameter type
- All Implemented Interfaces:
java.util.function.Function<T,R>,Expression<T,R>,ExpressionNode<T,R>
- Direct Known Subclasses:
AvgExpression,CountExpression,MaxExpression,MinExpression,SumExpression
public abstract class AbstractAggregationExpression<T,R> extends AbstractFunctionExpression<T,R>
Parent for aggregation function classes
-
-
Field Summary
-
Fields inherited from class org.apache.qpid.server.query.engine.parsing.expression.function.AbstractFunctionExpression
_functionName
-
Fields inherited from class org.apache.qpid.server.query.engine.parsing.expression.AbstractExpressionNode
_metadata
-
-
Constructor Summary
Constructors Constructor Description AbstractAggregationExpression(java.lang.String alias, java.util.List<ExpressionNode<T,?>> args)Constructor initializes children expression list
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract Raggregate(java.util.List<T> items)Aggregation implementationRapply(T value)Should be called after aggregate() method returning cached result.protected java.util.List<?>getArguments(java.util.List<T> items, FunctionParameterTypePredicate<java.lang.Object> _typeValidator)Evaluates and validates input collection valuesabstract CollectorTypegetCollectorType()Type of the collector depends on the aggregation typeExpression<T,R>getSource()voidsetSelect(SelectExpression<T,R> selectExpression)voidsetValue(R value)-
Methods inherited from class org.apache.qpid.server.query.engine.parsing.expression.function.AbstractFunctionExpression
evaluateChild, getFunctionName, getOptionalConstantParameter, getOptionalParameter, getRequiredParameter
-
Methods inherited from class org.apache.qpid.server.query.engine.parsing.expression.AbstractExpressionNode
containsAggregation, ctx, evaluateChild, getAggregations, getAlias, getChild, getChildren, getParent, isAccessor, isInstantlyEvaluable, setAlias, setParent, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.qpid.server.query.engine.parsing.expression.Expression
andThen
-
-
-
-
Constructor Detail
-
AbstractAggregationExpression
public AbstractAggregationExpression(java.lang.String alias, java.util.List<ExpressionNode<T,?>> args)Constructor initializes children expression list- Parameters:
alias- Expression aliasargs- List of children expressions
-
-
Method Detail
-
apply
public R apply(T value)
Should be called after aggregate() method returning cached result. When query contains HAVING clause, extracts result from the nested map.- Parameters:
value- Object to handle- Returns:
- Aggregation result
-
getArguments
protected java.util.List<?> getArguments(java.util.List<T> items, FunctionParameterTypePredicate<java.lang.Object> _typeValidator)
Evaluates and validates input collection values- Parameters:
items- Input collection_typeValidator- Argument type validator- Returns:
- List of evaluated values
-
aggregate
public abstract R aggregate(java.util.List<T> items)
Aggregation implementation- Parameters:
items- Collection to perform aggregation on- Returns:
- Aggregation result
-
getCollectorType
public abstract CollectorType getCollectorType()
Type of the collector depends on the aggregation type- Returns:
- CollectorType instance
-
setValue
public void setValue(R value)
-
setSelect
public void setSelect(SelectExpression<T,R> selectExpression)
-
getSource
public Expression<T,R> getSource()
-
-