通过生成sSTables然后使用sstableloader加载数据来执行批量加载。卡桑德拉。 SSTableLoader无法解码值
查询加载表上的数据时,主键数据无法解码。我看到下面的错误。
错误上选择查询(除主键列得到正确呈现):
Failed to decode value '\xe4\xedQ\x9aX\x8dF\xab\x86\xf1\r\xe4]\xc3\x14C' (for column 'first_name') as text: 'utf8' codec can't decode byte 0xe4 in position 0: invalid continuation byte Failed to decode value '$q\x9d\x94P\xb9Ni\x9d);\xd0\x1d33~' (for column 'first_name') as text: 'utf8' codec can't decode byte 0x9d in position 2: invalid start byte
代码,以生成SSTables:
SSTableSimpleUnsortedWriter eventWriter = new SSTableSimpleUnsortedWriter(directory, partitioner, keySpace, tableName, UTF8Type.instance,null, 64); eventWriter.addColumn(compType.builder().add(ByteBufferUtil.bytes("first_name")).build(), ByteBufferUtil.bytes(entry.firstName), timestamp); eventWriter.addColumn(compType.builder().add(ByteBufferUtil.bytes("last_name")).build(), ByteBufferUtil.bytes(entry.lastName), timestamp); eventWriter.addColumn(compType.builder().add(ByteBufferUtil.bytes("country")).build(), ByteBufferUtil.bytes(entry.countryText), timestamp);
表定义:
CREATE TABLE test4 ( first_name varchar PRIMARY KEY, country text, last_name text, ) WITH bloom_filter_fp_chance=0.010000 AND caching='KEYS_ONLY' AND comment='' AND dclocal_read_repair_chance=0.000000 AND gc_grace_seconds=864000 AND read_repair_chance=0.100000 AND replicate_on_write='true' AND populate_io_cache_on_flush='false' AND compaction={'class': 'SizeTieredCompactionStrategy'} AND compression={'sstable_compression': 'LZ4Compressor'};
应该如何正确解码PrimaryKey?