net.esper.eql.expression
Class ResultSetProcessorRowPerGroup

java.lang.Object
  extended by net.esper.eql.expression.ResultSetProcessorRowPerGroup
All Implemented Interfaces:
ResultSetProcessor

public class ResultSetProcessorRowPerGroup
extends java.lang.Object
implements ResultSetProcessor

Result set processor for the fully-grouped case: there is a group-by and all non-aggregation event properties in the select clause are listed in the group by, and there are aggregation functions.

Produces one row for each group that changed (and not one row per event). Computes MultiKey group-by keys for each event and uses a set of the group-by keys to generate the result rows, using the first (old or new, anyone) event for each distinct group-by key.


Constructor Summary
ResultSetProcessorRowPerGroup(SelectExprProcessor selectExprProcessor, AggregationService aggregationService, java.util.List<ExprNode> groupKeyNodes, ExprNode optionalHavingNode, boolean isOutputLimiting, boolean isOutputLimitLastOnly)
          Ctor.
 
Method Summary
 EventType getResultEventType()
          Returns the event type of processed results.
 Pair<EventBean[],EventBean[]> processJoinResult(java.util.Set<MultiKey<EventBean>> newEvents, java.util.Set<MultiKey<EventBean>> oldEvents)
          For use by joins posting their result, process the event rows that are entered and removed (new and old events).
 Pair<EventBean[],EventBean[]> processViewResult(EventBean[] newData, EventBean[] oldData)
          For use by views posting their result, process the event rows that are entered and removed (new and old events).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResultSetProcessorRowPerGroup

public ResultSetProcessorRowPerGroup(SelectExprProcessor selectExprProcessor,
                                     AggregationService aggregationService,
                                     java.util.List<ExprNode> groupKeyNodes,
                                     ExprNode optionalHavingNode,
                                     boolean isOutputLimiting,
                                     boolean isOutputLimitLastOnly)
Ctor.

Parameters:
selectExprProcessor - - for processing the select expression and generting the final output rows
aggregationService - - handles aggregation
groupKeyNodes - - list of group-by expression nodes needed for building the group-by keys
optionalHavingNode - - expression node representing validated HAVING clause, or null if none given. Aggregation functions in the having node must have been pointed to the AggregationService for evaluation.
isOutputLimiting - - true to indicate we are output limiting and must keep producing a row per group even if groups didn't change
isOutputLimitLastOnly - - true if output limiting and interested in last event only
Method Detail

getResultEventType

public EventType getResultEventType()
Description copied from interface: ResultSetProcessor
Returns the event type of processed results.

Specified by:
getResultEventType in interface ResultSetProcessor
Returns:
event type of the resulting events posted by the processor.

processJoinResult

public Pair<EventBean[],EventBean[]> processJoinResult(java.util.Set<MultiKey<EventBean>> newEvents,
                                                       java.util.Set<MultiKey<EventBean>> oldEvents)
Description copied from interface: ResultSetProcessor
For use by joins posting their result, process the event rows that are entered and removed (new and old events). Processes according to select-clauses, group-by clauses and having-clauses and returns new events and old events as specified.

Specified by:
processJoinResult in interface ResultSetProcessor
Parameters:
newEvents - - new events posted by join
oldEvents - - old events posted by join
Returns:
pair of new events and old events

processViewResult

public Pair<EventBean[],EventBean[]> processViewResult(EventBean[] newData,
                                                       EventBean[] oldData)
Description copied from interface: ResultSetProcessor
For use by views posting their result, process the event rows that are entered and removed (new and old events). Processes according to select-clauses, group-by clauses and having-clauses and returns new events and old events as specified.

Specified by:
processViewResult in interface ResultSetProcessor
Parameters:
newData - - new events posted by view
oldData - - old events posted by view
Returns:
pair of new events and old events