Return-Path: Delivered-To: apmail-incubator-cassandra-user-archive@minotaur.apache.org Received: (qmail 47052 invoked from network); 26 Oct 2009 01:27:43 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 26 Oct 2009 01:27:43 -0000 Received: (qmail 384 invoked by uid 500); 26 Oct 2009 01:27:43 -0000 Delivered-To: apmail-incubator-cassandra-user-archive@incubator.apache.org Received: (qmail 321 invoked by uid 500); 26 Oct 2009 01:27:42 -0000 Mailing-List: contact cassandra-user-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: cassandra-user@incubator.apache.org Delivered-To: mailing list cassandra-user@incubator.apache.org Received: (qmail 312 invoked by uid 99); 26 Oct 2009 01:27:42 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 26 Oct 2009 01:27:42 +0000 X-ASF-Spam-Status: No, hits=-2.6 required=5.0 tests=BAYES_00,HTML_MESSAGE X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of kevincastiglione@gmail.com designates 209.85.210.174 as permitted sender) Received: from [209.85.210.174] (HELO mail-yx0-f174.google.com) (209.85.210.174) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 26 Oct 2009 01:27:40 +0000 Received: by yxe4 with SMTP id 4so8747622yxe.32 for ; Sun, 25 Oct 2009 18:27:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :from:date:message-id:subject:to:content-type; bh=wfsNMHOZMFrTQywbSi719omdzKQ5+62GJU/36OktLrA=; b=EN/GtMET59Iu+RgDcckNdRTd68nQQk77TViut2P9Mil5HkEpiBQYKjLcdYXW0qeBQ+ f2sv4Dl7q8Mm54FMfBrxWPKCRFcIYZ4cswBE2641nM0k/WuK50PdPdc+BZe7nnfbo1rp R55GY1JfEPMRJfm7926+fRvlwcvyow8OxtCDs= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; b=AK9YF3z/ha8ByuWWkre1r/omJaXFAPpl3ywYDM3L34ENsMDzft/UX7HyNz1a/39ac8 d8XQbQOo2XieHOjXVzca5oE7DLQBK8ZhB6llh8bZpBf6B00KS9gaDRFcEdl0y10qIv5Q WI7WLbfy9JBNmorkAdKNS/q1SZqlyaOBONZvs= MIME-Version: 1.0 Received: by 10.101.29.20 with SMTP id g20mr2055108anj.34.1256520439443; Sun, 25 Oct 2009 18:27:19 -0700 (PDT) In-Reply-To: References: From: kevin Date: Sun, 25 Oct 2009 18:26:59 -0700 Message-ID: Subject: Re: are columns of a supercolumn name sorted? To: cassandra-user@incubator.apache.org Content-Type: multipart/alternative; boundary=001636b2b4d07232720476cc762e --001636b2b4d07232720476cc762e Content-Type: text/plain; charset=ISO-8859-1 hi jonathan thanks for the clarification. >>>subcolumns is what you want (with the reverse option to slice, to get most-recent-first). is reverse an option in get_slice method or in my python code or in the config file? On Sun, Oct 25, 2009 at 5:40 PM, Jonathan Ellis wrote: > Sorry, the paragraph about subcolumns always being sorted by time is > outdated. (I've taken it out on the 0.4 branch now -- it was already > gone in trunk.) Read just below that about how comparewith and > comparesubcolumnswith work. Sounds like using TimeUUIDType for > subcolumns is what you want (with the reverse option to slice, to get > most-recent-first). > > On Sun, Oct 25, 2009 at 5:17 PM, kevin wrote: > > i am inserting three columns x,a,z into a super column named 'sc_2'. the > > config file says that the columns of a super column are timesorted, but > when > > i get_slice it is sorted by the name of the columns. how do i get it time > > sorted so that i get the most recently inserted/updated column first? > > cassandra version apache-cassandra-incubating-0.4.1-bin.tar.gz, and > lazyboy > > latest git clone. > > thanks > > > > > >>>> import lazyboy,time, pprint > >>>> from cassandra import Cassandra > >>>> from cassandra.ttypes import * > > > > > >>>> client=lazyboy.connection.Client(['localhost:9160']) > >>>> keyspace = "Keyspace1" > >>>> key='mykeyx' > >>>> column_path = > >>>> ColumnPath(column_family="Super1",column="x",super_column='sc_2') > >>>> client.insert(keyspace, key, column_path, 'a', time.time(), > >>>> ConsistencyLevel.ONE); > >>>> column_path = > >>>> ColumnPath(column_family="Super1",column="a",super_column='sc_2') > >>>> client.insert(keyspace, key, column_path, 'a', time.time(), > >>>> ConsistencyLevel.ONE); > >>>> column_path = > >>>> ColumnPath(column_family="Super1",column="z",super_column='sc_2') > >>>> client.insert(keyspace, key, column_path, 'a', time.time(), > >>>> ConsistencyLevel.ONE); > > > > > >>>> slice_range = SliceRange(start="", finish="") > >>>> predicate = SlicePredicate(slice_range=slice_range) > >>>> column_parent = ColumnParent(column_family="Super1") > >>>> client.get_slice(keyspace, key, column_parent, predicate, > >>>> ConsistencyLevel.ONE) > > [ColumnOrSuperColumn(column=None, super_column=SuperColumn(name='sc_2', > > columns=[Column(timestamp=1256512261, name='a', value='a'), > > Column(timestamp=1256512252, name='x', value='a'), > > Column(timestamp=1256512267, name='z', value='a')]))] > > > --001636b2b4d07232720476cc762e Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable hi jonathan
thanks for the clarification.

>>>subcolumns = is what you want (with the reverse option to slice, to get most-recent-firs= t).

is reverse an option in get_slice method or in my python code or in the= config file?



On Sun, Oct 25, 200= 9 at 5:40 PM, Jonathan Ellis <jbellis@gmail.com> wrote:
Sorry, the paragr= aph about subcolumns always being sorted by time is
outdated. =A0(I've taken it out on the 0.4 branch now -- it was already=
gone in trunk.) =A0Read just below that about how comparewith and
comparesubcolumnswith work. =A0Sounds like using TimeUUIDType for
subcolumns is what you want (with the reverse option to slice, to get
most-recent-first).

On Sun, Oct 25, 2009 at 5:17 PM, kevin <kevincastiglione@gmail.com> wrote: > i am inserting three columns x,a,z into a super column named 'sc_2= '. the
> config file says that the columns of a super column are timesorted, bu= t when
> i get_slice it is sorted by the name of the columns. how do i get it t= ime
> sorted so that i get the most recently inserted/updated column first?<= br> > cassandra version apache-cassandra-incubating-0.4.1-bin.tar.gz, and la= zyboy
> latest git clone.
> thanks
>
>
>>>> import lazyboy,time, pprint
>>>> from cassandra import Cassandra
>>>> from cassandra.ttypes import *
>
>
>>>> client=3Dlazyboy.connection.Client(['localhost:9160= 9;])
>>>> keyspace =3D "Keyspace1"
>>>> key=3D'mykeyx'
>>>> column_path =3D
>>>> ColumnPath(column_family=3D"Super1",column=3D&qu= ot;x",super_column=3D'sc_2')
>>>> client.insert(keyspace, key, column_path, 'a', tim= e.time(),
>>>> ConsistencyLevel.ONE);
>>>> column_path =3D
>>>> ColumnPath(column_family=3D"Super1",column=3D&qu= ot;a",super_column=3D'sc_2')
>>>> client.insert(keyspace, key, column_path, 'a', tim= e.time(),
>>>> ConsistencyLevel.ONE);
>>>> column_path =3D
>>>> ColumnPath(column_family=3D"Super1",column=3D&qu= ot;z",super_column=3D'sc_2')
>>>> client.insert(keyspace, key, column_path, 'a', tim= e.time(),
>>>> ConsistencyLevel.ONE);
>
>
>>>> slice_range =3D SliceRange(start=3D"", finish=3D= "")
>>>> predicate =3D SlicePredicate(slice_range=3Dslice_range) >>>> column_parent =3D ColumnParent(column_family=3D"Super= 1")
>>>> client.get_slice(keyspace, key, column_parent, predicate,<= br> >>>> ConsistencyLevel.ONE)
> [ColumnOrSuperColumn(column=3DNone, super_column=3DSuperColumn(name=3D= 'sc_2',
> columns=3D[Column(timestamp=3D1256512261, name=3D'a', value=3D= 'a'),
> Column(timestamp=3D1256512252, name=3D'x', value=3D'a'= ),
> Column(timestamp=3D1256512267, name=3D'z', value=3D'a'= )]))]
>

--001636b2b4d07232720476cc762e--