Create default, memory, and log stores.
The example creates a memory store named MemStore, a default store named DefaultStore, and a log store named LogStore. Each store retains their default parameter values.
CREATE MEMORY STORE MemStore PROPERTIES INDEXSIZEHINT = 8 , INDEXTYPE = 'TREE' ; CREATE DEFAULT MEMORY STORE DefaultStore PROPERTIES INDEXSIZEHINT = 8 , INDEXTYPE = 'TREE' ; CREATE LOG STORE LogStore PROPERTIES FILENAME = 'mylog.log' , MAXFILESIZE = 8 , SYNC = FALSE , SWEEPAMOUNT = 20 , RESERVEPCT = 20 , CKCOUNT= 10000 ;
The example creates an input window named TradesWindowMem that references MemStore and an output window named DefaultStoreWindow that uses SELECT all (*) syntax to retrieve all data columns from TradesWindowMem.
CREATE INPUT WINDOW TradesWindowMem SCHEMA (Ts bigdatetime , Symbol STRING, Price MONEY(2), Volume INTEGER) PRIMARY KEY (Ts) STORE MemStore; CREATE OUTPUT WINDOW DefaultStoreWindow PRIMARY KEY ( Ts) AS SELECT * FROM TradesWindowMem ;
The example creates an output window named LogStoreWindow that references LogStore. LogStoreWindow uses SELECT and FROM clauses to pull timestamp, price, symbol, and volume data from TradesWindowMem.
CREATE Output WINDOW LogStoreWindow SCHEMA (Ts bigdatetime , Symbol STRING, Price MONEY(2), Volume INTEGER) PRIMARY KEY ( Ts,Symbol) STORE LogStore AS SELECT now() Ts, tw.Symbol, tw.Price, tw.Volume FROM TradesWindowMem tw;
The example attaches a File CSV Input adapter named InConn to TradesWindowMem.
ATTACH INPUT ADAPTER InConn TYPE dsv_in TO TradesWindowMem PROPERTIES blockSize=1, dateFormat='%Y/%m/%d %H:%M:%S', delimiter=',', dir='../exampledata', expectStreamNameOpcode=false, fieldCount=0, file='stock-trades.csv', filePattern='*.csv', hasHeader=false, safeOps=false, skipDels=false, timestampFormat='%Y/%m/%d %H:%M:%S';