可以使用分区内存表并行加速,代码优化如下:
def alpha147SQL(vector) { ... } input = select tradingdate, symbol, closeprice from loadTable("dfs://shenwan", "level2") where tradingdate = 2020.01.02 db = database("", HASH, [SYMBOL, 20]) pt = db.createPartitionedTable(input, "input", `symbol) pt.append!(input) timer(10) { pnodeRun(clearAllCache) } timer alpha147DDBSql = select alpha147SQL(closeprice) from pt context by symbol