It is resolved. I used Map/Reduce program, in that I converted long row key as 
byte array and stored it as ByteBuffer.  Now row key are in sorted order. I can 
apply range query.
E.g. $list ip[10001:10005];

Regards,

  Thamizhannal P

--- On Fri, 9/9/11, Jonathan Ellis <jbel...@gmail.com> wrote:

From: Jonathan Ellis <jbel...@gmail.com>
Subject: Re: row key as long type
To: user@cassandra.apache.org
Date: Friday, 9 September, 2011, 1:46 AM

Probably because you had some non-long data in it, then added the long type 
later.

On Thu, Sep 8, 2011 at 2:51 PM, amulya rattan <talk2amu...@gmail.com> wrote:


But I explicitly remember List throwing "long is exactly 8 bytes" when i 
invoked on a column family with long as key.

Why would that happen?

On Thu, Sep 8, 2011 at 10:07 AM, Jonathan Ellis <jbel...@gmail.com> wrote:



List should work fine on any schema, including long keys.


On Thu, Sep 8, 2011 at 8:23 AM, amulya rattan <talk2amu...@gmail.com> wrote:


Row key can certainly be of type long..you'd just have to set 
key_validataion_class to be LongType.





However, doing list on column family would throw an error..please look 
at http://wiki.apache.org/cassandra/FAQ#a_long_is_exactly_8_bytes







On Thu, Sep 8, 2011 at 8:14 AM, Thamizh <tceg...@yahoo.co.in> wrote:






Hi All,

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


Regards,

  Thamizhannal 





-- 
Jonathan Ellis
Project Chair, Apache Cassandra
co-founder of DataStax, the source for professional Cassandra support
http://www.datastax.com











-- 
Jonathan Ellis
Project Chair, Apache Cassandra
co-founder of DataStax, the source for professional Cassandra support
http://www.datastax.com



Reply via email to