net.esper.eql.agg
Class AggregationServiceGroupByImpl

java.lang.Object
  extended by net.esper.eql.agg.AggregationServiceBase
      extended by net.esper.eql.agg.AggregationServiceGroupByImpl
All Implemented Interfaces:
AggregationResultFuture, AggregationService

public class AggregationServiceGroupByImpl
extends AggregationServiceBase

Implementation for handling aggregation with grouping by group-keys.


Field Summary
 
Fields inherited from class net.esper.eql.agg.AggregationServiceBase
aggregators, evaluators
 
Constructor Summary
AggregationServiceGroupByImpl(ExprEvaluator[] evaluators, AggregationMethod[] prototypes, MethodResolutionService methodResolutionService)
          Ctor.
 
Method Summary
 void applyEnter(EventBean[] eventsPerStream, MultiKeyUntyped groupByKey)
          Apply events as entering a window (new events).
 void applyLeave(EventBean[] eventsPerStream, MultiKeyUntyped groupByKey)
          Apply events as leaving a window (old events).
 void clearResults()
          Clear current aggregation state.
 Object getValue(int column)
          Returns current aggregation state, for use by expression node representing an aggregation function.
 void setCurrentRow(MultiKeyUntyped groupByKey)
          Set the current aggregation state row - for use when evaluation nodes are asked to evaluate.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AggregationServiceGroupByImpl

public AggregationServiceGroupByImpl(ExprEvaluator[] evaluators,
                                     AggregationMethod[] prototypes,
                                     MethodResolutionService methodResolutionService)
Ctor.

Parameters:
evaluators - - evaluate the sub-expression within the aggregate function (ie. sum(4*myNum))
prototypes - - collect the aggregation state that evaluators evaluate to, act as prototypes for new aggregations aggregation states for each group
methodResolutionService - - factory for creating additional aggregation method instances per group key
Method Detail

clearResults

public void clearResults()
Description copied from interface: AggregationService
Clear current aggregation state.


applyEnter

public void applyEnter(EventBean[] eventsPerStream,
                       MultiKeyUntyped groupByKey)
Description copied from interface: AggregationService
Apply events as entering a window (new events).

Parameters:
eventsPerStream - - events for each stream entering window
groupByKey - - can be null if grouping without keys is desired, else the keys to use for grouping, each distinct key value results in a new row of aggregation state.

applyLeave

public void applyLeave(EventBean[] eventsPerStream,
                       MultiKeyUntyped groupByKey)
Description copied from interface: AggregationService
Apply events as leaving a window (old events).

Parameters:
eventsPerStream - - events for each stream entering window
groupByKey - - can be null if grouping without keys is desired, else the keys to use for grouping, each distinct key value results in a new row of aggregation state.

setCurrentRow

public void setCurrentRow(MultiKeyUntyped groupByKey)
Description copied from interface: AggregationService
Set the current aggregation state row - for use when evaluation nodes are asked to evaluate.

Parameters:
groupByKey - - key identify the row of aggregation states

getValue

public Object getValue(int column)
Description copied from interface: AggregationResultFuture
Returns current aggregation state, for use by expression node representing an aggregation function.

Parameters:
column - is assigned to the aggregation expression node and passed as an column (index) into a row
Returns:
current aggragation state

© 2007 EsperTech Inc.
All rights reserved.
Visit us at espertech.com