Jumping Windows retain data for a specified interval of time or for a specified number of rows and delete all retained rows when the specified interval of time expires, or the specified number of rows is exceeded.
Tuples are the sets of data that are retained in the Window. Insert tuples affect retention, yet the arrival of update and/or delete tuples does not trigger the retention mechanism.
CREATE SCHEMA TradesSchema ( Id integer, Symbol string, Price float, Volume integer ) ;
CREATE INPUT WINDOW Trades SCHEMA TradesSchema PRIMARY KEY (Id) ;
The example then creates various types of Jumping Windows.
This creates a Jumping Window named Every5Rows from the source stream Trades. This window retains a maximum of five rows then deletes all five retained rows on the arrival of a new row.
CREATE OUTPUT WINDOW Every5Rows PRIMARY KEY DEDUCED KEEP EVERY 5 ROWS AS SELECT * FROM Trades ;
This creates a Jumping Window named Every5Seconds from the source stream Trades. This window retains rows for a maximum of five seconds then deletes all retained rows when the time interval expires.
CREATE OUTPUT WINDOW Every5Seconds PRIMARY KEY DEDUCED KEEP EVERY 5 SECONDS AS SELECT * FROM Trades ;
This creates an unnamed Jumping Window from the source stream Trades. This window retains a maximum of five rows for each unique value of Symbol then deletes all five retained rows upon the arrival of a sixth row with the same Symbol value.
CREATE OUTPUT WINDOW Every5RowsPerSymbol PRIMARY KEY DEDUCED AS SELECT * FROM Trades KEEP EVERY 5 ROWS PER(Symbol)
The example concludes by attaching the XML Input Adapter to Trades to process the incoming stream data.
ATTACH INPUT ADAPTER xmlInConn1 TYPE xml_in TO Trades PROPERTIES blockSize=1, dir='../exampledata', file='Trades.xml', filePattern='*.xml', safeOps=false, skipDels=false ;