|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.espertech.esper.epl.expression.core.ExprNodeBase
com.espertech.esper.epl.expression.baseagg.ExprAggregateNodeBase
public abstract class ExprAggregateNodeBase
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 AggregationMethod
that reflects
each group's (there may be group-by critera) current aggregation state.
Field Summary | |
---|---|
protected AggregationResultFuture |
aggregationResultFuture
|
protected int |
column
|
protected boolean |
isDistinct
Indicator for whether the aggregation is distinct - i.e. |
protected ExprAggregateLocalGroupByDesc |
optionalAggregateLocalGroupByDesc
|
protected ExprNode[] |
positionalParams
|
Constructor Summary | |
---|---|
protected |
ExprAggregateNodeBase(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 |
equalsNodeAggregateMethodOnly(ExprAggregateNode node)
Return true if a expression aggregate node semantically equals the current node, or false if not. |
java.lang.Object |
evaluate(EventBean[] events,
boolean isNewData,
ExprEvaluatorContext exprEvaluatorContext)
Evaluate event tuple and return result. |
abstract java.lang.String |
getAggregationFunctionName()
Returns the aggregation function name for representation in a generate expression string. |
ExprEvaluator |
getExprEvaluator()
|
AggregationMethodFactory |
getFactory()
Returns the aggregation state factory for use in grouping aggregation states per group-by keys. |
ExprAggregateLocalGroupByDesc |
getOptionalLocalGroupBy()
|
ExprNode[] |
getPositionalParams()
|
ExprPrecedenceEnum |
getPrecedence()
Returns precedence. |
java.lang.Class |
getType()
Returns the type that the node's evaluate method returns an instance of. |
boolean |
isConstantResult()
Returns true if the expression node's evaluation value doesn't depend on any events data, as must be determined at validation time, which is bottom-up and therefore reliably allows each node to determine constant value. |
boolean |
isDistinct()
Returns true if the aggregation node is only aggregatig distinct values, or false if aggregating all values. |
protected boolean |
isExprTextWildcardWhenNoParams()
|
protected ExprValidationException |
makeExceptionExpectedParamNum(int lower,
int upper)
|
void |
setAggregationResultFuture(AggregationResultFuture aggregationResultFuture,
int column)
Assigns to the node the future which can be queried for the current aggregation state at evaluation time. |
void |
toPrecedenceFreeEPL(java.io.StringWriter writer)
|
ExprNode |
validate(ExprValidationContext validationContext)
|
protected abstract AggregationMethodFactory |
validateAggregationChild(ExprValidationContext validationContext)
Gives the aggregation node a chance to validate the sub-expression types. |
void |
validateFilter(ExprEvaluator filterEvaluator)
|
protected java.lang.Class |
validateNumericChildAllowFilter(boolean hasFilter)
For use by implementing classes, validates the aggregation node expecting a single numeric-type child node. |
void |
validatePositionals()
|
Methods inherited from class com.espertech.esper.epl.expression.core.ExprNodeBase |
---|
accept, accept, acceptChildnodes, addChildNode, addChildNodes, addChildNodeToFront, getChildNodes, replaceUnlistedChildNode, setChildNode, setChildNodes, toEPL |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.espertech.esper.epl.expression.core.ExprNode |
---|
accept, accept, acceptChildnodes, addChildNode, addChildNodes, getChildNodes, replaceUnlistedChildNode, setChildNode, setChildNodes, toEPL |
Field Detail |
---|
protected transient AggregationResultFuture aggregationResultFuture
protected int column
protected ExprAggregateLocalGroupByDesc optionalAggregateLocalGroupByDesc
protected ExprNode[] positionalParams
protected boolean isDistinct
Constructor Detail |
---|
protected ExprAggregateNodeBase(boolean distinct)
distinct
- - sets the flag indicatating whether only unique values should be aggregatedMethod Detail |
---|
public abstract java.lang.String getAggregationFunctionName()
protected abstract boolean equalsNodeAggregateMethodOnly(ExprAggregateNode node)
For use by the equalsNode implementation which compares the distinct flag.
node
- to compare to
protected abstract AggregationMethodFactory validateAggregationChild(ExprValidationContext validationContext) throws ExprValidationException
validationContext
- validation information
ExprValidationException
- when expression validation failedpublic ExprNode[] getPositionalParams()
getPositionalParams
in interface ExprAggregateNode
public ExprEvaluator getExprEvaluator()
getExprEvaluator
in interface ExprNode
public boolean isConstantResult()
ExprNode
isConstantResult
in interface ExprNode
public ExprNode validate(ExprValidationContext validationContext) throws ExprValidationException
validate
in interface ExprValidator
ExprValidationException
public void validatePositionals() throws ExprValidationException
validatePositionals
in interface ExprAggregateNode
ExprValidationException
public java.lang.Class getType()
ExprEvaluator
getType
in interface ExprEvaluator
public AggregationMethodFactory getFactory()
getFactory
in interface ExprAggregateNode
public void setAggregationResultFuture(AggregationResultFuture aggregationResultFuture, int column)
setAggregationResultFuture
in interface ExprAggregateNode
aggregationResultFuture
- - future containing statecolumn
- - column to hand to future for easy accesspublic final java.lang.Object evaluate(EventBean[] events, boolean isNewData, ExprEvaluatorContext exprEvaluatorContext)
ExprEvaluator
evaluate
in interface ExprEvaluator
events
- - event tupleisNewData
- - indicates whether we are dealing with new data (istream) or old data (rstream)exprEvaluatorContext
- context for expression evaluation
public boolean isDistinct()
isDistinct
in interface ExprAggregateNode
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 interface ExprNode
node
- to compare to
protected final java.lang.Class validateNumericChildAllowFilter(boolean hasFilter) throws ExprValidationException
ExprValidationException
- if the validation failedprotected ExprValidationException makeExceptionExpectedParamNum(int lower, int upper)
public void toPrecedenceFreeEPL(java.io.StringWriter writer)
toPrecedenceFreeEPL
in class ExprNodeBase
public ExprPrecedenceEnum getPrecedence()
ExprNode
getPrecedence
in interface ExprNode
public void validateFilter(ExprEvaluator filterEvaluator) throws ExprValidationException
ExprValidationException
public ExprAggregateLocalGroupByDesc getOptionalLocalGroupBy()
getOptionalLocalGroupBy
in interface ExprAggregateNode
protected boolean isExprTextWildcardWhenNoParams()
|
© 2006-2015 EsperTech Inc. All rights reserved. Visit us at espertech.com |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |