Class FromClause

java.lang.Object
com.espertech.esper.common.client.soda.FromClause
All Implemented Interfaces:
Serializable

public class FromClause extends Object implements Serializable
The from-clause names the streams to select upon.

The most common projected stream is a filter-based stream which is created by FilterStream.

Multiple streams can be joined by adding each stream individually.

Outer joins are also handled by this class. To create an outer join consisting of 2 streams, add one OuterJoinQualifier that defines the outer join relationship between the 2 streams. The outer joins between N streams, add N-1 OuterJoinQualifier qualifiers.

See Also:
  • Constructor Details

    • FromClause

      public FromClause()
      Ctor.
    • FromClause

      public FromClause(Stream streamOne, OuterJoinQualifier outerJoinQualifier, Stream streamTwo)
      Ctor for an outer join between two streams.
      Parameters:
      streamOne - first stream in outer join
      outerJoinQualifier - type of outer join and fields joined on
      streamTwo - second stream in outer join
    • FromClause

      public FromClause(Stream... streamsList)
      Ctor.
      Parameters:
      streamsList - is zero or more streams in the from-clause.
  • Method Details

    • create

      public static FromClause create()
      Creates an empty from-clause to which one adds streams via the add methods.
      Returns:
      empty from clause
    • create

      public static FromClause create(Stream stream, OuterJoinQualifier outerJoinQualifier, Stream streamSecond)
      Creates a from-clause that lists 2 projected streams joined via outer join.
      Parameters:
      stream - first stream in outer join
      outerJoinQualifier - qualifies the outer join
      streamSecond - second stream in outer join
      Returns:
      from clause
    • create

      public static FromClause create(Stream... streams)
      Creates a from clause that selects from a single stream.

      Use FilterStream to create filter-based streams to add.

      Parameters:
      streams - is one or more streams to add to the from clause.
      Returns:
      from clause
    • add

      public FromClause add(Stream stream)
      Adds a stream.

      Use FilterStream to add filter-based streams.

      Parameters:
      stream - to add
      Returns:
      from clause
    • add

      public FromClause add(OuterJoinQualifier outerJoinQualifier)
      Adds an outer join descriptor that defines how the streams are related via outer joins.

      For joining N streams, add N-1 outer join qualifiers.

      Parameters:
      outerJoinQualifier - is the type of outer join and the fields in the outer join
      Returns:
      from clause
    • getStreams

      public List<Stream> getStreams()
      Returns the list of streams in the from-clause.
      Returns:
      list of streams
    • toEPL

      public void toEPL(StringWriter writer, EPStatementFormatter formatter)
      Renders the from-clause in textual representation.
      Parameters:
      writer - to output to
      formatter - for newline-whitespace formatting
    • toEPLOptions

      public void toEPLOptions(StringWriter writer, EPStatementFormatter formatter, boolean includeFrom)
      Renders the from-clause in textual representation.
      Parameters:
      writer - to output to
      includeFrom - flag whether to add the "from" literal
      formatter - for newline-whitespace formatting
    • getOuterJoinQualifiers

      public List<OuterJoinQualifier> getOuterJoinQualifiers()
      Returns the outer join descriptors, if this is an outer join, or an empty list if none of the streams are outer joined.
      Returns:
      list of outer join qualifiers
    • setStreams

      public void setStreams(List<Stream> streams)
      Set the streams.
      Parameters:
      streams - to set
    • setOuterJoinQualifiers

      public void setOuterJoinQualifiers(List<OuterJoinQualifier> outerJoinQualifiers)
      Set outer joins.
      Parameters:
      outerJoinQualifiers - to set