1

I create a dfs table. The script is as below:

db = database("dfs://valuedb", VALUE, 2000.01M..2016.12M)
schemaTable = table(1:0, `symbol`time`price, [STRING, TIMESTAMP, DOUBLE])
pt = db.createPartitionedTable(schemaTable, `pt, `time)

Now, I want to modify the type of symbol from STRING to SYMBOL. Is there a ready-made function?

1 Answers1

0

Currently, DolphinDB's distributed table does not support modifying the field type after creation. solution:

(1) Create a new distributed table after modifying the field type (2) Synchronize the data of the old distributed table online, first read it into a memory table in batches, you can use the following script to perform the memory conversion of the data type of the memory table

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) Write the converted memory table into the distributed table through the append function