创建内存表时报错Invalid table column type 25

创建带有array vector的内存表会报错,例如执行下面语句:

res = table(1:0,`factor_id`factor_name`funcs`type, [STRING, STRING, ANY, STRING])

报错:192.168.1.206:10010 Server response: 'res = table(1 : 0, ["factor_id","factor_name","funcs","type"], [18,18,25,18]) => Invalid table column type 25'


请先 登录 后评论

1 个回答

wale

创建内存表时,DolphinDB 支持将元素不等长的普通元组存储为列式元组。

$ sym = `st1`st2`st3
$ price = [[3.1,2.5,2.8], [3.1,3.3], [3.2,2.9,3.3]]
$ t = table(sym, price)
$ t;

sym price
--- -------------
st1 [3.1,2.5,2.8]
st2 [3.1,3.3]
st3 [3.2,2.9,3.3]

注意:对于元素等长的普通元组,必须调用 setColumnarTuple!() 转换为列式元组 。

$ id = 1 2 3
$ val = [[1,2,3], [4,5,6],[7,8,9]]
$ table(id, val)
id  col1    col2    col3
1   1       4       7
2   2       5       8
3   3       6       9

$ table(id, val.setColumnarTuple!())
id val
-- -------
1  [1,2,3]
2  [4,5,6]
3  [7,8,9]
请先 登录 后评论