Thamizh
Thamizh

Reputation: 83

row key as long type

Is there a way to store number(longtype) as row key in Cassadra?

I wanted to execute range query based on row key value. e.g $list info[12345:]; . It should list all the rowkeys which are >= 12345.

Is there a way accompolish this in cassandra? Secondary index does not helped me. So I am trying to store column value 'ip' as rowkey here.

data model:

create keyspace ipinfo with placement_strategy =
'org.apache.cassandra.locator.SimpleStrategy' and strategy_options =  
[{replication_factor:1}];

use rng;

create column family info with comparator = AsciiType
and key_validation_class = UTF8Type
and column_metadata =
[{
    column_name : domain,
    validation_class : UTF8Type,
    index_type : 0,
    index_name : domain_idx},
{
    column_name : ip,
    validation_class : LongType,
    index_type : 0,
    index_name : ip_idx
}];

Thanks Thamizh

Upvotes: 1

Views: 1737

Answers (1)

jbellis
jbellis

Reputation: 19377

For the record, here is the thread on the Cassandra user list where this was answered: http://comments.gmane.org/gmane.comp.db.cassandra.user/20066

Upvotes: 1

Related Questions