在Cassandra中更改列的类型 [英] Change the type of a column in Cassandra
问题描述
我创建了一个表 my_table
,该表的列为 phone
,该列已声明为类型varint。
输入一些数据后,我意识到,如果将此列声明为 list< int>会更好。
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>.
我尝试过:
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.
更新:假设我创建了一个新列 phonelist
的类型列表< int>
。有什么有效的方法可以将 phone
列中的数据移到 phonelist
列中?
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?
推荐答案
您不能将现有列的类型更改为地图或集合。
You cannot change the type of an existing column to a map or collection.
该表格显示了允许的数据类型更改
The table shows the allowed alterations for data types
这篇关于在Cassandra中更改列的类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!