Cassandra + 数据插入 + set<FROZEN<map<text,text>>>

Cassandra + data insertion + set<FROZEN<map<text,text>>>

我的列族结构是:

create table mykeyspc."test" (
id int PRIMARY KEY,
val set<frozen<map<text,text>>>
);

当我通过 CQL 插入数据时 shell

insert into "test" JSON '{"id":1,"val":{"ab","bc"}}';
Error: INVALIDREQUEST: code=2200 [Invalid query] message="Counld not decode JSon string as 
map:org.codehaus.jackson.jsonParseException: Unexpected character{'{'{ code 123}) 

insert into "test" (id,val) values (1,{{'ab','bc'},{'sdf','name'}});
Error: INVALIDREQUEST: code=2200 [Invalid query] message="INVALID SET LITERAL FOR
VAL:value{'a','b'} is not of type frozen<map<text,text>>"

在您的第二个示例中,尝试使用冒号 : 而不是逗号分隔地图 key/values。

aploetz@cqlsh:Whosebug> INSERT INTO mapOfSet (id,val) 
                             VALUES (1,{{'ab':'bc'},{'sdf':'name'}});
aploetz@cqlsh:Whosebug> SELECT * FROm mapofset WHERE id=1;

 id | val
----+---------------------------------
  1 | {{'ab': 'bc'}, {'sdf': 'name'}}

(1 rows)