prob4
prob4

Reputation: 11

create super column and key

I not too familiar with creating a super column. Is column_type=Super the right way to assign Super1 as super column?

I could not get the id as index_type: KEYS to:

create column family Super1 with comparator=UTF8Type and 
column_type=Super and key_validation_class=UTF8Type and 
column_metadata = [ 
{column_name: id, validation_class:UTF8Type, index_type: KEYS}, 
{column_name: username, validation_class:UTF8Type}, 
{column_name: email, validation_class:UTF8Type}]; 

Please advice.

Upvotes: 1

Views: 3559

Answers (2)

jbellis
jbellis

Reputation: 19377

You can't create column indexes on supercolumns.

Upvotes: 2

sdolgy
sdolgy

Reputation: 7001

As found in \apache-cassandra-0.8.0\conf\schema-sample.txt:

create column family Super1
with column_type = Super
and comparator = BytesType
and subcomparator = BytesType;

create column family Super2
with column_type = Super
and subcomparator = UTF8Type
and rows_cached = 10000
and keys_cached = 50
and comment = 'A column family with supercolumns, whose column and subcolumn names are UTF8 strings';

create column family Super3
with column_type = Super
and comparator = LongType
and comment = 'A column family with supercolumns, whose column names are Longs (8 bytes)';

Three different examples to suit your needs...

Upvotes: 3

Related Questions