replayDS

Syntax

replayDS(sqlObj, [dateColumn], [timeColumn], [timeRepartitionSchema])

Arguments

sqlObj is metacode with SQL statements. The table object in the SQL statement is a DFS table and must use a DATE type column as one of the partitioning columns.

dateColumn and timeColumn are strings indicating the names of date and time columns of the DFS table. A data source is generated for each day of dateColumn. If neither is specified, the first column of the table object is chosen as dateColumn. If dateColumn is specified, it must be one of the partitioning columns of the DFS table. If only timeColumn is specified, it must be one of the partitioning columns of the DFS table.

timeRepartitionSchema is a vector of temporal type. timeRepartitionSchema deliminates multiple data sources based on timeColumn within each date. For example, if timeRepartitionSchema =[t1, t2, t3], then there are 4 data sources within each day: [00:00:00.000,t1), [t1,t2), [t2,t3), and [t3,23:59:59.999).

Details

Generate a group of data sources from a DFS table to be used as the inputs of function replay.

Examples

$ n=int(60*60*6.5)
$ sym = take(take(`IBM,n).join(take(`GS,n)), n*2*3)
$ date=take(2021.01.04..2021.01.06, n*2*3).sort!()
$ time=take(09:30:00..15:59:59,n*2*3)
$ volume = rand(100, n*2*3)
$ t=table(sym,date,time,volume)
$ if(existsDatabase("dfs://test_stock")){
$ dropDatabase("dfs://test_stock")
$ }
$ db1=database("",RANGE, 2021.01.04..2021.01.06)
$ db2=database("",VALUE,`IBM`GS)
$ db=database("dfs://test_stock",COMPO,[db1, db2])
$ trades=db.createPartitionedTable(t,`trades,`date`sym)
$ trades.append!(t);
$ ds = replayDS(sqlObj=<select * from loadTable(db, `trades)>, dateColumn=`date, timeColumn=`time)
$ ds.size();
3

$ ds = replayDS(sqlObj=<select * from loadTable(db, `trades)>, dateColumn=`date, timeColumn=`time, timeRepartitionSchema=[11:30:00, 14:00:00])
$ ds.size();
9