incubator-cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jonathan Ellis <jbel...@gmail.com>
Subject Re: row key as long type
Date Thu, 08 Sep 2011 20:16:08 GMT
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 <talk2amulya@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 <jbellis@gmail.com> wrote:
>
>> List should work fine on any schema, including long keys.
>>
>>
>> On Thu, Sep 8, 2011 at 8:23 AM, amulya rattan <talk2amulya@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 <tcegrid@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

Mime
View raw message