当我尝试使用contains关键字检索表"Cannot use CONTAINS relation on non collection column col1"
时,它会提示,但是当我尝试使用
CREATE TABLE test (id int,address map<text, int>,mail list<text>,phone set<int>,primary key (id,address,mail,phone));
它提示 "Invalid collection type for PRIMARY KEY component phone"
Cassandra的基本知识之一是您不能修改主键。始终牢记这一点。
除非将其冻结,否则不能将其用作主键,这意味着您无法对其进行修改。
这会工作
CREATE TABLE test (id int,address frozen<map<text, int>>,mail frozen<list<text>>,phone frozen<set<int>>,primary key (id,address,mail,phone));;
但是,我认为您应该看一下此文档:http : //www.datastax.com/dev/blog/cql-in-2-1
您可以在cql 2.1之后将二级索引放在集合上。您可能要使用该功能。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句