Unions

Use a UNION operator in your CCL query to combine the results of two or more queries into a single result.

If the UNION is on a Window or Delta Stream, duplicate rows are eliminated from the result set due to the primary key. If the UNION is on a Stream, duplicates flow through.

The input for a UNION operator comes from one or more streams or windows. Its output is a set of records representing the union of the inputs. This example shows a simple union between two windows, InStocks and InOptions:
CREATE INPUT WINDOW InStocks 
	SCHEMA StocksSchema 
	Primary Key (Ts)
;

CREATE INPUT WINDOW InOptions 
	SCHEMA OptionsSchema 
	Primary Key (Ts) 
;
CREATE output  Window  Union1  
	SCHEMA OptionsSchema
	PRIMARY KEY DEDUCED
	AS SELECT s.Ts as Ts, s.Symbol as StockSymbol, 
	       Null as OptionSymbol, s.Price as Price, s.Volume as Volume    
	 FROM InStocks s 
UNION 
	SELECT s.Ts as Ts, s.StockSymbol as StockSymbol,
           s.OptionSymbol as OptionSymbol,  s.Price as Price, 
           s.Volume as Volume
    FROM InOptions s
;