Join Streams

Join two windows into a stream.

The example creates two schemas named StocksSchema and OptionsSchema, followed by an input window named InStocks that references StocksSchema, and an input window named InOptions that references OptionsSchema.

The example creates an output join stream named OutStockOption that joins the InStocks and InOptions input windows using their symbol values.

CREATE OUTPUT STREAM OutStockOption AS 
	SELECT InStocks.Ts Ts , 
		InStocks.Symbol Symbol , 
		InStocks.Price StockPrice , 
		InStocks.Volume StockVolume , 
		InOptions.StockSymbol OptionStockSymbol ,		InOptions.OptionSymbol OptionSymbol , 
		InOptions.Price OptionPrice, 
		InOptions.Volume OptionVolume
	FROM InStocks   JOIN InOptions 
  	on    	InStocks.Symbol = InOptions.StockSymbol    
;

The example creates two ATTACH ADAPTER instances named csvInConn1 and csvInOptions. A File CSV Input adapter is attached to the InStocks window in one instance, and the InOptions window in another instance.

Finally, the example attaches a File CSV Output adapter named Adapter1 to OutStockOptions to publish the results of the join stream.

ATTACH OUTPUT ADAPTER Adapter1 
	TYPE dsv_out 
	TO OutStockOption 
	PROPERTIES 
		dir='../exampleoutput',  
		file = 'joinstream.csv' ,
 		outputBase =TRUE , 
 		hasHeader = TRUE 
 		;