目前,DolphinDB的分布式表不支持在创建后修改字段类型。
解决方案:
(1)创建一个新的修改字段类型后的分布式表
(2)将旧的分布式表的数据在线同步过来,首先分批次读到一个内存表中,可以通过下面的脚本进行内存表数据类型的内存转换
sym = `C`MS`MS`MS`IBM`IBM`C`C`C price= 49.6 29.46 29.52 30.02 174.97 175.23 50.76 50.32 51.29 qty = 2200 1900 2100 3200 6800 5400 1300 2500 8800 timestamp = [09:34:07,09:36:42,09:36:51,09:36:59,09:32:47,09:35:26,09:34:16,09:34:26,09:38:12] t = table(timestamp, sym, qty, price) syms = symbol(exec sym from t) replaceColumn!(t, `sym, syms)
(3)通过append函数将转换类型后的内存表写入分布式表