@wale 的方法不错,不过写错了一点。
t = table(1..3 as id,["a,b,c","d,e,f","g,h,i" ] as val)
select id,transpose(loop(split{,","},val)) as `col1`col2`col3 from t
需要在 loop 之后 transpose 之后才是对的。
下面这种数据,想按","split 之后单独成列,表操作怎么写?
def splitColumns(x)
{
a=split(x,",")
return a
}
each(splitColumns,t[`bid_prices])
each(splitColumns, t["bid_prices"]) => Not allowed to create a matrix with type STRING