collections - Cassandra map 中的重复键

标签 collections cassandra hashmap cassandra-3.0

Cassandra map 实现是Map还是MultiMap?换句话说,Cassandra 是否允许映射类型中存在重复键?基于this example ,如果我打电话

UPDATE cycling.cyclist_teams SET teams = teams + {2009 : 'First team'} WHERE id = 5b6962dd-3f90-4c93-8f61-eabfa4a803e2;

然后

UPDATE cycling.cyclist_teams SET teams = teams + {2009 : 'Second team'} WHERE id = 5b6962dd-3f90-4c93-8f61-eabfa4a803e2;

那么数据库将如下所示:A)

teams[2009]: 'Second team'

或者这个:B)

teams[2009]: 'First team'
teams[2009]: 'Second team'

最佳答案

documentation对此非常明确:

A map relates one item to another with a key-value pair. For each key, only one value may exist, and duplicates cannot be stored. Both the key and the value are designated with a data type.

也就是说,该值将被覆盖,就像 java HashMap 的情况一样。结果将是 {2009 : 'Second team'}

关于collections - Cassandra map 中的重复键,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53030591/

相关文章:

java - 检查枚举集是否有相同的枚举值

c++ - 通过模板滥用的函数式 C++

python - 来自 python 中的两个数组/列表的哈希

java - HashMap 对象 ~ myMap 是在公共(public) Java 方法中创建的

database - 使用cassandra查询和删除聊天收件箱系统

java - 是否存在使用 equals 方法进行 key 检查的 map ?

java - 如何将父类(super class)型列表转换为子类型列表?

java - 比较java中的2个列表

Cassandra 如何查看事件用户连接

scala - phantom-dsl_2.11 错误隐式 session