Delta Streams

Delta streams are stateless elements that can understand all opcodes.

You can use a delta stream anywhere you use a computation, filter, or union, but do not need to maintain a state. A delta stream performs these operations more efficiently than a window because it keeps no state, thereby reducing memory use and increasing speed.

While a delta stream does not maintain state, it can interpret all of the opcodes in incoming event records. The opcodes of output event records depend on the logic implemented by the delta stream.

Example

This example creates a delta stream named DeltaTrades that incorporates the getrowid and now functions.

CREATE LOCAL DELTA STREAM DeltaTrades
	SCHEMA (
		RowId long, 
		Symbol STRING, 
		Ts bigdatetime, 
		Price MONEY(2), 
		Volume INTEGER, 
		ProcessDate bigdatetime )
	PRIMARY KEY (Ts)
AS SELECT  getrowid ( TradesWindow) RowId, 
		TradesWindow.Symbol,
 		TradesWindow.Ts Ts, 
 		TradesWindow.Price, 
 		TradesWindow.Volume, 
 		now() ProcessDate
	FROM TradesWindow 

CREATE OUTPUT WINDOW TradesOut 
	PRIMARY KEY DEDUCED 
AS SELECT * FROM DeltaTrades ;