gpt4 book ai didi

Cassandra:向表中添加新列

转载 作者:行者123 更新时间:2023-12-05 00:56:34 24 4
gpt4 key购买 nike

嗨,我刚刚在表 my_table 中添加了一个新列 Business_sys:

   ALTER TABLE my_table ALTER business_sys TYPE set<text>;

但是我再次删除了这个列名,因为我想更改列的类型:
  ALTER TABLE my_table DROP business_sys;

再次当我尝试添加不同类型的相同列名称时,我收到错误消息
"Cannnot add a collection with the name business_sys because the collection with the same name and different type has already been used in past"

我只是尝试执行此命令以添加不同类型的新列-
  ALTER TABLE my_table ADD business_sys list<text>;

我做错了什么?我对 Cassandra 很陌生。有什么建议?

最佳答案

您遇到了 CASSANDRA-6276 .问题是当您在 Cassandra 中删除一列时,该列中的数据不会消失,并且 Cassandra 可能会尝试使用其新的比较器类型读取该数据。

从链接的 JIRA 票证:

Unfortunately, we can't allow dropping a component from the comparator, including dropping individual collection columns from ColumnToCollectionType. If we do allow that, and have pre-existing data of that type, C* simply wouldn't know how to compare those...

...even if we did, and allowed [users] to create a different collection with the same name, we'd hit a different issue: the new collection's comparator would be used to compare potentially incompatible types.



JIRA 建议这在 Cassandra 3.x 中可能不是问题,但我只是在 3.0.3 中尝试过它并且失败并出现相同的错误。

What did I do wrong? I am pretty new to Cassandra. Any suggestions?



不幸的是,解决这个问题的唯一方法是为您的新列表使用不同的名称。

关于Cassandra:向表中添加新列,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36124795/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com