|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.esper.eql.expression.ExprNode
net.esper.eql.expression.ExprAggregateNode
public abstract class ExprAggregateNode
Base expression node that represents an aggregation function such as 'sum' or 'count'.
In terms of validation each concrete aggregation node must implement it's own validation.
In terms of evaluation this base class will ask the assigned AggregationResultFuture
for the current state,
using a column number assigned to the node.
Concrete subclasses must supply an aggregation state prototype node Aggregator
that reflects
each group's (there may be group-by critera) current aggregation state.
Field Summary | |
---|---|
protected boolean |
isDistinct
Indicator for whether the aggregation is distinct - i.e. |
Constructor Summary | |
---|---|
protected |
ExprAggregateNode(boolean distinct)
Ctor. |
Method Summary | |
---|---|
boolean |
equalsNode(ExprNode node)
Return true if a expression node semantically equals the current node, or false if not. |
protected abstract boolean |
equalsNodeAggregate(ExprAggregateNode node)
Return true if a expression aggregate node semantically equals the current node, or false if not. |
Object |
evaluate(EventBean[] events,
boolean isNewData)
Evaluate event tuple and return result. |
static void |
getAggregatesBottomUp(ExprNode topNode,
List<ExprAggregateNode> aggregateNodes)
Populates into the supplied list all aggregation functions within this expression, if any. |
protected abstract Aggregator |
getAggregationFunction()
Returns the aggregation state prototype for use in grouping aggregation states per group-by keys. |
protected abstract String |
getAggregationFunctionName()
Returns the aggregation function name for representation in a generate expression string. |
Aggregator |
getPrototypeAggregator()
Returns the aggregation state prototype for use in grouping aggregation states per group-by keys. |
boolean |
isDistinct()
Returns true if the aggregation node is only aggregatig distinct values, or false if aggregating all values. |
void |
setAggregationResultFuture(AggregationResultFuture aggregationResultFuture,
int column)
Assigns to the node the future which can be queried for the current aggregation state at evaluation time. |
String |
toExpressionString()
Renders the aggregation function expression. |
protected Class |
validateSingleNumericChild(StreamTypeService streamTypeService)
For use by implementing classes, validates the aggregation node expecting a single numeric-type child node. |
Methods inherited from class net.esper.eql.expression.ExprNode |
---|
accept, addChildNode, deepEquals, dumpDebug, getChildNodes, getValidatedSubtree |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface net.esper.eql.expression.ExprValidator |
---|
getType, validate |
Field Detail |
---|
protected boolean isDistinct
Constructor Detail |
---|
protected ExprAggregateNode(boolean distinct)
distinct
- - sets the flag indicatating whether only unique values should be aggregatedMethod Detail |
---|
public Aggregator getPrototypeAggregator()
protected abstract Aggregator getAggregationFunction()
protected abstract String getAggregationFunctionName()
protected abstract boolean equalsNodeAggregate(ExprAggregateNode node)
For use by the equalsNode implementation which compares the distinct flag.
node
- to compare to
public void setAggregationResultFuture(AggregationResultFuture aggregationResultFuture, int column)
aggregationResultFuture
- - future containing statecolumn
- - column to hand to future for easy accesspublic final Object evaluate(EventBean[] events, boolean isNewData)
ExprEvaluator
events
- - event tupleisNewData
- - indicates whether we are dealing with new data (istream) or old data (rstream)
public static void getAggregatesBottomUp(ExprNode topNode, List<ExprAggregateNode> aggregateNodes)
Populates by going bottom-up such that nested aggregates appear first.
I.e. sum(volume * sum(price)) would put first A then B into the list with A=sum(price) and B=sum(volume * A)
topNode
- is the expression node to deep inspectaggregateNodes
- is a list of node to populate intopublic boolean isDistinct()
public final boolean equalsNode(ExprNode node)
ExprNode
Concrete implementations should compare the type and any additional information that impact the evaluation of a node.
equalsNode
in class ExprNode
node
- to compare to
protected final Class validateSingleNumericChild(StreamTypeService streamTypeService) throws ExprValidationException
streamTypeService
- - types represented in streams
ExprValidationException
- if the validation failedpublic final String toExpressionString()
toExpressionString
in class ExprNode
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |