创建超级列和密钥

时间:2011-06-22 03:30:28

标签: cassandra

我不太熟悉创建超级列。 column_type=Super是将Super1指定为super column的正确方法吗?

我无法将id视为index_type: KEYS

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}]; 

请指教。

2 个答案:

答案 0 :(得分:3)

\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)';

三个不同的例子以满足您的需求......

答案 1 :(得分:2)

您无法在超级列上创建列索引。