mad*_*lik 2 dictionary cassandra
我的问题是,如果Cassandra的地图数据类型支持3个文字..在下面的例子中,声明了两个文字之间的映射.
CREATE TABLE abc(id text PRIMARY KEY, fans map<text, text>);
Run Code Online (Sandbox Code Playgroud)
我可以用吗...
CREATE TABLE abc(id text PRIMARY KEY, fans map<text, text, int>);
Run Code Online (Sandbox Code Playgroud)
除了BryceAtNetwork23的答案,您还可以通过以下方式创建文本地图 - >(text,int):
CREATE TABLE abc (
id text PRIMARY KEY,
fans map<text,frozen<tuple<text,int>>>
);
Run Code Online (Sandbox Code Playgroud)
然后,您可以进行以下更新:
update abc set fans = {'a' : ('hello', 1) } where id = 'helloworld';
Run Code Online (Sandbox Code Playgroud)
并检索如下数据:
cqlsh:test> select * from abc;
id | fans
------------+---------------------
helloworld | {'a': ('hello', 1)}
Run Code Online (Sandbox Code Playgroud)