Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Icon

Description
Tip
iconfalse
titleBefore you add a window query:

You need to add and configure the following:

  • The input stream with the events to be processed by the query.
  • The output stream to which the events processed by the query are directed.

Window queries include a window to select a subset of events to be processed based on a specific criterion. For more information, see Siddhi Query Guide - (Defined) Window .

Form

Once you connect the query to an input stream (source) and an output stream (target), move the cursor over the query and click the settings icon on the window query (shown below) to open the Query Configuration form.

  • Input: This section specifies the stream to be considered as the input stream with the events to which the query needs to be applied. The input stream connected to the query as the source is automatically displayed.
  • Select: This section specifies the attributes to be included in the output. In the Select field, you can select All Attributes to select all the attributes of the events, or select User Defined Attributes to select specific attributes, and the expressions to convert them as required to generate output events.
  • Output: This section specifies the action to be performed on the output event. The fields to be configured in this section are as follows:
    • Operation: This field specifies the operation to be performed on the generated output event (e.g., Insert to insert events to a selected stream/table/window).
    • Into: This field specifies the stream/table/window in which the operation specified need to be performed.
    • For: This field specifies whether the operation needs to be performed for all output events, only current events or for only expired events.
  • Stream Handlers: This section can be used to configure the window. To do this, select Window in the Stream Handler field, and then enter information in the following fields.

    • Window Name: A unique name for the window.
    • Parameter Value: This specifies a criterion based on which the window selects a subset of events to be processed. Multiple parameters can be added by clicking +Attribute.
    Info

    A Siddhi application can have multiple stream handlers. To add another stream handler, click the + Stream Handler. Multiple functions, filters and windows can be defined within the same form as stream handlers.

Example

Image RemovedImage Added

The details entered in the above Query Configuration form creates a query definition with a window as follows:

Code Block
languagesql
from TradeStream#window.time(1 month)
select symbol, avg(price) as averagePrice, sum(amount) as total
insert all events into OutputStream;
Source
Info

A window query can have only one source at a given time.

  • Streams
  • Tables
  • Triggers
  • Windows
Target
  • Streams
  • Tables
  • Windows

...