Json 如何将数据插入Cassandra中地图集合类型内定义的UDT? 创建表darshan.b_tweet( 屏幕名称文本主键, 用户id映射 )使用bloom_过滤器时,fp_概率=0.01 和缓存={'keys':'ALL','rows\u per\u partition':'NONE'} 和注释=“” 和compression={'class':'org.apache.cassandra.db.compression.SizeTieredCompactionStrategy','max_threshold':'32','min_threshold':'4'} 压缩={'chunk_length_in_kb':'64','class':'org.apache.cassandra.io.compress.LZ4Compressor'} 和crc检查机会=1.0 和dclocal\u read\u repair\u chance=0.1 并且默认的\u time\u to\u live=0 gc_grace_秒=864000 最大指数间隔=2048 和memtable_flush_period_in_ms=0 最小索引间隔=128 并读取_repair_chance=0.0 推测性_重试='99百分位';
冻结类型“tit”定义为Json 如何将数据插入Cassandra中地图集合类型内定义的UDT? 创建表darshan.b_tweet( 屏幕名称文本主键, 用户id映射 )使用bloom_过滤器时,fp_概率=0.01 和缓存={'keys':'ALL','rows\u per\u partition':'NONE'} 和注释=“” 和compression={'class':'org.apache.cassandra.db.compression.SizeTieredCompactionStrategy','max_threshold':'32','min_threshold':'4'} 压缩={'chunk_length_in_kb':'64','class':'org.apache.cassandra.io.compress.LZ4Compressor'} 和crc检查机会=1.0 和dclocal\u read\u repair\u chance=0.1 并且默认的\u time\u to\u live=0 gc_grace_秒=864000 最大指数间隔=2048 和memtable_flush_period_in_ms=0 最小索引间隔=128 并读取_repair_chance=0.0 推测性_重试='99百分位';,json,database,collections,cassandra,user-defined-types,Json,Database,Collections,Cassandra,User Defined Types,冻结类型“tit”定义为 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'}
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';
创建类型darshan.tit(
提到地图,
标签集
);
当我尝试插入时,它会给我一个错误
CREATE TYPE darshan.tit (
mentions map<text, text>,
hashtags set<text>
);
插入b_tweet(屏幕名称,用户id)值('maker',{'5567878':{提及:{'hi':'554545'},hashtags:'byePk'})
InvalidRequest:code=2200[Invalid query]message=“用户的映射文字无效\u id:value{提及:{'hi':'554545'},hashtags:'byePk'}不是冻结类型”
如何在其中插入数据?好的。找到了解决方案。在每个“:”后面使用大括号,地图除外。如果可能,请详细说明答案好吗?谢谢。得到了解决方案。除了地图之外,在每个“:”后面都用括号括起来。如果可能的话,你能详细说明答案吗?谢谢
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>"