The stream policy (also known as a window policy) is used for continuous queries only. It determines what kind of window is used: a time window, sliding window, or tumbling window. See Working With Sliding, Tumbling, and Time Windows.Note that continuous queries that use an implicit window do not have a stream policy. See Working With Implicit Windows.The value of long literal specifies the size of the window. When used for a time window, the value refers to a time unit specified by time unit. The time unit can be specified in milliseconds, seconds, minutes, hours or days. For example: maintain last 5 minutes defines a time window of five minutes.The optional where clause is used as a pre-filter (a filter on results that enter the window). It eliminates entities that are not useful for the query.Maintaining a single window (like a sliding window) over all the events in the window may not be what you need for a query. The (optional) by clause allows you to do aggregations within the window. In this regard, the by clause is similar to the group by clause.For example, instead of a single window of size 50 that contains all the entities, you can maintain a window of size 50 for each combination of values for the fields in the by section:select car.id, car.color from "CarEvent" {policy: maintain last 50 sliding by country, state, city where type = "Sedan"} car;See Explicit Window Example for a detailed discussion of an example that uses a stream policy. See Time Window Examples for more examples.
Copyright © TIBCO Software Inc. All Rights Reserved.