com.espertech.esper.epl.core
Class ResultSetProcessorSimple

java.lang.Object
  extended by com.espertech.esper.epl.core.ResultSetProcessorBaseSimple
      extended by com.espertech.esper.epl.core.ResultSetProcessorSimple
All Implemented Interfaces:
ResultSetProcessor

public class ResultSetProcessorSimple
extends ResultSetProcessorBaseSimple

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, OrderByProcessor orderByProcessor, ExprNode optionalHavingNode, boolean isSelectRStream)
          Ctor.
 
Method Summary
 void clear()
          Clear out current state.
 Iterator<EventBean> getIterator(Set<MultiKey<EventBean>> joinSet)
          Returns the iterator for iterating over a join-result.
 Iterator<EventBean> getIterator(Viewable parent)
          Returns the iterator implementing the group-by and aggregation and order-by logic specific to each case of use of these construct.
 EventType getResultEventType()
          Returns the event type of processed results.
protected static EventBean[] getSelectEventsHaving(SelectExprProcessor exprProcessor, EventBean[] events, ExprNode optionalHavingNode, boolean isNewData, boolean isSynthesize)
          Applies the select-clause to the given events returning the selected events.
protected static EventBean[] getSelectEventsHaving(SelectExprProcessor exprProcessor, OrderByProcessor orderByProcessor, EventBean[] events, ExprNode optionalHavingNode, boolean isNewData, boolean isSynthesize)
          Applies the select-clause to the given events returning the selected events.
protected static void getSelectEventsHaving(SelectExprProcessor exprProcessor, OrderByProcessor orderByProcessor, EventBean[] events, ExprNode optionalHavingNode, boolean isNewData, boolean isSynthesize, List<EventBean> result, List<MultiKeyUntyped> optSortKeys)
          Applies the select-clause to the given events returning the selected events.
protected static EventBean[] getSelectEventsHaving(SelectExprProcessor exprProcessor, OrderByProcessor orderByProcessor, Set<MultiKey<EventBean>> events, ExprNode optionalHavingNode, boolean isNewData, boolean isSynthesize)
          Applies the select-clause to the given events returning the selected events.
protected static void getSelectEventsHaving(SelectExprProcessor exprProcessor, OrderByProcessor orderByProcessor, Set<MultiKey<EventBean>> events, ExprNode optionalHavingNode, boolean isNewData, boolean isSynthesize, List<EventBean> result, List<MultiKeyUntyped> optSortKeys)
          Applies the select-clause to the given events returning the selected events.
protected static EventBean[] getSelectEventsHaving(SelectExprProcessor exprProcessor, Set<MultiKey<EventBean>> events, ExprNode optionalHavingNode, boolean isNewData, boolean isSynthesize)
          Applies the select-clause to the given events returning the selected events.
protected static EventBean[] getSelectEventsNoHaving(SelectExprProcessor exprProcessor, EventBean[] events, boolean isNewData, boolean isSynthesize)
          Applies the select-clause to the given events returning the selected events.
protected static EventBean[] getSelectEventsNoHaving(SelectExprProcessor exprProcessor, OrderByProcessor orderByProcessor, EventBean[] events, boolean isNewData, boolean isSynthesize)
          Applies the select-clause to the given events returning the selected events.
protected static void getSelectEventsNoHaving(SelectExprProcessor exprProcessor, OrderByProcessor orderByProcessor, EventBean[] events, boolean isNewData, boolean isSynthesize, List<EventBean> result, List<MultiKeyUntyped> optSortKeys)
          Applies the select-clause to the given events returning the selected events.
protected static EventBean[] getSelectEventsNoHaving(SelectExprProcessor exprProcessor, OrderByProcessor orderByProcessor, Set<MultiKey<EventBean>> events, boolean isNewData, boolean isSynthesize)
          Applies the select-clause to the given events returning the selected events.
protected static void getSelectEventsNoHaving(SelectExprProcessor exprProcessor, OrderByProcessor orderByProcessor, Set<MultiKey<EventBean>> events, boolean isNewData, boolean isSynthesize, List<EventBean> result, List<MultiKeyUntyped> optSortKeys)
          Applies the select-clause to the given events returning the selected events.
protected static EventBean[] getSelectEventsNoHaving(SelectExprProcessor exprProcessor, Set<MultiKey<EventBean>> events, boolean isNewData, boolean isSynthesize)
          Applies the select-clause to the given events returning the selected events.
 UniformPair<EventBean[]> processJoinResult(Set<MultiKey<EventBean>> newEvents, Set<MultiKey<EventBean>> oldEvents, boolean isSynthesize)
          For use by joins posting their result, process the event rows that are entered and removed (new and old events).
 UniformPair<EventBean[]> processViewResult(EventBean[] newData, EventBean[] oldData, boolean isSynthesize)
          For use by views posting their result, process the event rows that are entered and removed (new and old events).
 
Methods inherited from class com.espertech.esper.epl.core.ResultSetProcessorBaseSimple
processOutputLimitedJoin, processOutputLimitedView
 
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,
                                OrderByProcessor orderByProcessor,
                                ExprNode optionalHavingNode,
                                boolean isSelectRStream)
Ctor.

Parameters:
selectExprProcessor - - for processing the select expression and generting the final output rows
orderByProcessor - - for sorting the outgoing events according to the order-by clause
optionalHavingNode - - having clause expression node
isSelectRStream - - true if remove stream events should be generated
Method Detail

getResultEventType

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

Returns:
event type of the resulting events posted by the processor.

processJoinResult

public UniformPair<EventBean[]> processJoinResult(Set<MultiKey<EventBean>> newEvents,
                                                  Set<MultiKey<EventBean>> oldEvents,
                                                  boolean isSynthesize)
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.

Parameters:
newEvents - - new events posted by join
oldEvents - - old events posted by join
isSynthesize - - set to true to indicate that synthetic events are required for an iterator result set
Returns:
pair of new events and old events

processViewResult

public UniformPair<EventBean[]> processViewResult(EventBean[] newData,
                                                  EventBean[] oldData,
                                                  boolean isSynthesize)
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.

Parameters:
newData - - new events posted by view
oldData - - old events posted by view
isSynthesize - - set to true to indicate that synthetic events are required for an iterator result set
Returns:
pair of new events and old events

getSelectEventsNoHaving

protected static EventBean[] getSelectEventsNoHaving(SelectExprProcessor exprProcessor,
                                                     OrderByProcessor orderByProcessor,
                                                     EventBean[] events,
                                                     boolean isNewData,
                                                     boolean isSynthesize)
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
orderByProcessor - - orders the outgoing events according to the order-by clause
events - - input events
isNewData - - indicates whether we are dealing with new data (istream) or old data (rstream)
isSynthesize - - set to true to indicate that synthetic events are required for an iterator result set
Returns:
output events, one for each input event

getSelectEventsNoHaving

protected static EventBean[] getSelectEventsNoHaving(SelectExprProcessor exprProcessor,
                                                     OrderByProcessor orderByProcessor,
                                                     Set<MultiKey<EventBean>> events,
                                                     boolean isNewData,
                                                     boolean isSynthesize)
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
orderByProcessor - - for sorting output events according to the order-by clause
events - - input events
isNewData - - indicates whether we are dealing with new data (istream) or old data (rstream)
isSynthesize - - set to true to indicate that synthetic events are required for an iterator result set
Returns:
output events, one for each input event

getSelectEventsHaving

protected static EventBean[] getSelectEventsHaving(SelectExprProcessor exprProcessor,
                                                   OrderByProcessor orderByProcessor,
                                                   EventBean[] events,
                                                   ExprNode optionalHavingNode,
                                                   boolean isNewData,
                                                   boolean isSynthesize)
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.

Also applies a having clause.

Parameters:
exprProcessor - - processes each input event and returns output event
orderByProcessor - - for sorting output events according to the order-by clause
events - - input events
optionalHavingNode - - supplies the having-clause expression
isNewData - - indicates whether we are dealing with new data (istream) or old data (rstream)
isSynthesize - - set to true to indicate that synthetic events are required for an iterator result set
Returns:
output events, one for each input event

getSelectEventsHaving

protected static EventBean[] getSelectEventsHaving(SelectExprProcessor exprProcessor,
                                                   OrderByProcessor orderByProcessor,
                                                   Set<MultiKey<EventBean>> events,
                                                   ExprNode optionalHavingNode,
                                                   boolean isNewData,
                                                   boolean isSynthesize)
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.

Also applies a having clause.

Parameters:
exprProcessor - - processes each input event and returns output event
orderByProcessor - - for sorting output events according to the order-by clause
events - - input events
optionalHavingNode - - supplies the having-clause expression
isNewData - - indicates whether we are dealing with new data (istream) or old data (rstream)
isSynthesize - - set to true to indicate that synthetic events are required for an iterator result set
Returns:
output events, one for each input event

getIterator

public Iterator<EventBean> getIterator(Viewable parent)
Description copied from interface: ResultSetProcessor
Returns the iterator implementing the group-by and aggregation and order-by logic specific to each case of use of these construct.

Parameters:
parent - is the parent view iterator
Returns:
event iterator

getIterator

public Iterator<EventBean> getIterator(Set<MultiKey<EventBean>> joinSet)
Description copied from interface: ResultSetProcessor
Returns the iterator for iterating over a join-result.

Parameters:
joinSet - is the join result set
Returns:
iterator over join results

clear

public void clear()
Description copied from interface: ResultSetProcessor
Clear out current state.

Specified by:
clear in interface ResultSetProcessor
Overrides:
clear in class ResultSetProcessorBaseSimple

getSelectEventsNoHaving

protected static EventBean[] getSelectEventsNoHaving(SelectExprProcessor exprProcessor,
                                                     EventBean[] events,
                                                     boolean isNewData,
                                                     boolean isSynthesize)
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
isNewData - - indicates whether we are dealing with new data (istream) or old data (rstream)
isSynthesize - - set to true to indicate that synthetic events are required for an iterator result set
Returns:
output events, one for each input event

getSelectEventsNoHaving

protected static EventBean[] getSelectEventsNoHaving(SelectExprProcessor exprProcessor,
                                                     Set<MultiKey<EventBean>> events,
                                                     boolean isNewData,
                                                     boolean isSynthesize)
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
isNewData - - indicates whether we are dealing with new data (istream) or old data (rstream)
isSynthesize - - set to true to indicate that synthetic events are required for an iterator result set
Returns:
output events, one for each input event

getSelectEventsHaving

protected static EventBean[] getSelectEventsHaving(SelectExprProcessor exprProcessor,
                                                   EventBean[] events,
                                                   ExprNode optionalHavingNode,
                                                   boolean isNewData,
                                                   boolean isSynthesize)
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.

Also applies a having clause.

Parameters:
exprProcessor - - processes each input event and returns output event
events - - input events
optionalHavingNode - - supplies the having-clause expression
isNewData - - indicates whether we are dealing with new data (istream) or old data (rstream)
isSynthesize - - set to true to indicate that synthetic events are required for an iterator result set
Returns:
output events, one for each input event

getSelectEventsHaving

protected static EventBean[] getSelectEventsHaving(SelectExprProcessor exprProcessor,
                                                   Set<MultiKey<EventBean>> events,
                                                   ExprNode optionalHavingNode,
                                                   boolean isNewData,
                                                   boolean isSynthesize)
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.

Also applies a having clause.

Parameters:
exprProcessor - - processes each input event and returns output event
events - - input events
optionalHavingNode - - supplies the having-clause expression
isNewData - - indicates whether we are dealing with new data (istream) or old data (rstream)
isSynthesize - - set to true to indicate that synthetic events are required for an iterator result set
Returns:
output events, one for each input event

getSelectEventsNoHaving

protected static void getSelectEventsNoHaving(SelectExprProcessor exprProcessor,
                                              OrderByProcessor orderByProcessor,
                                              EventBean[] events,
                                              boolean isNewData,
                                              boolean isSynthesize,
                                              List<EventBean> result,
                                              List<MultiKeyUntyped> optSortKeys)
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
orderByProcessor - - orders the outgoing events according to the order-by clause
events - - input events
isNewData - - indicates whether we are dealing with new data (istream) or old data (rstream)
isSynthesize - - set to true to indicate that synthetic events are required for an iterator result set
result - is the result event list to populate
optSortKeys - is the result sort key list to populate, for sorting

getSelectEventsNoHaving

protected static void getSelectEventsNoHaving(SelectExprProcessor exprProcessor,
                                              OrderByProcessor orderByProcessor,
                                              Set<MultiKey<EventBean>> events,
                                              boolean isNewData,
                                              boolean isSynthesize,
                                              List<EventBean> result,
                                              List<MultiKeyUntyped> optSortKeys)
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
orderByProcessor - - for sorting output events according to the order-by clause
events - - input events
isNewData - - indicates whether we are dealing with new data (istream) or old data (rstream)
isSynthesize - - set to true to indicate that synthetic events are required for an iterator result set
result - is the result event list to populate
optSortKeys - is the result sort key list to populate, for sorting

getSelectEventsHaving

protected static void getSelectEventsHaving(SelectExprProcessor exprProcessor,
                                            OrderByProcessor orderByProcessor,
                                            EventBean[] events,
                                            ExprNode optionalHavingNode,
                                            boolean isNewData,
                                            boolean isSynthesize,
                                            List<EventBean> result,
                                            List<MultiKeyUntyped> optSortKeys)
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.

Also applies a having clause.

Parameters:
exprProcessor - - processes each input event and returns output event
orderByProcessor - - for sorting output events according to the order-by clause
events - - input events
optionalHavingNode - - supplies the having-clause expression
isNewData - - indicates whether we are dealing with new data (istream) or old data (rstream)
isSynthesize - - set to true to indicate that synthetic events are required for an iterator result set
result - is the result event list to populate
optSortKeys - is the result sort key list to populate, for sorting

getSelectEventsHaving

protected static void getSelectEventsHaving(SelectExprProcessor exprProcessor,
                                            OrderByProcessor orderByProcessor,
                                            Set<MultiKey<EventBean>> events,
                                            ExprNode optionalHavingNode,
                                            boolean isNewData,
                                            boolean isSynthesize,
                                            List<EventBean> result,
                                            List<MultiKeyUntyped> optSortKeys)
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.

Also applies a having clause.

Parameters:
exprProcessor - - processes each input event and returns output event
orderByProcessor - - for sorting output events according to the order-by clause
events - - input events
optionalHavingNode - - supplies the having-clause expression
isNewData - - indicates whether we are dealing with new data (istream) or old data (rstream)
isSynthesize - - set to true to indicate that synthetic events are required for an iterator result set
result - is the result event list to populate
optSortKeys - is the result sort key list to populate, for sorting

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