如何将数据插入到Cassandra中的地图集合类型中定义的UDT中?

时间:2016-10-25 10:39:27

标签: json database collections cassandra user-defined-types

    CREATE TABLE darshan.b_tweet (
        screen_name text PRIMARY KEY,
        user_id map<text, frozen<tit>>
    ) WITH bloom_filter_fp_chance = 0.01
        AND caching = {'keys': 'ALL', 'rows_per_partition': 'NONE'}
        AND comment = ''
        AND compaction = {'class': 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy', 'max_threshold': '32', 'min_threshold': '4'}
        AND compression = {'chunk_length_in_kb': '64', 'class': 'org.apache.cassandra.io.compress.LZ4Compressor'}
        AND crc_check_chance = 1.0
        AND dclocal_read_repair_chance = 0.1
        AND default_time_to_live = 0
        AND gc_grace_seconds = 864000
        AND max_index_interval = 2048
        AND memtable_flush_period_in_ms = 0
        AND min_index_interval = 128
        AND read_repair_chance = 0.0
        AND speculative_retry = '99PERCENTILE';

冷冻型&#39; tit&#39;定义为

CREATE TYPE darshan.tit (
    mentions map<text, text>,
    hashtags set<text>
);

当我尝试插入时,会给我一个错误。

    INSERT INTO b_tweet(screen_name , user_id ) VALUES ('maker',{'5567878':{mentions:{ 'hi':'554545'},hashtags:'byePk'}})    
    InvalidRequest: code=2200 [Invalid query] message="Invalid map literal for user_id: value {mentions: {'hi': '554545'}, hashtags: 'byePk'} is not of type frozen<tit>"

如何将数据插入此内容?

0 个答案:

没有答案