net.esper.eql.expression
Class ResultSetProcessorSimple

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

public class ResultSetProcessorSimple
extends java.lang.Object
implements ResultSetProcessor

Result set processor for the simplest case: no aggregation functions used in the select clause, and no group-by.

The processor generates one row for each event entering (new event) and one row for each event leaving (old event).


Constructor Summary
ResultSetProcessorSimple(SelectExprProcessor selectExprProcessor, boolean isOutputLimiting, boolean isOutputLimitLastOnly)
          Ctor.
 
Method Summary
protected static EventBean[] applyOutputLimit(EventBean[] events, boolean isOutputLimitLastOnly)
          Applies the last/all event output limit clause.
protected static java.util.Set<MultiKey<EventBean>> applyOutputLimit(java.util.Set<MultiKey<EventBean>> eventSet, boolean isOutputLimitLastOnly)
          Applies the last/all event output limit clause.
 EventType getResultEventType()
          Returns the event type of processed results.
protected static EventBean[] getSelectListEvents(SelectExprProcessor exprProcessor, EventBean[] events, boolean isOutputLimiting, boolean isOutputLimitLastOnly)
          Applies the select-clause to the given events returning the selected events.
protected static EventBean[] getSelectListEvents(SelectExprProcessor exprProcessor, java.util.Set<MultiKey<EventBean>> events, boolean isOutputLimiting, boolean isOutputLimitLastOnly)
          Applies the select-clause to the given events returning the selected events.
 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

ResultSetProcessorSimple

public ResultSetProcessorSimple(SelectExprProcessor selectExprProcessor,
                                boolean isOutputLimiting,
                                boolean isOutputLimitLastOnly)
Ctor.

Parameters:
selectExprProcessor - - for processing the select expression and generting the final output rows
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

getSelectListEvents

protected static EventBean[] getSelectListEvents(SelectExprProcessor exprProcessor,
                                                 EventBean[] events,
                                                 boolean isOutputLimiting,
                                                 boolean isOutputLimitLastOnly)
Applies the select-clause to the given events returning the selected events. The number of events stays the same, i.e. this method does not filter it just transforms the result set.

Parameters:
exprProcessor - - processes each input event and returns output event
events - - input events
Returns:
output events, one for each input event

applyOutputLimit

protected static EventBean[] applyOutputLimit(EventBean[] events,
                                              boolean isOutputLimitLastOnly)
Applies the last/all event output limit clause.

Parameters:
events - to output
isOutputLimitLastOnly - - flag to indicate output all versus output last
Returns:
events to output

applyOutputLimit

protected static java.util.Set<MultiKey<EventBean>> applyOutputLimit(java.util.Set<MultiKey<EventBean>> eventSet,
                                                                     boolean isOutputLimitLastOnly)
Applies the last/all event output limit clause.

Parameters:
eventSet - to output
isOutputLimitLastOnly - - flag to indicate output all versus output last
Returns:
events to output

getSelectListEvents

protected static EventBean[] getSelectListEvents(SelectExprProcessor exprProcessor,
                                                 java.util.Set<MultiKey<EventBean>> events,
                                                 boolean isOutputLimiting,
                                                 boolean isOutputLimitLastOnly)
Applies the select-clause to the given events returning the selected events. The number of events stays the same, i.e. this method does not filter it just transforms the result set.

Parameters:
exprProcessor - - processes each input event and returns output event
events - - input events
Returns:
output events, one for each input event