Return-Path: X-Original-To: apmail-cassandra-user-archive@www.apache.org Delivered-To: apmail-cassandra-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 1A9887148 for ; Thu, 8 Sep 2011 20:16:57 +0000 (UTC) Received: (qmail 6578 invoked by uid 500); 8 Sep 2011 20:16:55 -0000 Delivered-To: apmail-cassandra-user-archive@cassandra.apache.org Received: (qmail 6474 invoked by uid 500); 8 Sep 2011 20:16:54 -0000 Mailing-List: contact user-help@cassandra.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@cassandra.apache.org Delivered-To: mailing list user@cassandra.apache.org Received: (qmail 6465 invoked by uid 99); 8 Sep 2011 20:16:54 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 08 Sep 2011 20:16:54 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of jbellis@gmail.com designates 209.85.215.170 as permitted sender) Received: from [209.85.215.170] (HELO mail-ey0-f170.google.com) (209.85.215.170) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 08 Sep 2011 20:16:49 +0000 Received: by eyd10 with SMTP id 10so958821eyd.1 for ; Thu, 08 Sep 2011 13:16:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=Nclu2Wk3dlIMgwIiWiSJ9YcihF+N8tZuOUAZZG7tNmc=; b=NowatnH8vkJX+HShGDVYO3JfOjH1Xvzyi3J3uyH02S2A9w0UNIzpCvtuiKxhEygvuE VC32ldSN7j/WnJMe3FeO3Mtg0S7HzoGVSffL20dLoO8zmxRzKyILfjRB14D0r2sEWUT4 UG9FLxb7aTk7Pyqf0loTdkDooHEFxfqEa1XXg= Received: by 10.213.23.15 with SMTP id p15mr528213ebb.5.1315512988161; Thu, 08 Sep 2011 13:16:28 -0700 (PDT) MIME-Version: 1.0 Received: by 10.213.7.13 with HTTP; Thu, 8 Sep 2011 13:16:08 -0700 (PDT) In-Reply-To: References: <1315484098.81123.YahooMailClassic@web95304.mail.in2.yahoo.com> From: Jonathan Ellis Date: Thu, 8 Sep 2011 15:16:08 -0500 Message-ID: Subject: Re: row key as long type To: user@cassandra.apache.org Content-Type: multipart/alternative; boundary=0015174c13cc5b58c604ac73bca8 --0015174c13cc5b58c604ac73bca8 Content-Type: text/plain; charset=ISO-8859-1 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 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 wrote: > >> List should work fine on any schema, including long keys. >> >> >> On Thu, Sep 8, 2011 at 8:23 AM, amulya rattan 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 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 --0015174c13cc5b58c604ac73bca8 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 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, a= mulya rattan <talk2amulya@gmail.com> wrote:
But I explicitly remember List throwing &qu= ot;long is exactly 8 bytes" when i invoked on a column family with lon= g 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, includi= ng 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&#= 39;d just have to set key_validataion_class to be LongType.

However, doing list on column family would throw an error..please look= at=A0http://wiki.apache.org/cassandra/FAQ#a_long_is_exac= tly_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 nu= mber(longtype) as row key in Cassadra?

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


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

data model:

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

use rng;

create column family info w= ith comparator =3D AsciiType
and key_validation_class =3D UTF8Type
and column_metadata =3D
[{
= column_name : domain,
validation_class : UTF8Type,
index_t= ype : 0,
index_name : domain_idx},
{
column_name : ip,
validation_class : LongType,
index_type : 0,
index_name := ip_idx
}];
Regards,
Thamizhannal

<= /div>



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




--
Jonathan Ellis
Proje= ct Chair, Apache Cassandra
co-founder of DataStax, the source for profes= sional Cassandra support
http://www.datastax.com
--0015174c13cc5b58c604ac73bca8--