com.espertech.esper.epl.agg.service
Class AggSvcGroupLocalGroupByBase
java.lang.Object
com.espertech.esper.epl.agg.service.AggSvcGroupLocalGroupByBase
- All Implemented Interfaces:
- AggregationResultFuture, AggregationService
- Direct Known Subclasses:
- AggSvcGroupAllLocalGroupBy, AggSvcGroupByLocalGroupBy
public abstract class AggSvcGroupLocalGroupByBase
- extends java.lang.Object
- implements AggregationService
Implementation for handling aggregation with grouping by group-keys.
Method Summary |
void |
accept(AggregationServiceVisitor visitor)
|
void |
acceptGroupDetail(AggregationServiceVisitorWGroupDetail visitor)
|
protected static void |
aggregateIntoEnter(AggregationLocalGroupByLevel level,
AggregationMethod[] methods,
AggregationState[] states,
EventBean[] eventsPerStream,
ExprEvaluatorContext exprEvaluatorContext)
|
protected static void |
aggregateIntoLeave(AggregationLocalGroupByLevel level,
AggregationMethod[] methods,
AggregationState[] states,
EventBean[] eventsPerStream,
ExprEvaluatorContext exprEvaluatorContext)
|
void |
applyEnter(EventBean[] eventsPerStream,
java.lang.Object groupByKeyProvided,
ExprEvaluatorContext exprEvaluatorContext)
Apply events as entering a window (new events). |
void |
applyLeave(EventBean[] eventsPerStream,
java.lang.Object groupByKeyProvided,
ExprEvaluatorContext exprEvaluatorContext)
Apply events as leaving a window (old events). |
void |
clearResults(ExprEvaluatorContext exprEvaluatorContext)
Clear current aggregation state. |
protected static void |
clearResults(java.util.Map<java.lang.Object,AggregationMethodPairRow>[] aggregatorsPerLevelAndGroup,
AggregationMethod[] aggregatorsTopLevel,
AggregationState[] statesTopLevel)
|
protected abstract java.lang.Object |
computeGroupKey(AggregationLocalGroupByLevel level,
java.lang.Object groupKey,
ExprEvaluator[] partitionEval,
EventBean[] eventsPerStream,
boolean newData,
ExprEvaluatorContext exprEvaluatorContext)
|
protected static java.lang.Object |
computeGroupKey(ExprEvaluator[] partitionEval,
EventBean[] eventsPerStream,
boolean b,
ExprEvaluatorContext exprEvaluatorContext)
|
java.util.Map<java.lang.Object,AggregationMethodPairRow>[] |
getAggregatorsPerLevelAndGroup()
|
AggregationMethod[] |
getAggregatorsTopLevel()
|
java.util.Collection<EventBean> |
getCollectionOfEvents(int column,
EventBean[] eventsPerStream,
boolean isNewData,
ExprEvaluatorContext context)
|
java.util.Collection<java.lang.Object> |
getCollectionScalar(int column,
EventBean[] eventsPerStream,
boolean isNewData,
ExprEvaluatorContext context)
|
EventBean |
getEventBean(int column,
EventBean[] eventsPerStream,
boolean isNewData,
ExprEvaluatorContext context)
|
java.lang.Object |
getGroupKey(int agentInstanceId)
|
java.util.Collection<java.lang.Object> |
getGroupKeys(ExprEvaluatorContext exprEvaluatorContext)
|
java.util.List<Pair<java.lang.Integer,java.lang.Object>> |
getRemovedKeys()
|
AggregationState[] |
getStatesTopLevel()
|
void |
handleRemovedKeys()
|
void |
internalHandleGroupRemove(Pair<java.lang.Integer,java.lang.Object> groupByKey)
|
void |
internalHandleUpdatedGroup(int level,
java.lang.Object groupByKey,
AggregationMethodPairRow row)
|
void |
internalHandleUpdatedTop()
|
boolean |
isGrouped()
|
void |
setAggregatorsPerLevelAndGroup(java.util.Map<java.lang.Object,AggregationMethodPairRow>[] aggregatorsPerLevelAndGroup)
|
void |
setAggregatorsTopLevel(AggregationMethod[] aggregatorsTopLevel)
|
void |
setRemovedCallback(AggregationRowRemovedCallback callback)
|
void |
setRemovedKeys(java.util.List<Pair<java.lang.Integer,java.lang.Object>> removedKeys)
|
void |
setStatesTopLevel(AggregationState[] statesTopLevel)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
methodResolutionService
protected final MethodResolutionService methodResolutionService
isJoin
protected final boolean isJoin
localGroupByPlan
protected final AggregationLocalGroupByPlan localGroupByPlan
groupKeyBinding
protected final java.lang.Object groupKeyBinding
aggregatorsTopLevel
protected AggregationMethod[] aggregatorsTopLevel
statesTopLevel
protected AggregationState[] statesTopLevel
aggregatorsPerLevelAndGroup
protected java.util.Map<java.lang.Object,AggregationMethodPairRow>[] aggregatorsPerLevelAndGroup
removedKeys
protected java.util.List<Pair<java.lang.Integer,java.lang.Object>> removedKeys
AggSvcGroupLocalGroupByBase
public AggSvcGroupLocalGroupByBase(MethodResolutionService methodResolutionService,
boolean isJoin,
AggregationLocalGroupByPlan localGroupByPlan,
java.lang.Object groupKeyBinding)
computeGroupKey
protected abstract java.lang.Object computeGroupKey(AggregationLocalGroupByLevel level,
java.lang.Object groupKey,
ExprEvaluator[] partitionEval,
EventBean[] eventsPerStream,
boolean newData,
ExprEvaluatorContext exprEvaluatorContext)
clearResults
public void clearResults(ExprEvaluatorContext exprEvaluatorContext)
- Description copied from interface:
AggregationService
- Clear current aggregation state.
- Specified by:
clearResults
in interface AggregationService
applyEnter
public void applyEnter(EventBean[] eventsPerStream,
java.lang.Object groupByKeyProvided,
ExprEvaluatorContext exprEvaluatorContext)
- Description copied from interface:
AggregationService
- Apply events as entering a window (new events).
- Specified by:
applyEnter
in interface AggregationService
- Parameters:
eventsPerStream
- - events for each stream entering windowgroupByKeyProvided
- - can be null if grouping without keys is desired, else the keys
or array of keys to use for grouping, each distinct key value results in a new row of aggregation state.exprEvaluatorContext
- context for expression evaluatiom
applyLeave
public void applyLeave(EventBean[] eventsPerStream,
java.lang.Object groupByKeyProvided,
ExprEvaluatorContext exprEvaluatorContext)
- Description copied from interface:
AggregationService
- Apply events as leaving a window (old events).
- Specified by:
applyLeave
in interface AggregationService
- Parameters:
eventsPerStream
- - events for each stream entering windowgroupByKeyProvided
- - can be null if grouping without keys is desired, else the keys
or array of keys to use for grouping, each distinct key value results in a new row of aggregation state.exprEvaluatorContext
- context for expression evaluatiom
getCollectionOfEvents
public java.util.Collection<EventBean> getCollectionOfEvents(int column,
EventBean[] eventsPerStream,
boolean isNewData,
ExprEvaluatorContext context)
- Specified by:
getCollectionOfEvents
in interface AggregationResultFuture
getCollectionScalar
public java.util.Collection<java.lang.Object> getCollectionScalar(int column,
EventBean[] eventsPerStream,
boolean isNewData,
ExprEvaluatorContext context)
- Specified by:
getCollectionScalar
in interface AggregationResultFuture
getEventBean
public EventBean getEventBean(int column,
EventBean[] eventsPerStream,
boolean isNewData,
ExprEvaluatorContext context)
- Specified by:
getEventBean
in interface AggregationResultFuture
isGrouped
public boolean isGrouped()
- Specified by:
isGrouped
in interface AggregationService
setRemovedCallback
public void setRemovedCallback(AggregationRowRemovedCallback callback)
- Specified by:
setRemovedCallback
in interface AggregationService
accept
public void accept(AggregationServiceVisitor visitor)
- Specified by:
accept
in interface AggregationService
acceptGroupDetail
public void acceptGroupDetail(AggregationServiceVisitorWGroupDetail visitor)
- Specified by:
acceptGroupDetail
in interface AggregationService
internalHandleUpdatedGroup
public void internalHandleUpdatedGroup(int level,
java.lang.Object groupByKey,
AggregationMethodPairRow row)
internalHandleUpdatedTop
public void internalHandleUpdatedTop()
internalHandleGroupRemove
public void internalHandleGroupRemove(Pair<java.lang.Integer,java.lang.Object> groupByKey)
handleRemovedKeys
public void handleRemovedKeys()
getGroupKey
public java.lang.Object getGroupKey(int agentInstanceId)
- Specified by:
getGroupKey
in interface AggregationResultFuture
getGroupKeys
public java.util.Collection<java.lang.Object> getGroupKeys(ExprEvaluatorContext exprEvaluatorContext)
- Specified by:
getGroupKeys
in interface AggregationResultFuture
computeGroupKey
protected static java.lang.Object computeGroupKey(ExprEvaluator[] partitionEval,
EventBean[] eventsPerStream,
boolean b,
ExprEvaluatorContext exprEvaluatorContext)
aggregateIntoEnter
protected static void aggregateIntoEnter(AggregationLocalGroupByLevel level,
AggregationMethod[] methods,
AggregationState[] states,
EventBean[] eventsPerStream,
ExprEvaluatorContext exprEvaluatorContext)
aggregateIntoLeave
protected static void aggregateIntoLeave(AggregationLocalGroupByLevel level,
AggregationMethod[] methods,
AggregationState[] states,
EventBean[] eventsPerStream,
ExprEvaluatorContext exprEvaluatorContext)
clearResults
protected static void clearResults(java.util.Map<java.lang.Object,AggregationMethodPairRow>[] aggregatorsPerLevelAndGroup,
AggregationMethod[] aggregatorsTopLevel,
AggregationState[] statesTopLevel)
getAggregatorsTopLevel
public AggregationMethod[] getAggregatorsTopLevel()
setAggregatorsTopLevel
public void setAggregatorsTopLevel(AggregationMethod[] aggregatorsTopLevel)
getStatesTopLevel
public AggregationState[] getStatesTopLevel()
setStatesTopLevel
public void setStatesTopLevel(AggregationState[] statesTopLevel)
getAggregatorsPerLevelAndGroup
public java.util.Map<java.lang.Object,AggregationMethodPairRow>[] getAggregatorsPerLevelAndGroup()
setAggregatorsPerLevelAndGroup
public void setAggregatorsPerLevelAndGroup(java.util.Map<java.lang.Object,AggregationMethodPairRow>[] aggregatorsPerLevelAndGroup)
getRemovedKeys
public java.util.List<Pair<java.lang.Integer,java.lang.Object>> getRemovedKeys()
setRemovedKeys
public void setRemovedKeys(java.util.List<Pair<java.lang.Integer,java.lang.Object>> removedKeys)