3

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

Henry
  • 916
  • 2
  • 11
  • 24

2 Answers2

6

You need to add

column_type = 'Super' and key_validation_class = UTF8Type

to your column family definition.

drewrobb
  • 1,514
  • 8
  • 24
  • Thanks for the response. Do you if Cassandra will support indexing subcolumns in super columns? – Henry Aug 03 '11 at 16:39
0

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.

Pugal
  • 31
  • 1