Change the type of a column in Cassandra

跟風遠走 提交于 2019-12-12 10:06:15

问题


I have created a table my_table with a column phone, which has been declared as of type varint. After entering some data, I realized that it would have been better if I had declared this column as list<int>.

I tried to:

ALTER TABLE my_table
ALTER phone TYPE list<int>

but unfortunately I am not allowed to do so. Hopefully, there is a way to make this change.

UPDATE: Assume that I make a new column phonelist of type list<int>. Is there any efficient way to move the data in the phone column into the phonelist column?


回答1:


You cannot change the type of an existing column to a map or collection.

The table shows the allowed alterations for data types



来源:https://stackoverflow.com/questions/39203542/change-the-type-of-a-column-in-cassandra

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!