开发者

Set Super Column Family in Cassandra Cli

开发者 https://www.devze.com 2023-03-23 06:29 出处:网络
I\'m using Cassandra 0.8.0. I cannot figure out how to use the Cassandra-Cli to add values to a currently existing SuperColumn. For example: I have added the following to my keyspace

I'm using Cassandra 0.8.0.

I cannot figure out how to use the Cassandra-Cli to add values to a currently existing SuperColumn. For example: I have added the following to my keyspace

开发者_StackOverflow社区
create column family authors
with comparator = UTF8Type and subcomparator = UTF8Type
and default_validation_class = UTF8Type
and column_metadata = [{
    column_name: tags, validation_class: UTF8Type},
    {column_name: url, validation_class:UTF8Type},
    {column_name: title, validation_class: UTF8Type},
    {column_name: publisher, validation_class: UTF8Type},
    {column_name: email, validation_class: UTF8Type}];

I tried adding a row to this super column doing: (input)[default@testspace] set authors[1]['1']['url'] = 'www.henry.com';

(output) [default@testspace] null which is an error^

I try this too:

[default@testspace] set authors['henry']['url']['1'] = 'www.henry.com';

and get:

org.apache.cassandra.db.marshal.MarshalException: cannot parse 'henry' as hex bytes

what is the proper syntax for manipulating SuperColumns in the Cassandra-Cli? Can you provide an example to set/get values using a supercolumn in cassandra-cli?

Thank you


You need to add

column_type = 'Super' and key_validation_class = UTF8Type

to your column family definition.


You cannot create secondary indexes on the sub-columns of a super column. Therefore, the use of super columns is best suited for use cases where the number of sub-columns is a relatively small number.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号