Skip to main content

firstTimeBatch (Window)

A batch-time or tumbling window that holds the unique events according to the unique key parameters that have arrived within the time period of that window and gets updated for each such time window. When a new event arrives with a key which is already in the window, that event is not processed by the window.

Syntax

unique:firstTimeBatch(<INT|LONG|FLOAT|BOOL|DOUBLE|STRING> unique.key, <INT|LONG> window.time)
unique:firstTimeBatch(<INT|LONG|FLOAT|BOOL|DOUBLE|STRING> unique.key, <INT|LONG> window.time, <INT|LONG> start.time)

Query Parameters

NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
unique.keyThe attribute that should be checked for uniqueness.INT LONG FLOAT BOOL DOUBLE STRINGNoYes
window.timeThe sliding time period for which the window should hold events.INT LONGNoNo
start.timeThis specifies an offset in milliseconds in order to start the window at a time different to the standard time.Timestamp of the first event.INT LONGYesNo

Example 1

CREATE STREAM CseEventStream (symbol string, price float, volume int)

from CseEventStream WINDOW UNIQUE:firstTimeBatch(symbol,1 sec)
select symbol, price, volume
insert all events into OutputStream ;

This holds the first unique events that arrive from the cseEventStream input stream during each second, based on the symbol,as a batch, and returns all the events to the OutputStream.