Apama 10.15.0 | Developing Apama Applications | Developing Apama Applications in EPL | Working with Streams and Stream Queries | Defining stream queries | Adding window definitions to from and join clauses
 
Adding window definitions to from and join clauses
 
Window definition syntax
Defining time-based windows
Defining size-based windows
Combining time-based and size-based windows
Defining batched windows
Partitioning streams
Partitions and aggregate functions
Using multiple partition by expressions
Partitioning time-based windows
Defining content-dependent windows
The items flowing through a stream are ordered. In any given activation, there are zero or more items that are current. By default, the stream query operates on those current items.
Alternatively, a window may be defined. Window definitions specify which items the query should operate on in each activation, based on (but not limited to) the following:
*The items within a given time period
*A maximum number of items
*The content of the items
As the window contents change, the items in the query projection will also change: new items will be inserted and old ones removed. The output from a query is a stream of items. 
If the projection is an aggregate projection then the query output is the result of evaluation of the select clause when the window contents change. See Aggregating items in projections.
If the projection is a simple, non-aggregate projection, the default output is the insert stream (or istream for short) of new projected items. Alternatively, if the rstream keyword is specified in the select clause, the output is the remove stream (or rstream) of items that have become obsolete. See also Obtaining the query's remove stream (rstream).