You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by AJ Chen <aj...@web2express.org> on 2010/05/07 22:10:18 UTC

key is sorted?

I have a super column family for "topic", key being the name of the topic.
<ColumnFamily Name="Topic" CompareWith="UTF8Type" ColumnType="Super"
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

Re: key is sorted?

Posted by Roger Schildmeijer <sc...@gmail.com>.
Columns are sorted (see CompareWith/CompareSubcolumnsWith) keys are not.


On 7 maj 2010, at 22.10em, AJ Chen wrote:

> I have a super column family for "topic", key being the name of the topic.
> <ColumnFamily Name="Topic" CompareWith="UTF8Type" ColumnType="Super" 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


Re: key is sorted?

Posted by Jonathan Shook <js...@gmail.com>.
Although, if replication factor spans all nodes, then the disparity in
row allocation should be a non-issue when using
OrderPreservingPartitioner.

On Wed, May 12, 2010 at 6:42 PM, Vijay <vi...@gmail.com> wrote:
> If you use Random partitioner, You will NOT get RowKey's sorted. (Columns
> are sorted always).
> Answer: If used Random partitioner
> True True
>
> Regards,
> </VJ>
>
>
>
> On Wed, May 12, 2010 at 1:25 AM, David Boxenhorn <da...@lookin2.com> wrote:
>>
>> You do any kind of range slice, e.g. keys beginning with "abc"? But the
>> results will not be ordered?
>>
>> Please answer one of the following:
>>
>> True True
>> True False
>> False False
>>
>> Explain?
>>
>> Thanks!
>>
>> On Sun, May 9, 2010 at 8:27 PM, Vijay <vi...@gmail.com> wrote:
>>>
>>> True, The Range slice support was enabled in Random Partitioner for the
>>> hadoop support.
>>> Random partitioner actually hash the Key and those keys are sorted so we
>>> cannot have the actual key in order.... (Hope this doesnt confuse you)...
>>> Regards,
>>> </VJ>
>>>
>>>
>>>
>>> On Sun, May 9, 2010 at 12:00 AM, David Boxenhorn <da...@lookin2.com>
>>> 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 <aj...@web2express.org> wrote:
>>>>>
>>>>> thanks, that works. -aj
>>>>>
>>>>> On Fri, May 7, 2010 at 1:17 PM, Stu Hood <st...@rackspace.com>
>>>>> 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" <aj...@web2express.org>
>>>>>> 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.
>>>>>> <ColumnFamily Name="Topic" CompareWith="UTF8Type" ColumnType="Super"
>>>>>> 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
>>>>
>>>
>>
>
>

Re: key is sorted?

Posted by David Boxenhorn <da...@lookin2.com>.
Thank you. That is very good news. I can sort the results myself - what is
important is that I get them!

On Thu, May 13, 2010 at 2:42 AM, Vijay <vi...@gmail.com> wrote:

> If you use Random partitioner, You will *NOT* get RowKey's sorted.
> (Columns are sorted always).
>
> Answer: If used Random partitioner
> True True
>
> Regards,
> </VJ>
>
>
>
>
> On Wed, May 12, 2010 at 1:25 AM, David Boxenhorn <da...@lookin2.com>wrote:
>
>> You do any kind of range slice, e.g. keys beginning with "abc"? But the
>> results will not be ordered?
>>
>> Please answer one of the following:
>>
>> True True
>> True False
>> False False
>>
>> Explain?
>>
>> Thanks!
>>
>>
>> On Sun, May 9, 2010 at 8:27 PM, Vijay <vi...@gmail.com> wrote:
>>
>>> True, The Range slice support was enabled in Random Partitioner for the
>>> hadoop support.
>>>
>>> Random partitioner actually hash the Key and those keys are sorted so we
>>> cannot have the actual key in order.... (Hope this doesnt confuse you)...
>>>
>>> Regards,
>>> </VJ>
>>>
>>>
>>>
>>> On Sun, May 9, 2010 at 12:00 AM, David Boxenhorn <da...@lookin2.com>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 <aj...@web2express.org> wrote:
>>>>
>>>>> thanks, that works. -aj
>>>>>
>>>>>
>>>>> On Fri, May 7, 2010 at 1:17 PM, Stu Hood <st...@rackspace.com>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" <aj...@web2express.org>
>>>>>> 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.
>>>>>> <ColumnFamily Name="Topic" CompareWith="UTF8Type" ColumnType="Super"
>>>>>> 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
>>>>>
>>>>
>>>>
>>>
>>
>

Re: key is sorted?

Posted by Vijay <vi...@gmail.com>.
If you use Random partitioner, You will *NOT* get RowKey's sorted. (Columns
are sorted always).

Answer: If used Random partitioner
True True

Regards,
</VJ>



On Wed, May 12, 2010 at 1:25 AM, David Boxenhorn <da...@lookin2.com> wrote:

> You do any kind of range slice, e.g. keys beginning with "abc"? But the
> results will not be ordered?
>
> Please answer one of the following:
>
> True True
> True False
> False False
>
> Explain?
>
> Thanks!
>
>
> On Sun, May 9, 2010 at 8:27 PM, Vijay <vi...@gmail.com> wrote:
>
>> True, The Range slice support was enabled in Random Partitioner for the
>> hadoop support.
>>
>> Random partitioner actually hash the Key and those keys are sorted so we
>> cannot have the actual key in order.... (Hope this doesnt confuse you)...
>>
>> Regards,
>> </VJ>
>>
>>
>>
>> On Sun, May 9, 2010 at 12:00 AM, David Boxenhorn <da...@lookin2.com>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 <aj...@web2express.org> wrote:
>>>
>>>> thanks, that works. -aj
>>>>
>>>>
>>>> On Fri, May 7, 2010 at 1:17 PM, Stu Hood <st...@rackspace.com>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" <aj...@web2express.org>
>>>>> 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.
>>>>> <ColumnFamily Name="Topic" CompareWith="UTF8Type" ColumnType="Super"
>>>>> 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
>>>>
>>>
>>>
>>
>

Re: key is sorted?

Posted by David Boxenhorn <da...@lookin2.com>.
You do any kind of range slice, e.g. keys beginning with "abc"? But the
results will not be ordered?

Please answer one of the following:

True True
True False
False False

Explain?

Thanks!

On Sun, May 9, 2010 at 8:27 PM, Vijay <vi...@gmail.com> wrote:

> True, The Range slice support was enabled in Random Partitioner for the
> hadoop support.
>
> Random partitioner actually hash the Key and those keys are sorted so we
> cannot have the actual key in order.... (Hope this doesnt confuse you)...
>
> Regards,
> </VJ>
>
>
>
> On Sun, May 9, 2010 at 12:00 AM, David Boxenhorn <da...@lookin2.com>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 <aj...@web2express.org> wrote:
>>
>>> thanks, that works. -aj
>>>
>>>
>>> On Fri, May 7, 2010 at 1:17 PM, Stu Hood <st...@rackspace.com> 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" <aj...@web2express.org>
>>>> 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.
>>>> <ColumnFamily Name="Topic" CompareWith="UTF8Type" ColumnType="Super"
>>>> 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
>>>
>>
>>
>

Re: key is sorted?

Posted by Vijay <vi...@gmail.com>.
True, The Range slice support was enabled in Random Partitioner for the
hadoop support.

Random partitioner actually hash the Key and those keys are sorted so we
cannot have the actual key in order.... (Hope this doesnt confuse you)...

Regards,
</VJ>



On Sun, May 9, 2010 at 12:00 AM, David Boxenhorn <da...@lookin2.com> 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 <aj...@web2express.org> wrote:
>
>> thanks, that works. -aj
>>
>>
>> On Fri, May 7, 2010 at 1:17 PM, Stu Hood <st...@rackspace.com> 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" <aj...@web2express.org>
>>> 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.
>>> <ColumnFamily Name="Topic" CompareWith="UTF8Type" ColumnType="Super"
>>> 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
>>
>
>

Re: key is sorted?

Posted by AJ Chen <aj...@web2express.org>.
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 <aj...@web2express.org> 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 <da...@lookin2.com>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 <aj...@web2express.org> wrote:
>>
>>> thanks, that works. -aj
>>>
>>>
>>> On Fri, May 7, 2010 at 1:17 PM, Stu Hood <st...@rackspace.com> 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" <aj...@web2express.org>
>>>> 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.
>>>> <ColumnFamily Name="Topic" CompareWith="UTF8Type" ColumnType="Super"
>>>> 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

Re: key is sorted?

Posted by AJ Chen <aj...@web2express.org>.
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 <da...@lookin2.com> 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 <aj...@web2express.org> wrote:
>
>> thanks, that works. -aj
>>
>>
>> On Fri, May 7, 2010 at 1:17 PM, Stu Hood <st...@rackspace.com> 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" <aj...@web2express.org>
>>> 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.
>>> <ColumnFamily Name="Topic" CompareWith="UTF8Type" ColumnType="Super"
>>> 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

Re: key is sorted?

Posted by David Boxenhorn <da...@lookin2.com>.
Thanks!

I just wanted to be extra sure about that....

On Sun, May 9, 2010 at 3:54 PM, Shinpei Ohtani <sh...@gmail.com>wrote:

> > But you will get all the keys, right?
>
> Yes.
>
> On Sun, May 9, 2010 at 9:45 PM, David Boxenhorn <da...@lookin2.com> wrote:
> > But you will get all the keys, right?
> >
> > I want to get all the keys, but I don't care about the order.
> >
> > On Sun, May 9, 2010 at 3:25 PM, Shinpei Ohtani <shinpei.ohtani@gmail.com
> >
> > wrote:
> >>
> >> Hi,
> >>
> >> > If you use random partitioning, you can loop through all keys with a
> >> > range
> >> > query, but they will not be sorted.
> >> >
> >> > True or False?
> >>
> >> I think they will be sorted in a way of MD5 hash if you use
> >> RandomPartitioner,
> >> at least I looked into SSTables and RandomPartitioner#getToken.
> >>
> >> On Sun, May 9, 2010 at 4:00 PM, David Boxenhorn <da...@lookin2.com>
> 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 <aj...@web2express.org>
> wrote:
> >> >>
> >> >> thanks, that works. -aj
> >> >>
> >> >> On Fri, May 7, 2010 at 1:17 PM, Stu Hood <st...@rackspace.com>
> >> >> 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" <aj...@web2express.org>
> >> >>> 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.
> >> >>> <ColumnFamily Name="Topic" CompareWith="UTF8Type" ColumnType="Super"
> >> >>> 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
> >> >
> >> >
> >>
> >>
> >>
> >> --
> >> =============================
> >> Shinpei Ohtani
> >> mail    : shinpei.ohtani@gmail.com
> >> blog    : http://d.hatena.ne.jp/shot6/
> >> twitter : http://twitter.com/shot6
> >> =============================
> >
> >
>
>
>
> --
> =============================
> Shinpei Ohtani
> mail    : shinpei.ohtani@gmail.com
> blog    : http://d.hatena.ne.jp/shot6/
> twitter : http://twitter.com/shot6 (japanese)
>            http://twitter.com/shinpei_ohtani (english)
>
> =============================
>

Re: key is sorted?

Posted by Shinpei Ohtani <sh...@gmail.com>.
> But you will get all the keys, right?

Yes.

On Sun, May 9, 2010 at 9:45 PM, David Boxenhorn <da...@lookin2.com> wrote:
> But you will get all the keys, right?
>
> I want to get all the keys, but I don't care about the order.
>
> On Sun, May 9, 2010 at 3:25 PM, Shinpei Ohtani <sh...@gmail.com>
> wrote:
>>
>> Hi,
>>
>> > If you use random partitioning, you can loop through all keys with a
>> > range
>> > query, but they will not be sorted.
>> >
>> > True or False?
>>
>> I think they will be sorted in a way of MD5 hash if you use
>> RandomPartitioner,
>> at least I looked into SSTables and RandomPartitioner#getToken.
>>
>> On Sun, May 9, 2010 at 4:00 PM, David Boxenhorn <da...@lookin2.com> 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 <aj...@web2express.org> wrote:
>> >>
>> >> thanks, that works. -aj
>> >>
>> >> On Fri, May 7, 2010 at 1:17 PM, Stu Hood <st...@rackspace.com>
>> >> 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" <aj...@web2express.org>
>> >>> 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.
>> >>> <ColumnFamily Name="Topic" CompareWith="UTF8Type" ColumnType="Super"
>> >>> 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
>> >
>> >
>>
>>
>>
>> --
>> =============================
>> Shinpei Ohtani
>> mail    : shinpei.ohtani@gmail.com
>> blog    : http://d.hatena.ne.jp/shot6/
>> twitter : http://twitter.com/shot6
>> =============================
>
>



-- 
=============================
Shinpei Ohtani
mail    : shinpei.ohtani@gmail.com
blog    : http://d.hatena.ne.jp/shot6/
twitter : http://twitter.com/shot6 (japanese)
            http://twitter.com/shinpei_ohtani (english)

=============================

Re: key is sorted?

Posted by David Boxenhorn <da...@lookin2.com>.
But you will get all the keys, right?

I want to get all the keys, but I don't care about the order.

On Sun, May 9, 2010 at 3:25 PM, Shinpei Ohtani <sh...@gmail.com>wrote:

> Hi,
>
> > If you use random partitioning, you can loop through all keys with a
> range
> > query, but they will not be sorted.
> >
> > True or False?
>
> I think they will be sorted in a way of MD5 hash if you use
> RandomPartitioner,
> at least I looked into SSTables and RandomPartitioner#getToken.
>
> On Sun, May 9, 2010 at 4:00 PM, David Boxenhorn <da...@lookin2.com> 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 <aj...@web2express.org> wrote:
> >>
> >> thanks, that works. -aj
> >>
> >> On Fri, May 7, 2010 at 1:17 PM, Stu Hood <st...@rackspace.com>
> 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" <aj...@web2express.org>
> >>> 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.
> >>> <ColumnFamily Name="Topic" CompareWith="UTF8Type" ColumnType="Super"
> >>> 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
> >
> >
>
>
>
> --
> =============================
> Shinpei Ohtani
> mail    : shinpei.ohtani@gmail.com
> blog    : http://d.hatena.ne.jp/shot6/
> twitter : http://twitter.com/shot6
> =============================
>

Re: key is sorted?

Posted by Shinpei Ohtani <sh...@gmail.com>.
Hi,

> If you use random partitioning, you can loop through all keys with a range
> query, but they will not be sorted.
>
> True or False?

I think they will be sorted in a way of MD5 hash if you use RandomPartitioner,
at least I looked into SSTables and RandomPartitioner#getToken.

On Sun, May 9, 2010 at 4:00 PM, David Boxenhorn <da...@lookin2.com> 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 <aj...@web2express.org> wrote:
>>
>> thanks, that works. -aj
>>
>> On Fri, May 7, 2010 at 1:17 PM, Stu Hood <st...@rackspace.com> 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" <aj...@web2express.org>
>>> 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.
>>> <ColumnFamily Name="Topic" CompareWith="UTF8Type" ColumnType="Super"
>>> 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
>
>



-- 
=============================
Shinpei Ohtani
mail    : shinpei.ohtani@gmail.com
blog    : http://d.hatena.ne.jp/shot6/
twitter : http://twitter.com/shot6
=============================

Re: key is sorted?

Posted by David Boxenhorn <da...@lookin2.com>.
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 <aj...@web2express.org> wrote:

> thanks, that works. -aj
>
>
> On Fri, May 7, 2010 at 1:17 PM, Stu Hood <st...@rackspace.com> 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" <aj...@web2express.org>
>> 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.
>> <ColumnFamily Name="Topic" CompareWith="UTF8Type" ColumnType="Super"
>> 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
>

Re: key is sorted?

Posted by AJ Chen <aj...@web2express.org>.
thanks, that works. -aj

On Fri, May 7, 2010 at 1:17 PM, Stu Hood <st...@rackspace.com> 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" <aj...@web2express.org>
> 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.
> <ColumnFamily Name="Topic" CompareWith="UTF8Type" ColumnType="Super"
> 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

RE: key is sorted?

Posted by Stu Hood <st...@rackspace.com>.
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" <aj...@web2express.org>
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.
<ColumnFamily Name="Topic" CompareWith="UTF8Type" ColumnType="Super"
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