Cassandra 地图中的重复键
Cassandra duplicate keys in map
Cassandra地图实现是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'}
Cassandra地图实现是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'}