You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by karim abbouh <ka...@yahoo.fr> on 2011/06/27 18:59:52 UTC
Re : Re : get_range_slices result
i used TimeUUIDType as type in storage-conf.xml file
<ColumnFamily Name="table" CompareWith="TimeUUIDType "/>
and i used it as comparator in my java code,
but in the execution i get exception :
Erreur --java.io.UnsupportedEncodingException: TimeUUIDType
how can i write it?
BR
________________________________
De : David Boxenhorn <da...@citypath.com>
À : user@cassandra.apache.org
Cc : karim abbouh <ka...@yahoo.fr>
Envoyé le : Vendredi 24 Juin 2011 11h25
Objet : Re: Re : get_range_slices result
You can get the best of both worlds by repeating the key in a column,
and creating a secondary index on that column.
On Fri, Jun 24, 2011 at 1:16 PM, Sylvain Lebresne <sy...@datastax.com> wrote:
> On Fri, Jun 24, 2011 at 10:21 AM, karim abbouh <ka...@yahoo.fr> wrote:
>> i want get_range_slices() function returns records sorted(orded) by the
>> key(rowId) used during the insertion.
>> is it possible?
>
> You will have to use the OrderPreservingPartitioner. This is no
> without inconvenience however.
> See for instance
> http://wiki.apache.org/cassandra/StorageConfiguration#line-100 or
> http://ria101.wordpress.com/2010/02/22/cassandra-randompartitioner-vs-orderpreservingpartitioner/
> that give more details on the pros and cons (the short version being
> that the main advantage of
> OrderPreservingPartitioner is what you're asking for, but it's main
> drawback is that load-balancing
> the cluster will likely be very very hard).
>
> In general the advice is to stick with RandomPartitioner and design a
> data model that avoids needing
> range slices (or at least needing that the result is sorted). This is
> very often not too hard and more
> efficient, and much more simpler than to deal with the load balancing
> problems of OrderPreservingPartitioner.
>
> --
> Sylvain
>
>>
>> ________________________________
>> De : aaron morton <aa...@thelastpickle.com>
>> À : user@cassandra.apache.org
>> Envoyé le : Jeudi 23 Juin 2011 20h30
>> Objet : Re: get_range_slices result
>>
>> Not sure what your question is.
>> Does this help ? http://wiki.apache.org/cassandra/FAQ#range_rp
>> Cheers
>> -----------------
>> Aaron Morton
>> Freelance Cassandra Developer
>> @aaronmorton
>> http://www.thelastpickle.com
>> On 23 Jun 2011, at 21:59, karim abbouh wrote:
>>
>> how can get_range_slices() function returns sorting key ?
>> BR
>>
>>
>>
>>
>
Re : Re : Re : get_range_slices result
Posted by karim abbouh <ka...@yahoo.fr>.
what i want is that i get the records in the same order wich they were inserted.
how can i get this using any type of comparator type
if there is a code java for this it can be useful.
________________________________
De : aaron morton <aa...@thelastpickle.com>
À : user@cassandra.apache.org
Envoyé le : Mardi 28 Juin 2011 12h40
Objet : Re: Re : Re : get_range_slices result
First thing is you really should upgrade from 0.6, the current release is 0.8.
Info on time uuid's
http://wiki.apache.org/cassandra/FAQ#working_with_timeuuid_in_java
If you are using a higher level client like Hector or Pelops it will take care of encoding for you.
Cheers
-----------------
Aaron Morton
Freelance Cassandra Developer
@aaronmorton
http://www.thelastpickle.com
On 28 Jun 2011, at 22:20, karim abbouh wrote:
can i have an example for using TimeUUIDType as comparator in a client java code.
>
>
>
>
>________________________________
>De : karim abbouh <ka...@yahoo.fr>
>À : "user@cassandra.apache.org" <us...@cassandra.apache.org>
>Envoyé le : Lundi 27 Juin 2011 17h59
>Objet : Re : Re : get_range_slices result
>
>
>i used TimeUUIDType as type in storage-conf.xml file
>
> <ColumnFamily Name="table" CompareWith="TimeUUIDType "/>
>
>
>and i used it as comparator in my java code,
>but in the execution i get exception :
>
>Erreur --java.io.UnsupportedEncodingException: TimeUUIDType
>
>
>
>
>how can i write it?
>
>
>BR
>
>
>
>
>________________________________
>De : David Boxenhorn <da...@citypath.com>
>À : user@cassandra.apache.org
>Cc : karim abbouh <ka...@yahoo.fr>
>Envoyé le : Vendredi 24 Juin 2011 11h25
>Objet : Re: Re : get_range_slices result
>
>You can get the best of both worlds by repeating the key in a column,
>and creating a secondary index on that column.
>
>On Fri, Jun 24, 2011 at 1:16 PM, Sylvain Lebresne <sy...@datastax.com> wrote:
>> On Fri, Jun 24, 2011 at 10:21 AM, karim abbouh <ka...@yahoo.fr> wrote:
>>> i want get_range_slices() function returns records sorted(orded)
by the
>>> key(rowId) used during the insertion.
>>> is
it possible?
>>
>> You will have to use the OrderPreservingPartitioner. This is no
>> without inconvenience however.
>> See for instance
>> http://wiki.apache.org/cassandra/StorageConfiguration#line-100 or
>> http://ria101.wordpress.com/2010/02/22/cassandra-randompartitioner-vs-orderpreservingpartitioner/
>> that give more details on the pros and cons (the short version being
>> that the main advantage of
>> OrderPreservingPartitioner is what you're asking for, but it's main
>> drawback is that load-balancing
>> the cluster will likely be very very hard).
>>
>> In general the advice is to stick with RandomPartitioner and design a
>> data
model that avoids
needing
>> range slices (or at least needing that the result is sorted). This is
>> very often not too hard and more
>> efficient, and much more simpler than to deal with the load balancing
>> problems of OrderPreservingPartitioner.
>>
>> --
>> Sylvain
>>
>>>
>>> ________________________________
>>> De : aaron morton <aa...@thelastpickle.com>
>>> À : user@cassandra.apache.org
>>> Envoyé le : Jeudi 23 Juin 2011 20h30
>>> Objet : Re: get_range_slices result
>>>
>>> Not sure what your question is.
>>> Does this help ? http://wiki.apache.org/cassandra/FAQ#range_rp
>>> Cheers
>>> -----------------
>>> Aaron Morton
>>> Freelance Cassandra Developer
>>> @aaronmorton
>>> http://www.thelastpickle.com
>>> On 23 Jun 2011, at 21:59, karim abbouh wrote:
>>>
>>> how can get_range_slices() function returns sorting key ?
>>> BR
>>>
>>>
>>>
>>>
>>
>
>
>
>
>
Re: Re : Re : get_range_slices result
Posted by aaron morton <aa...@thelastpickle.com>.
First thing is you really should upgrade from 0.6, the current release is 0.8.
Info on time uuid's
http://wiki.apache.org/cassandra/FAQ#working_with_timeuuid_in_java
If you are using a higher level client like Hector or Pelops it will take care of encoding for you.
Cheers
-----------------
Aaron Morton
Freelance Cassandra Developer
@aaronmorton
http://www.thelastpickle.com
On 28 Jun 2011, at 22:20, karim abbouh wrote:
> can i have an example for using TimeUUIDType as comparator in a client java code.
>
> De : karim abbouh <ka...@yahoo.fr>
> À : "user@cassandra.apache.org" <us...@cassandra.apache.org>
> Envoyé le : Lundi 27 Juin 2011 17h59
> Objet : Re : Re : get_range_slices result
>
> i used TimeUUIDType as type in storage-conf.xml file
> <ColumnFamily Name="table" CompareWith="TimeUUIDType "/>
>
> and i used it as comparator in my java code,
> but in the execution i get exception :
> Erreur --java.io.UnsupportedEncodingException: TimeUUIDType
>
>
> how can i write it?
>
> BR
>
> De : David Boxenhorn <da...@citypath.com>
> À : user@cassandra.apache.org
> Cc : karim abbouh <ka...@yahoo.fr>
> Envoyé le : Vendredi 24 Juin 2011 11h25
> Objet : Re: Re : get_range_slices result
>
> You can get the best of both worlds by repeating the key in a column,
> and creating a secondary index on that column.
>
> On Fri, Jun 24, 2011 at 1:16 PM, Sylvain Lebresne <sy...@datastax.com> wrote:
> > On Fri, Jun 24, 2011 at 10:21 AM, karim abbouh <ka...@yahoo.fr> wrote:
> >> i want get_range_slices() function returns records sorted(orded) by the
> >> key(rowId) used during the insertion.
> >> is it possible?
> >
> > You will have to use the OrderPreservingPartitioner. This is no
> > without inconvenience however.
> > See for instance
> > http://wiki.apache.org/cassandra/StorageConfiguration#line-100 or
> > http://ria101.wordpress.com/2010/02/22/cassandra-randompartitioner-vs-orderpreservingpartitioner/
> > that give more details on the pros and cons (the short version being
> > that the main advantage of
> > OrderPreservingPartitioner is what you're asking for, but it's main
> > drawback is that load-balancing
> > the cluster will likely be very very hard).
> >
> > In general the advice is to stick with RandomPartitioner and design a
> > data model that avoids needing
> > range slices (or at least needing that the result is sorted). This is
> > very often not too hard and more
> > efficient, and much more simpler than to deal with the load balancing
> > problems of OrderPreservingPartitioner.
> >
> > --
> > Sylvain
> >
> >>
> >> ________________________________
> >> De : aaron morton <aa...@thelastpickle.com>
> >> À : user@cassandra.apache.org
> >> Envoyé le : Jeudi 23 Juin 2011 20h30
> >> Objet : Re: get_range_slices result
> >>
> >> Not sure what your question is.
> >> Does this help ? http://wiki.apache.org/cassandra/FAQ#range_rp
> >> Cheers
> >> -----------------
> >> Aaron Morton
> >> Freelance Cassandra Developer
> >> @aaronmorton
> >> http://www.thelastpickle.com
> >> On 23 Jun 2011, at 21:59, karim abbouh wrote:
> >>
> >> how can get_range_slices() function returns sorting key ?
> >> BR
> >>
> >>
> >>
> >>
> >
>
>
>
>
Re : Re : get_range_slices result
Posted by karim abbouh <ka...@yahoo.fr>.
can i have an example for using TimeUUIDType as comparator in a client java code.
________________________________
De : karim abbouh <ka...@yahoo.fr>
À : "user@cassandra.apache.org" <us...@cassandra.apache.org>
Envoyé le : Lundi 27 Juin 2011 17h59
Objet : Re : Re : get_range_slices result
i used TimeUUIDType as type in storage-conf.xml file
<ColumnFamily Name="table" CompareWith="TimeUUIDType "/>
and i used it as comparator in my java code,
but in the execution i get exception :
Erreur --java.io.UnsupportedEncodingException: TimeUUIDType
how can i write it?
BR
________________________________
De : David Boxenhorn <da...@citypath.com>
À : user@cassandra.apache.org
Cc : karim abbouh <ka...@yahoo.fr>
Envoyé le : Vendredi 24 Juin 2011 11h25
Objet : Re: Re : get_range_slices result
You can get the best of both worlds by repeating the key in a column,
and creating a secondary index on that column.
On Fri, Jun 24, 2011 at 1:16 PM, Sylvain Lebresne <sy...@datastax.com> wrote:
> On Fri, Jun 24, 2011 at 10:21 AM, karim abbouh <ka...@yahoo.fr> wrote:
>> i want get_range_slices() function returns records sorted(orded) by the
>> key(rowId) used during the insertion.
>> is
it possible?
>
> You will have to use the OrderPreservingPartitioner. This is no
> without inconvenience however.
> See for instance
> http://wiki.apache.org/cassandra/StorageConfiguration#line-100 or
> http://ria101.wordpress.com/2010/02/22/cassandra-randompartitioner-vs-orderpreservingpartitioner/
> that give more details on the pros and cons (the short version being
> that the main advantage of
> OrderPreservingPartitioner is what you're asking for, but it's main
> drawback is that load-balancing
> the cluster will likely be very very hard).
>
> In general the advice is to stick with RandomPartitioner and design a
> data model that avoids
needing
> range slices (or at least needing that the result is sorted). This is
> very often not too hard and more
> efficient, and much more simpler than to deal with the load balancing
> problems of OrderPreservingPartitioner.
>
> --
> Sylvain
>
>>
>> ________________________________
>> De : aaron morton <aa...@thelastpickle.com>
>> À : user@cassandra.apache.org
>> Envoyé le : Jeudi 23 Juin 2011 20h30
>> Objet : Re: get_range_slices result
>>
>> Not sure what your question is.
>> Does this help ? http://wiki.apache.org/cassandra/FAQ#range_rp
>> Cheers
>> -----------------
>> Aaron Morton
>> Freelance Cassandra Developer
>> @aaronmorton
>> http://www.thelastpickle.com
>> On 23 Jun 2011, at 21:59, karim abbouh wrote:
>>
>> how can get_range_slices() function returns sorting key ?
>> BR
>>
>>
>>
>>
>