KEEP Clause with AGING Clause

Place KEEP and AGING clauses on an output window.

The example creates a schema named TradeSchema and another schema named TradeAgeSchema which inherits the structure of TradeSchema. TradeAgeSchema also defines two columns named AgeColumn and AgeStartTime.

Create Schema TradeAgeSchema Inherits TradeSchema 
		(AgeColumn integer, 
  AgeStartTime bigdatetime);

The example creates an input window named TradeWindow that references TradeSchema, to which it attaches a File CSV Input adapter.

Finally, the example creates an output window named KeepAgeWindow that references TradeAgeSchema. KeepAgeWindow has a KEEP clause that keeps 20 rows in the window at a time. The example also uses the AGES EVERY syntax to update KeepAgeWindow every 3 seconds until the age column is equal to 10. A SELECT clause places a start time condition on AgeWindow, so that the updates specified by the AGING clause do not start until 6 minutes after the current time.

CREATE OUTPUT WINDOW KeepAgeWindow 
	SCHEMA TradeAgeSchema
 	PRIMARY KEY DEDUCED 
 	KEEP 20 ROWS 
 	AGES EVERY 3 SECONDS SET AgeColumn 10 TIMES FROM AgeStartTime 
AS 
	 SELECT * ,
	 	1 as AgeColumn,
	 	now() + 360000000 as AgeStartTime
	  FROM TradeWindow ;