com.espertech.esper.epl.expression
Class ExprSubselectNode

java.lang.Object
  extended by com.espertech.esper.epl.expression.ExprNodeBase
      extended by com.espertech.esper.epl.expression.ExprSubselectNode
All Implemented Interfaces:
ExprEvaluator, ExprEvaluatorEnumeration, ExprNode, ExprValidator, MetaDefItem, java.io.Serializable
Direct Known Subclasses:
ExprSubselectAllSomeAnyNode, ExprSubselectExistsNode, ExprSubselectInNode, ExprSubselectRowNode

public abstract class ExprSubselectNode
extends ExprNodeBase
implements ExprEvaluator, ExprEvaluatorEnumeration

Represents a subselect in an expression tree.

See Also:
Serialized Form

Field Summary
static ExprSubselectNode[] EMPTY_SUBSELECT_ARRAY
           
protected  ExprEvaluator filterExpr
          The validate filter expression.
protected  EventType rawEventType
          The event type generated for wildcard selects.
protected  java.lang.String[] selectAsNames
           
protected  ExprNode[] selectClause
          The validated select clause.
protected  ExprEvaluator[] selectClauseEvaluator
           
protected  java.lang.String statementName
           
protected  int subselectNumber
           
 
Constructor Summary
ExprSubselectNode(StatementSpecRaw statementSpec)
          Ctor.
 
Method Summary
 boolean equalsNode(ExprNode node)
          Return true if a expression node semantically equals the current node, or false if not.
abstract  java.lang.Object evaluate(EventBean[] eventsPerStream, boolean isNewData, java.util.Collection<EventBean> matchingEvents, ExprEvaluatorContext exprEvaluatorContext)
          Evaluate the lookup expression returning an evaluation result object.
 java.lang.Object evaluate(EventBean[] eventsPerStream, boolean isNewData, ExprEvaluatorContext exprEvaluatorContext)
          Evaluate event tuple and return result.
abstract  java.util.Collection<EventBean> evaluateGetCollEvents(EventBean[] eventsPerStream, boolean isNewData, java.util.Collection<EventBean> matchingEvents, ExprEvaluatorContext exprEvaluatorContext)
           
abstract  java.util.Collection evaluateGetCollScalar(EventBean[] eventsPerStream, boolean isNewData, java.util.Collection<EventBean> matchingEvents, ExprEvaluatorContext exprEvaluatorContext)
           
 java.util.Collection<EventBean> evaluateGetROCollectionEvents(EventBean[] eventsPerStream, boolean isNewData, ExprEvaluatorContext exprEvaluatorContext)
           
 java.util.Collection evaluateGetROCollectionScalar(EventBean[] eventsPerStream, boolean isNewData, ExprEvaluatorContext exprEvaluatorContext)
           
 ExprEvaluator getExprEvaluator()
           
 ExprEvaluator getFilterExpr()
          Returns filter expr or null if none.
 StreamTypeService getFilterSubqueryStreamTypes()
          Return stream types.
 EventType getRawEventType()
          Returns the event type.
 ExprNode[] getSelectClause()
          Returns the select clause or null if none.
 StatementSpecCompiled getStatementSpecCompiled()
          Returns the compiled statement spec.
 StatementSpecRaw getStatementSpecRaw()
          Returns the uncompiled statement spec.
 int getSubselectNumber()
           
 boolean isAggregatedSubquery()
           
abstract  boolean isAllowMultiColumnSelect()
           
 boolean isConstantResult()
          Returns true if the expression node's evaluation value doesn't depend on any events data, as must be determined at validation time, which is bottom-up and therefore reliably allows each node to determine constant value.
 boolean isFilterStreamSubselect()
           
 void setAggregatedSubquery(boolean aggregatedSubquery)
           
 void setFilterExpr(ExprEvaluator filterExpr)
          Sets the validated filter expression, or null if there is none.
 void setFilterStreamSubselect(boolean filterStreamSubselect)
           
 void setFilterSubqueryStreamTypes(StreamTypeService filterSubqueryStreamTypes)
          Set stream types.
 void setRawEventType(EventType rawEventType)
          Sets the event type generated for wildcard selects.
 void setSelectAsNames(java.lang.String[] selectAsNames)
          Supplies the name of the select expression as-tag
 void setSelectClause(ExprNode[] selectClause)
          Sets the validate select clause
 void setStatementSpecCompiled(StatementSpecCompiled statementSpecCompiled, int subselectNumber)
          Supplies a compiled statement spec.
 void setStrategy(ExprSubselectStrategy strategy)
          Sets the strategy for boiling down the table of lookup events into a subset against which to run the filter.
static ExprSubselectNode[] toArray(java.util.List<ExprSubselectNode> subselectNodes)
           
 java.lang.String toExpressionString()
          Returns the expression node rendered as a string.
 void validate(ExprValidationContext validationContext)
           
abstract  void validateSubquery(ExprValidationContext validationContext)
           
 
Methods inherited from class com.espertech.esper.epl.expression.ExprNodeBase
accept, accept, acceptChildnodes, addChildNode, addChildNodes, addChildNodeToFront, getChildNodes, replaceUnlistedChildNode, setChildNode, setChildNodes
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.espertech.esper.epl.expression.ExprEvaluator
getEventType, getType
 
Methods inherited from interface com.espertech.esper.epl.expression.ExprEvaluatorEnumeration
evaluateGetEventBean, getComponentTypeCollection, getEventTypeCollection, getEventTypeSingle
 

Field Detail

EMPTY_SUBSELECT_ARRAY

public static final ExprSubselectNode[] EMPTY_SUBSELECT_ARRAY

selectClause

protected ExprNode[] selectClause
The validated select clause.


selectClauseEvaluator

protected transient ExprEvaluator[] selectClauseEvaluator

selectAsNames

protected java.lang.String[] selectAsNames

filterExpr

protected transient ExprEvaluator filterExpr
The validate filter expression.


rawEventType

protected transient EventType rawEventType
The event type generated for wildcard selects.


statementName

protected java.lang.String statementName

subselectNumber

protected int subselectNumber
Constructor Detail

ExprSubselectNode

public ExprSubselectNode(StatementSpecRaw statementSpec)
Ctor.

Parameters:
statementSpec - is the lookup statement spec from the parser, unvalidated
Method Detail

evaluate

public abstract java.lang.Object evaluate(EventBean[] eventsPerStream,
                                          boolean isNewData,
                                          java.util.Collection<EventBean> matchingEvents,
                                          ExprEvaluatorContext exprEvaluatorContext)
Evaluate the lookup expression returning an evaluation result object.

Parameters:
eventsPerStream - is the events for each stream in a join
isNewData - is true for new data, or false for old data
matchingEvents - is filtered results from the table of stored lookup events
exprEvaluatorContext - context for expression evalauation
Returns:
evaluation result

evaluateGetCollEvents

public abstract java.util.Collection<EventBean> evaluateGetCollEvents(EventBean[] eventsPerStream,
                                                                      boolean isNewData,
                                                                      java.util.Collection<EventBean> matchingEvents,
                                                                      ExprEvaluatorContext exprEvaluatorContext)

evaluateGetCollScalar

public abstract java.util.Collection evaluateGetCollScalar(EventBean[] eventsPerStream,
                                                           boolean isNewData,
                                                           java.util.Collection<EventBean> matchingEvents,
                                                           ExprEvaluatorContext exprEvaluatorContext)

isAllowMultiColumnSelect

public abstract boolean isAllowMultiColumnSelect()

validateSubquery

public abstract void validateSubquery(ExprValidationContext validationContext)
                               throws ExprValidationException
Throws:
ExprValidationException

getExprEvaluator

public ExprEvaluator getExprEvaluator()
Specified by:
getExprEvaluator in interface ExprNode

isConstantResult

public boolean isConstantResult()
Description copied from interface: ExprNode
Returns true if the expression node's evaluation value doesn't depend on any events data, as must be determined at validation time, which is bottom-up and therefore reliably allows each node to determine constant value.

Specified by:
isConstantResult in interface ExprNode
Returns:
true for constant evaluation value, false for non-constant evaluation value

validate

public void validate(ExprValidationContext validationContext)
              throws ExprValidationException
Specified by:
validate in interface ExprValidator
Throws:
ExprValidationException

setStatementSpecCompiled

public void setStatementSpecCompiled(StatementSpecCompiled statementSpecCompiled,
                                     int subselectNumber)
Supplies a compiled statement spec.

Parameters:
statementSpecCompiled - compiled validated filters

getStatementSpecCompiled

public StatementSpecCompiled getStatementSpecCompiled()
Returns the compiled statement spec.

Returns:
compiled statement

setSelectClause

public void setSelectClause(ExprNode[] selectClause)
Sets the validate select clause

Parameters:
selectClause - is the expression representing the select clause

evaluate

public java.lang.Object evaluate(EventBean[] eventsPerStream,
                                 boolean isNewData,
                                 ExprEvaluatorContext exprEvaluatorContext)
Description copied from interface: ExprEvaluator
Evaluate event tuple and return result.

Specified by:
evaluate in interface ExprEvaluator
Parameters:
eventsPerStream - - event tuple
isNewData - - indicates whether we are dealing with new data (istream) or old data (rstream)
exprEvaluatorContext - context for expression evaluation
Returns:
evaluation result, a boolean value for OR/AND-type evalution nodes.

evaluateGetROCollectionEvents

public java.util.Collection<EventBean> evaluateGetROCollectionEvents(EventBean[] eventsPerStream,
                                                                     boolean isNewData,
                                                                     ExprEvaluatorContext exprEvaluatorContext)
Specified by:
evaluateGetROCollectionEvents in interface ExprEvaluatorEnumeration

evaluateGetROCollectionScalar

public java.util.Collection evaluateGetROCollectionScalar(EventBean[] eventsPerStream,
                                                          boolean isNewData,
                                                          ExprEvaluatorContext exprEvaluatorContext)
Specified by:
evaluateGetROCollectionScalar in interface ExprEvaluatorEnumeration

getStatementSpecRaw

public StatementSpecRaw getStatementSpecRaw()
Returns the uncompiled statement spec.

Returns:
statement spec uncompiled

setSelectAsNames

public void setSelectAsNames(java.lang.String[] selectAsNames)
Supplies the name of the select expression as-tag

Parameters:
selectAsNames - is the as-name(s)

setFilterExpr

public void setFilterExpr(ExprEvaluator filterExpr)
Sets the validated filter expression, or null if there is none.

Parameters:
filterExpr - is the filter

toExpressionString

public java.lang.String toExpressionString()
Description copied from interface: ExprNode
Returns the expression node rendered as a string.

Specified by:
toExpressionString in interface ExprNode
Returns:
string rendering of expression

equalsNode

public boolean equalsNode(ExprNode node)
Description copied from interface: ExprNode
Return true if a expression node semantically equals the current node, or false if not.

Concrete implementations should compare the type and any additional information that impact the evaluation of a node.

Specified by:
equalsNode in interface ExprNode
Parameters:
node - to compare to
Returns:
true if semantically equal, or false if not equals

setStrategy

public void setStrategy(ExprSubselectStrategy strategy)
Sets the strategy for boiling down the table of lookup events into a subset against which to run the filter.

Parameters:
strategy - is the looking strategy (full table scan or indexed)

setRawEventType

public void setRawEventType(EventType rawEventType)
Sets the event type generated for wildcard selects.

Parameters:
rawEventType - is the wildcard type (parent view)

getSelectClause

public ExprNode[] getSelectClause()
Returns the select clause or null if none.

Returns:
clause

getFilterExpr

public ExprEvaluator getFilterExpr()
Returns filter expr or null if none.

Returns:
filter

getRawEventType

public EventType getRawEventType()
Returns the event type.

Returns:
type

getFilterSubqueryStreamTypes

public StreamTypeService getFilterSubqueryStreamTypes()
Return stream types.

Returns:
types

setFilterSubqueryStreamTypes

public void setFilterSubqueryStreamTypes(StreamTypeService filterSubqueryStreamTypes)
Set stream types.

Parameters:
filterSubqueryStreamTypes - types

isAggregatedSubquery

public boolean isAggregatedSubquery()

setAggregatedSubquery

public void setAggregatedSubquery(boolean aggregatedSubquery)

getSubselectNumber

public int getSubselectNumber()

setFilterStreamSubselect

public void setFilterStreamSubselect(boolean filterStreamSubselect)

isFilterStreamSubselect

public boolean isFilterStreamSubselect()

toArray

public static ExprSubselectNode[] toArray(java.util.List<ExprSubselectNode> subselectNodes)

© 2006-2011 EsperTech Inc.
All rights reserved.
Visit us at espertech.com