如何将一个包含几千列的宽表的第一行全部更新为0?

请先 登录 后评论

1 个回答

Juntao Wang

使用元编程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()
请先 登录 后评论
  • 1 关注
  • 0 收藏,841 浏览
  • Johhny 提出于 2022-08-26 11:56