Search code examples
cassandracommand-line-interfacesuper-columns

Set Super Column Family in Cassandra Cli


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

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


Solution

  • You need to add

    column_type = 'Super' and key_validation_class = UTF8Type
    

    to your column family definition.