Class NStreamOuterQueryPlanBuilder
java.lang.Object
com.espertech.esper.common.internal.epl.join.queryplanbuild.NStreamOuterQueryPlanBuilder
Builds a query plan for 3 or more streams in a outer join.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected static QueryPlanForgeDesc
build
(QueryGraphForge queryGraph, OuterJoinDesc[] outerJoinDescList, String[] streamNames, EventType[] typesPerStream, HistoricalViewableDesc historicalViewableDesc, DependencyGraph dependencyGraph, HistoricalStreamIndexListForge[] historicalStreamIndexLists, String[][][] indexedStreamsUniqueProps, TableMetaData[] tablesPerStream, StreamJoinAnalysisResultCompileTime streamJoinAnalysisResult, StatementRawInfo statementRawInfo, StatementCompileTimeServices services) protected static OuterInnerDirectionalGraph
graphOuterJoins
(int numStreams, OuterJoinDesc[] outerJoinDescList) Builds a graph of outer joins given the outer join information from the statement.static String
Returns textual presentation of stream-substream relationships.protected static void
recursiveBuild
(int streamNum, Stack<Integer> streamCallStack, QueryGraphForge queryGraph, OuterInnerDirectionalGraph outerInnerGraph, InnerJoinGraph innerJoinGraph, Set<Integer> completedStreams, LinkedHashMap<Integer, int[]> substreamsPerStream, boolean[] requiredPerStream, DependencyGraph dependencyGraph) Recusivly builds a substream-per-stream ordered tree graph using the join information supplied for outer joins and from the query graph (where clause).protected static void
recursiveBuildInnerJoin
(int streamNum, Stack<Integer> streamCallStack, QueryGraphForge queryGraph, Set<Integer> completedStreams, LinkedHashMap<Integer, int[]> substreamsPerStream, DependencyGraph dependencyGraph) Recusivly builds a substream-per-stream ordered tree graph using the join information supplied for outer joins and from the query graph (where clause).static void
verifyJoinedPerStream
(int rootStream, Map<Integer, int[]> streamsJoinedPerStream) Verifies that the tree-like structure representing which streams join (lookup) into which sub-streams is correct, ie.
-
Constructor Details
-
NStreamOuterQueryPlanBuilder
public NStreamOuterQueryPlanBuilder()
-
-
Method Details
-
build
protected static QueryPlanForgeDesc build(QueryGraphForge queryGraph, OuterJoinDesc[] outerJoinDescList, String[] streamNames, EventType[] typesPerStream, HistoricalViewableDesc historicalViewableDesc, DependencyGraph dependencyGraph, HistoricalStreamIndexListForge[] historicalStreamIndexLists, String[][][] indexedStreamsUniqueProps, TableMetaData[] tablesPerStream, StreamJoinAnalysisResultCompileTime streamJoinAnalysisResult, StatementRawInfo statementRawInfo, StatementCompileTimeServices services) throws ExprValidationException - Throws:
ExprValidationException
-
recursiveBuild
protected static void recursiveBuild(int streamNum, Stack<Integer> streamCallStack, QueryGraphForge queryGraph, OuterInnerDirectionalGraph outerInnerGraph, InnerJoinGraph innerJoinGraph, Set<Integer> completedStreams, LinkedHashMap<Integer, int[]> substreamsPerStream, boolean[] requiredPerStream, DependencyGraph dependencyGraph) throws ExprValidationExceptionRecusivly builds a substream-per-stream ordered tree graph using the join information supplied for outer joins and from the query graph (where clause).Required streams are considered first and their lookup is placed first in the list to gain performance.
- Parameters:
streamNum
- is the root stream number that supplies the incoming event to build the tree forqueryGraph
- contains where-clause stream relationship infoouterInnerGraph
- contains the outer join stream relationship infocompletedStreams
- is a temporary holder for streams already consideredsubstreamsPerStream
- is the ordered, tree-like structure to be filledrequiredPerStream
- indicates which streams are required and which are optionalstreamCallStack
- the query plan call stack of streams available via cursordependencyGraph
- - dependencies between historical streamsinnerJoinGraph
- inner join graph- Throws:
ExprValidationException
- if the query planning failed
-
recursiveBuildInnerJoin
protected static void recursiveBuildInnerJoin(int streamNum, Stack<Integer> streamCallStack, QueryGraphForge queryGraph, Set<Integer> completedStreams, LinkedHashMap<Integer, int[]> substreamsPerStream, DependencyGraph dependencyGraph) throws ExprValidationExceptionRecusivly builds a substream-per-stream ordered tree graph using the join information supplied for outer joins and from the query graph (where clause).Required streams are considered first and their lookup is placed first in the list to gain performance.
- Parameters:
streamNum
- is the root stream number that supplies the incoming event to build the tree forqueryGraph
- contains where-clause stream relationship infocompletedStreams
- is a temporary holder for streams already consideredsubstreamsPerStream
- is the ordered, tree-like structure to be filledstreamCallStack
- the query plan call stack of streams available via cursordependencyGraph
- - dependencies between historical streams- Throws:
ExprValidationException
- if the query planning failed
-
graphOuterJoins
protected static OuterInnerDirectionalGraph graphOuterJoins(int numStreams, OuterJoinDesc[] outerJoinDescList) Builds a graph of outer joins given the outer join information from the statement. Eliminates right and left joins and full joins by placing the information in a graph object.- Parameters:
numStreams
- - is the number of streamsouterJoinDescList
- - list of outer join stream numbers and property names- Returns:
- graph object
-
verifyJoinedPerStream
Verifies that the tree-like structure representing which streams join (lookup) into which sub-streams is correct, ie. all streams are included and none are listed twice.- Parameters:
rootStream
- is the stream supplying the incoming eventstreamsJoinedPerStream
- is keyed by the from-stream number and contains as values all stream numbers of lookup into to-streams.
-
print
Returns textual presentation of stream-substream relationships.- Parameters:
streamsJoinedPerStream
- is the tree-like structure of stream-substream- Returns:
- textual presentation
-