使用元编程sqlUpdate函数,动态构造需要置为0或者NULL的列。
sym = `C`C`C`C`MS`MS`MS`IBM`IBM time = [09:34:57, 09:34:59, 09:35:01, 09:35:02, 09:34:57, 09:34:59, 09:35:01, 09:35:01, 09:35:02] price= 50.6 50.62 50.63 50.64 29.46 29.48 29.5 174.97 175.02 t = select price from table(sym, time, price) pivot by time, sym updates = array(STRING, 0) for(colName in t.colNames()) { append!(updates, "NULL as " + colName) } sqlUpdate(table=t, updates=parseExpr(updates), where=<rowNo(time) = 0>).eval()