Return-Path: Delivered-To: apmail-cassandra-user-archive@www.apache.org Received: (qmail 23154 invoked from network); 9 May 2010 16:37:22 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 9 May 2010 16:37:22 -0000 Received: (qmail 96324 invoked by uid 500); 9 May 2010 16:37:21 -0000 Delivered-To: apmail-cassandra-user-archive@cassandra.apache.org Received: (qmail 96290 invoked by uid 500); 9 May 2010 16:37:21 -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 96277 invoked by uid 99); 9 May 2010 16:37:21 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 09 May 2010 16:37:21 +0000 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of canovaj@gmail.com designates 209.85.211.190 as permitted sender) Received: from [209.85.211.190] (HELO mail-yw0-f190.google.com) (209.85.211.190) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 09 May 2010 16:37:16 +0000 Received: by ywh28 with SMTP id 28so1564071ywh.28 for ; Sun, 09 May 2010 09:36:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:content-type; bh=vlFN+MyA8ezMeA7O4fT7jO77JZ5G59nz4GvMU00bV2g=; b=TsJJu6SJ3NNbCyMWQOUtq9hMHPi9Ar5b88ncRPNLohH4khpxR0atI1/lqDnj5+BcIH 94Ic2xey6WtE7iM/xtQt7rAXS5gz+UEDHxlErg3Mmm5CqUe3f6rorwl5SeylYmPluQOi MEfq4q67O5mk+wuXXR36d7XFx7VWsqtQ/Kg3k= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:content-type; b=LWotbOgdoo7YeKidJb/sXIWu6vn/+mM548vU0z7XpUM9wraQGwb5ovSY1z7gKkeplV R+kuYF74wPd1+IoNoUSwmk4W/tWNJKhshx7prs78wAuR7E74XmuD80nYZQ2yd9jxeeC6 20N9a8UzvudK1Yxvdrv2IRrsJ6wyKxxE+qcS4= MIME-Version: 1.0 Received: by 10.231.160.142 with SMTP id n14mr1710006ibx.52.1273423015646; Sun, 09 May 2010 09:36:55 -0700 (PDT) Sender: canovaj@gmail.com Received: by 10.231.38.132 with HTTP; Sun, 9 May 2010 09:36:55 -0700 (PDT) In-Reply-To: References: <1273263449.442916359@192.168.2.230> Date: Sun, 9 May 2010 09:36:55 -0700 X-Google-Sender-Auth: 6RavwjGUm-vIjrcuxNN_k-ONeb4 Message-ID: Subject: Re: key is sorted? From: AJ Chen To: user@cassandra.apache.org Content-Type: multipart/alternative; boundary=001636d342647f166104862be66a --001636d342647f166104862be66a Content-Type: text/plain; charset=ISO-8859-1 just to correct myself: to sort timeUUID on column in descending order, sliceRange.setReversed(true) does the trick. -aj On Sun, May 9, 2010 at 9:07 AM, AJ Chen wrote: > true, i think. > but don't rush to OrderPreservingPartitioners. it may be better to create > another key CF for sorting the key (put the key in column, which is sorted > automatically). to paginate through the records, you get a sorted slice of > keys from the key CF, and then look up the record CF with each key. > > One issue i found with the default column sorting is that the timeUUIDType > sorts time-uuid column in ascending order instead of descending order. > get_slice call returns oldest time-uuid instead of most recent time-uuid. Is > this a bug? normally, you want get_slice returns most recent timeuuid, > which make function like "get most recent 10 records" easy. > > -aj > > > On Sun, May 9, 2010 at 12:00 AM, David Boxenhorn wrote: > >> This is something that I'm not sure that I understand. Can somebody >> confirm/deny that I understand it? Thanks. >> >> If you use random partitioning, you can loop through all keys with a range >> query, but they will not be sorted. >> >> True or False? >> >> On Sat, May 8, 2010 at 3:45 AM, AJ Chen wrote: >> >>> thanks, that works. -aj >>> >>> >>> On Fri, May 7, 2010 at 1:17 PM, Stu Hood wrote: >>> >>>> Your IPartitioner implementation decides how the row keys are sorted: >>>> see http://wiki.apache.org/cassandra/StorageConfiguration#Partitioner . >>>> You need to be using one of the OrderPreservingPartitioners if you'd like a >>>> reasonable order for the keys. >>>> >>>> -----Original Message----- >>>> From: "AJ Chen" >>>> Sent: Friday, May 7, 2010 3:10pm >>>> To: user@cassandra.apache.org >>>> Subject: key is sorted? >>>> >>>> I have a super column family for "topic", key being the name of the >>>> topic. >>>> >>> CompareSubcolumnsWith="BytesType" /> >>>> When I retrieve the rows, the rows are not sorted by the key. Is the row >>>> key >>>> sorted in cassandra by default? >>>> >>>> -aj >>>> -- >>>> AJ Chen, PhD >>>> Chair, Semantic Web SIG, sdforum.org >>>> http://web2express.org >>>> twitter @web2express >>>> Palo Alto, CA, USA >>>> >>>> >>>> >>> >>> >>> -- >>> AJ Chen, PhD >>> Chair, Semantic Web SIG, sdforum.org >>> http://web2express.org >>> twitter @web2express >>> Palo Alto, CA, USA >>> >> >> > > > -- > AJ Chen, PhD > Chair, Semantic Web SIG, sdforum.org > http://web2express.org > twitter @web2express > Palo Alto, CA, USA > -- AJ Chen, PhD Chair, Semantic Web SIG, sdforum.org http://web2express.org twitter @web2express Palo Alto, CA, USA --001636d342647f166104862be66a Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable just to correct myself: to sort timeUUID on column in descending order, sli= ceRange.setReversed(true) does the trick.
-aj

On Sun, May 9, 2010 at 9:07 AM, AJ Chen <ajchen@web2express.org>= wrote:
true, i think.=A0=
but don't rush to OrderPreservingPartitioners. it may be better to= create another key CF for sorting the key (put the key in column, which is= sorted automatically). to paginate through the records, you get a sorted s= lice of keys from the key CF, and then look up the record CF with each key.=

One issue i found with the default column sorting is that the timeUUIDT= ype sorts time-uuid column in ascending order instead of descending order. = get_slice call returns oldest time-uuid instead of most recent time-uuid. I= s this a bug?=A0 normally, you want get_slice returns most recent timeuuid,= which make function like "get most recent 10 records" easy.

-aj


On Sun, May 9, 2010 at 12:00 AM, David Boxenhorn = <david@lookin2.co= m> wrote:
This is something that I'm not sure that I understand.= Can somebody confirm/deny that I understand it? Thanks.

If you use = random partitioning, you can loop through all keys with a range query, but = they will not be sorted.

True or False?

= On Sat, May 8, 2010 at 3:45 AM, AJ Chen <ajchen@web2express.org&g= t; wrote:
thanks, that works. -aj


On Fri, May 7, 2010 at 1:17 PM, Stu Hood <= ;stu.hood@racks= pace.com> wrote:
Your IPartitioner implementation decides how the row keys are sorted: see <= a href=3D"http://wiki.apache.org/cassandra/StorageConfiguration#Partitioner= " target=3D"_blank">http://wiki.apache.org/cassandra/StorageConfiguration#P= artitioner . You need to be using one of the OrderPreservingPartitioner= s if you'd like a reasonable order for the keys.

-----Original Message-----
From: "AJ Chen" <ajchen@web2express.org>
Sent: Friday, May 7, 2010 3:10pm
To: user@cas= sandra.apache.org
Subject: key is sorted?

I have a super column family for "topic", key being the name of t= he topic.
<ColumnFamily Name=3D"Topic" CompareWith=3D"UTF8Type"= ; ColumnType=3D"Super"
CompareSubcolumnsWith=3D"BytesType" />
When I retrieve the rows, the rows are not sorted by the key. Is the row ke= y
sorted in cassandra by default?

-aj
--
AJ Chen, PhD
Chair, Semantic Web SIG, s= dforum.org
http://web2express.org=
twitter @web2express
Palo Alto, CA, USA





--
AJ Chen, Ph= D
Chair, Semantic Web SIG, sdforum.org
http://web2express.org
twitter @web2express
Palo Alto, CA, USA




--
<= /div>
AJ Chen, PhD
Chair, Semantic Web SIG, sdforum.org
http://web2express.org
twitter @web2express
Palo Alto, CA, USA



--
AJ Chen, Ph= D
Chair, Semantic Web SIG, sdforum.org
http://web2express.org
twitt= er @web2express
Palo Alto, CA, USA
--001636d342647f166104862be66a--