Use multiple output windows to perform stream splitting.
Stream splitting allows you to route data from one stream to multiple streams.
The example creates a schema named TradeSchema and applies that schema to the input window TradeWindow.
The example then creates three output windows named OutMyTrades, OutBigTrades, and OutOtherTrades that split the data from TradeWindow between them.
CREATE OUTPUT WINDOW OutMyTrades SCHEMA TradeSchema PRIMARY KEY (Ts) AS SELECT * from TradeWindow WHERE TradeWindow.Symbol IN ('IBM', 'EBAY') ;
OutMyTrades outputs data from TradeWindow with the symbols IBM or EBAY.
CREATE OUTPUT WINDOW OutBigTrades SCHEMA TradeSchema PRIMARY KEY (Ts) AS SELECT * from TradeWindow WHERE TradeWindow.Price * TradeWindow.Volume > 100000 ;
OutBigTrades outputs data from TradeWindow where the product of TradeWindow.Price * TradeWindow.Volume is greater than 100,000.
CREATE OUTPUT WINDOW OutOtherTrades SCHEMA TradeSchema PRIMARY KEY (Ts) AS SELECT * from TradeWindow WHERE NOT (( TradeWindow.Price * TradeWindow.Volume > 100000 ) OR (TradeWindow.Symbol IN ('IBM', 'EBAY') ) ) ;
OutOtherTrades outputs all data sets that do not meet the conditions placed on the two previous output windows.
The example concludes by attaching the File CSV Input adapter to TradeWindow to process the incoming stream data.