Class NStreamOuterQueryPlanBuilder

java.lang.Object
com.espertech.esper.common.internal.epl.join.queryplanbuild.NStreamOuterQueryPlanBuilder

public class NStreamOuterQueryPlanBuilder extends Object
Builds a query plan for 3 or more streams in a outer join.
  • 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 ExprValidationException
      Recusivly 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 for
      queryGraph - contains where-clause stream relationship info
      outerInnerGraph - contains the outer join stream relationship info
      completedStreams - is a temporary holder for streams already considered
      substreamsPerStream - is the ordered, tree-like structure to be filled
      requiredPerStream - indicates which streams are required and which are optional
      streamCallStack - the query plan call stack of streams available via cursor
      dependencyGraph - - dependencies between historical streams
      innerJoinGraph - 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 ExprValidationException
      Recusivly 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 for
      queryGraph - contains where-clause stream relationship info
      completedStreams - is a temporary holder for streams already considered
      substreamsPerStream - is the ordered, tree-like structure to be filled
      streamCallStack - the query plan call stack of streams available via cursor
      dependencyGraph - - 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 streams
      outerJoinDescList - - list of outer join stream numbers and property names
      Returns:
      graph object
    • verifyJoinedPerStream

      public 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. all streams are included and none are listed twice.
      Parameters:
      rootStream - is the stream supplying the incoming event
      streamsJoinedPerStream - is keyed by the from-stream number and contains as values all stream numbers of lookup into to-streams.
    • print

      public static String print(Map<Integer,int[]> streamsJoinedPerStream)
      Returns textual presentation of stream-substream relationships.
      Parameters:
      streamsJoinedPerStream - is the tree-like structure of stream-substream
      Returns:
      textual presentation