Return-Path: Delivered-To: apmail-cassandra-user-archive@www.apache.org Received: (qmail 85418 invoked from network); 21 Feb 2011 22:08:35 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 21 Feb 2011 22:08:35 -0000 Received: (qmail 44942 invoked by uid 500); 21 Feb 2011 22:08:30 -0000 Delivered-To: apmail-cassandra-user-archive@cassandra.apache.org Received: (qmail 44495 invoked by uid 500); 21 Feb 2011 22:08:30 -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 44364 invoked by uid 99); 21 Feb 2011 22:08:30 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 21 Feb 2011 22:08:30 +0000 X-ASF-Spam-Status: No, hits=4.4 required=5.0 tests=FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of cbertu81@libero.it designates 212.52.84.104 as permitted sender) Received: from [212.52.84.104] (HELO cp-out4.libero.it) (212.52.84.104) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 21 Feb 2011 22:08:23 +0000 X-CTCH-Spam: Unknown X-CTCH-RefID: str=0001.0A0B020B.4D62E243.0028,ss=1,re=0.000,fgs=0 X-libjamoibt: 1419 Received: from wmail53 (172.31.0.244) by cp-out4.libero.it (8.5.133) (authenticated as cbertu81@libero.it) id 4D10BF9904622FE8 for user@cassandra.apache.org; Mon, 21 Feb 2011 23:08:02 +0100 Message-ID: <8807551.1405361298326082742.JavaMail.defaultUser@defaultHost> Date: Mon, 21 Feb 2011 23:08:02 +0100 (CET) From: "cbertu81@libero.it" Reply-To: "cbertu81@libero.it" To: Subject: R: Re: Are row-keys sorted by the compareWith? MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_135863_5199294.1298326082741" X-SenderIP: 93.35.195.235 X-Virus-Checked: Checked by ClamAV on apache.org ------=_Part_135863_5199294.1298326082741 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Sorry Dan, I just noticed I answer you and not to the group!Didn't want to bother, just mistake. Best Regards Carlo ----Messaggio originale---- Da: dan@reactive.org Data: 21/02/2011 4.23 A: , "cbertu81@libero.it" Ogg: Re: Are row-keys sorted by the compareWith? Hi Carlo,As Jonathan mentions the compareWith on a column family def. is defines the order for the columns *within* a row... In order to control the ordering of rows you'll need to use the OrderPreservingPartitioner (http://www.datastax.com/docs/0.7/operations/clustering#tokens-partitioners-ring). As for getColumnsFromRows; it should be returning you a map of lists. The map is insertion-order-preserving and populated based on the provided list of row keys (so if you iterate over the entries in the map they should be in the same order as the list of row keys). The list for each row entry are definitely in the order that Cassandra provides them, take a look at org.scale7.cassandra.pelops.Selector#toColumnList if you need more info. Cheers,Dan -- Dan Washusen Sent with Sparrow On Saturday, 19 February 2011 at 8:16 AM, cbertu81@libero.it wrote: Hi all, I created a CF in which i need to get, sorted by time, the Rows inside. Each Row represents a comment. I've created a few rows using as Row Key a generated TimeUUID but when I call the Pelops method "GetColumnsFromRows" I don't get the data back as I expect: rows are not sorted by TimeUUID. I though it was probably cause of the random-part of the TimeUUID so I create a new CF ... This time I created a few rows using the java System.CurrentTimeMillis() that retrieve a long. I call again the "GetColumnsFromRows" and again the same results: data are not sorted! I've read many times that Rows are sorted as specified in the compareWith but I can't see it. To solve this problem for the moment I've used a SuperColumnFamily with an UNIQUE ROW ... but I think this is just a workaround and not the solution. Now when I call the "GetSuperColumnsFromRow" I get all the SuperColumns as I expected: sorted by TimeUUID. Why it does not happen the same with the Rows? I'm confused. TIA for any help. Best Regards Carlo ------=_Part_135863_5199294.1298326082741 Content-Type: text/html;charset="UTF-8" Content-Transfer-Encoding: quoted-printable

Sorry Dan, I just noticed I answer you and not to the group= !

Didn't want to bother, just mistake.

Best Regards


Carlo


----Messaggio originale----
Da: dan@reactive.org
Data: 21/02/2011 4.23
A: <user@cassandra.apache.org>, "cbertu81@libero.it"<cbertu81@libe= ro.it>
Ogg: Re: Are row-keys sorted by the compareWith?

Hi Carlo,
As Jonathan mentions the comp= areWith on a column family def. is defines the order for the columns *withi= n* a row... In order to control the ordering of rows you'll need to use the= OrderPreservingPartitioner (http://www.= datastax.com/docs/0.7/operations/clustering#tokens-partitioners-ring).<= /div>

As for getColumnsFromRows; it should be= returning you a map of lists.  The map is insertion-order-preserving = and populated based on the provided list of row keys (so if you iterate ove= r the entries in the map they should be in the same order as the list of ro= w keys).  The list for each row entry are definitely in the order that= Cassandra provides them, take a look at org.scale7.cassandra.pelops.S= elector#toColumnList if you need more info.

Cheers= ,
Dan

-- 
Dan Washusen
Sent with S= parrow
=20

= On Saturday, 19 February 2011 at 8:16 AM, cbertu81@libero.it wrote:

Hi all,
I created a CF in which i ne= ed to get, sorted by time, the Rows inside. Each
Row represents a comme= nt.

<ColumnFamily name=3D"Comments" compareWith=3D"TimeUUIDType" = / >

I've created a few rows using as Row Key a generated TimeUUID= but when I call
the Pelops method "GetColumnsFromRows" I don't get the= data back as I expect:
rows are not sorted by TimeUUID.
I though it= was probably cause of the random-part of the TimeUUID so I create
a ne= w CF ...

<ColumnFamily name=3D"Comments2" compareWith=3D"LongType= " / >

This time I created a few rows using the java System.Curren= tTimeMillis() that
retrieve a long. I call again the "GetColumnsFromRow= s" and again the same
results: data are not sorted!
I've read many t= imes that Rows are sorted as specified in the compareWith but
I can't s= ee it.
To solve this problem for the moment I've used a SuperColumnFami= ly with an
UNIQUE ROW ... but I think this is just a workaround and not= the solution.

<ColumnFamily name=3D"Comments" type=3D"Super" com= pareWith=3D"TimeUUIDType"
CompareSubcolumnsWith=3D"BytesType"/ >
Now when I call the "GetSuperColumnsFromRow" I get all the SuperColumn= s as I
expected: sorted by TimeUUID. Why it does not happen the same wi= th the Rows?
I'm confused.

TIA for any help.

Best Regards=

Carlo
=20 =20 =20 =20
=20



------=_Part_135863_5199294.1298326082741--