public abstract class ExprAggregateNodeBase extends ExprNodeBase implements ExprEvaluator, ExprAggregateNode, ExprForgeInstrumentable
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.
Modifier and Type | Field and Description |
---|---|
protected CodegenFieldName |
aggregationResultFutureMemberName |
protected int |
column |
protected boolean |
isDistinct
Indicator for whether the aggregation is distinct - i.e.
|
protected ExprAggregateLocalGroupByDesc |
optionalAggregateLocalGroupByDesc |
protected ExprNode |
optionalFilter |
protected ExprNode[] |
positionalParams |
Modifier | Constructor and Description |
---|---|
protected |
ExprAggregateNodeBase(boolean distinct)
Ctor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equalsNode(ExprNode node,
boolean ignoreStreamPrefix)
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.
|
Object |
evaluate(EventBean[] events,
boolean isNewData,
ExprEvaluatorContext exprEvaluatorContext)
Evaluate event tuple and return result.
|
CodegenExpression |
evaluateCodegen(Class requiredType,
CodegenMethodScope parent,
ExprForgeCodegenSymbol exprSymbol,
CodegenClassScope codegenClassScope) |
CodegenExpression |
evaluateCodegenUninstrumented(Class requiredType,
CodegenMethodScope parent,
ExprForgeCodegenSymbol exprSymbol,
CodegenClassScope codegenClassScope) |
protected CodegenExpression |
getAggFuture(CodegenClassScope codegenClassScope) |
abstract String |
getAggregationFunctionName()
Returns the aggregation function name for representation in a generate expression string.
|
int |
getColumn() |
Class |
getEvaluationType() |
ExprEvaluator |
getExprEvaluator() |
AggregationForgeFactory |
getFactory()
Returns the aggregation state factory for use in grouping aggregation states per group-by keys.
|
ExprForge |
getForge() |
ExprForgeConstantType |
getForgeConstantType() |
ExprNode |
getForgeRenderable() |
ExprNode |
getOptionalFilter() |
ExprAggregateLocalGroupByDesc |
getOptionalLocalGroupBy() |
ExprNode[] |
getPositionalParams() |
ExprPrecedenceEnum |
getPrecedence()
Returns precedence.
|
boolean |
isConstantResult() |
boolean |
isDistinct()
Returns true if the aggregation node is only aggregatig distinct values, or false if
aggregating all values.
|
protected boolean |
isExprTextWildcardWhenNoParams() |
protected abstract boolean |
isFilterExpressionAsLastParameter() |
protected ExprValidationException |
makeExceptionExpectedParamNum(int lower,
int upper) |
void |
setColumn(int column) |
void |
toPrecedenceFreeEPL(StringWriter writer) |
ExprNode |
validate(ExprValidationContext validationContext) |
protected abstract AggregationForgeFactory |
validateAggregationChild(ExprValidationContext validationContext)
Gives the aggregation node a chance to validate the sub-expression types.
|
void |
validateFilter(ExprNode filterEvaluator) |
protected Class |
validateNumericChildAllowFilter(boolean hasFilter) |
void |
validatePositionals(ExprValidationContext validationContext) |
accept, accept, acceptChildnodes, addChildNode, addChildNodes, addChildNodeToFront, checkValidated, checkValidatedException, getChildNodes, replaceUnlistedChildNode, setChildNode, setChildNodes, toEPL
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
accept, accept, acceptChildnodes, addChildNode, addChildNodes, getChildNodes, replaceUnlistedChildNode, setChildNode, setChildNodes
toEPL
protected int column
protected ExprAggregateLocalGroupByDesc optionalAggregateLocalGroupByDesc
protected ExprNode optionalFilter
protected ExprNode[] positionalParams
protected CodegenFieldName aggregationResultFutureMemberName
protected boolean isDistinct
protected ExprAggregateNodeBase(boolean distinct)
distinct
- - sets the flag indicatating whether only unique values should be aggregatedpublic abstract String getAggregationFunctionName()
protected abstract boolean isFilterExpressionAsLastParameter()
protected abstract boolean equalsNodeAggregateMethodOnly(ExprAggregateNode node)
For use by the equalsNode implementation which compares the distinct flag.
node
- to compare toprotected abstract AggregationForgeFactory validateAggregationChild(ExprValidationContext validationContext) throws ExprValidationException
validationContext
- validation informationExprValidationException
- when expression validation failedpublic ExprForgeConstantType getForgeConstantType()
getForgeConstantType
in interface ExprForge
public ExprNode[] getPositionalParams()
getPositionalParams
in interface ExprAggregateNode
public ExprEvaluator getExprEvaluator()
getExprEvaluator
in interface ExprForge
public boolean isConstantResult()
public ExprNode getForgeRenderable()
getForgeRenderable
in interface ExprForge
public ExprNode validate(ExprValidationContext validationContext) throws ExprValidationException
validate
in interface ExprValidator
ExprValidationException
public void validatePositionals(ExprValidationContext validationContext) throws ExprValidationException
validatePositionals
in interface ExprAggregateNode
ExprValidationException
public AggregationForgeFactory getFactory()
getFactory
in interface ExprAggregateNode
public void setColumn(int column)
setColumn
in interface ExprAggregateNode
public final 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 evaluationpublic CodegenExpression evaluateCodegenUninstrumented(Class requiredType, CodegenMethodScope parent, ExprForgeCodegenSymbol exprSymbol, CodegenClassScope codegenClassScope)
evaluateCodegenUninstrumented
in interface ExprForgeInstrumentable
public CodegenExpression evaluateCodegen(Class requiredType, CodegenMethodScope parent, ExprForgeCodegenSymbol exprSymbol, CodegenClassScope codegenClassScope)
evaluateCodegen
in interface ExprForge
public Class getEvaluationType()
getEvaluationType
in interface ExprForge
public boolean isDistinct()
isDistinct
in interface ExprAggregateNode
public final boolean equalsNode(ExprNode node, boolean ignoreStreamPrefix)
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 toignoreStreamPrefix
- when the equals-comparison can ignore prefix of event propertiespublic int getColumn()
getColumn
in interface ExprAggregateNode
protected final Class validateNumericChildAllowFilter(boolean hasFilter) throws ExprValidationException
ExprValidationException
protected ExprValidationException makeExceptionExpectedParamNum(int lower, int upper)
public void toPrecedenceFreeEPL(StringWriter writer)
toPrecedenceFreeEPL
in class ExprNodeBase
public ExprPrecedenceEnum getPrecedence()
ExprNode
getPrecedence
in interface ExprNode
public void validateFilter(ExprNode filterEvaluator) throws ExprValidationException
ExprValidationException
public ExprAggregateLocalGroupByDesc getOptionalLocalGroupBy()
getOptionalLocalGroupBy
in interface ExprAggregateNode
public ExprNode getOptionalFilter()
getOptionalFilter
in interface ExprAggregateNode
protected boolean isExprTextWildcardWhenNoParams()
protected CodegenExpression getAggFuture(CodegenClassScope codegenClassScope)
Copyright © 2005–2018. All rights reserved.