Use the SPLITTER construct to separate incoming data according to filtering rules and write it out to different target streams.
When you want to separate incoming data into several subsets and process those subsets differently, use the CREATE SPLITTER construct, which operates like the ANSI case staement. It reads the incoming data, applies the specified filtering conditions and writes out each subset of the data to one or more target streams.
The target stream or delta streams are implicitly defined by the compiler. The schema for the target streams are derived based on the column_list specification. All the targets are defined as either local or output depending on the visibility clause defined for the splitter. The default is local. Note that when the splitter has an output visibility, output adapters can be directly attached to the splitter targets, even though those targets are implicitly defined.
CREATE SCHEMA TradeSchema ( Id long, Symbol STRING, Price MONEY(4), Volume INTEGER, TradeTime DATE ) ; CREATE INPUT WINDOW Trades SCHEMA TradeSchema PRIMARY KEY (Id) ; CREATE SPLITTER IBM_MSFT_Splitter AS WHEN trw.Symbol IN ('IBM', 'MSFT') THEN IBM_MSFT_Trades WHEN trw.Price * trw.Volume > 25000 THEN Large_Trades ELSE Other_Trades SELECT trw. * FROM Trades trw ; CREATE OUTPUT WINDOW IBM_MSFT_TradesWin PRIMARY KEY DEDUCED AS SELECT * FROM IBM_MSFT_Trades ; CREATE OUTPUT WINDOW Large_TradesWin PRIMARY KEY DEDUCED AS SELECT * FROM Large_Trades ; CREATE OUTPUT WINDOW Other_TradesWin PRIMARY KEY DEDUCED AS SELECT * FROM Other_Trades ;