An unnamed window is an implicitly created stateful element that cannot be referenced or used elsewhere in a project.
An unnamed window is implicitly created when the KEEP clause is used with a source name in the FROM clause of a statement.
This example creates an unnamed window on the input Trades for the MaxTradePrice window to keep track of a maximum trade price for all symbols seen within the last 10000 trades:
CREATE WINDOW MaxTradePrice PRIMARY KEY DEDUCED STORE S1 AS SELECT trd.Symbol, max(trd.Price) MaxPrice FROM Trades trd KEEP 10000 ROWS GROUP BY trd.Symbol;
This example creates an unnamed window on Trades, and MaxTradePrice keeps track of the maximum trade price for all the symbols during the last 10 minutes of trades:
CREATE WINDOW MaxTradePrice PRIMARY KEY DEDUCED STORE S1 AS SELECT trd.Symbol, max(trd.Price) MaxPrice FROM Trades trd KEEP 10 MINUTES GROUP BY trd.Symbol;
This example creates a TotalCost Unnamed Window from the source stream Trades. Jumping Window will retain ten rows, and clear all rows on the arrival of the 11th row.
CREATE DELTA STREAM TotalCost PRIMARY KEY DEDUCTED AS SELECT trd.*, trd.Price * trd.Size TotalCst FROM Trades trd KEEP EVERY 10 ROWS;
In all three examples, Trades can be a delta stream, or a window.