incubator-cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jonathan Ellis <jbel...@gmail.com>
Subject Re: Retrieving TimeUUID sub-columns in reverse order
Date Mon, 27 Dec 2010 04:29:50 GMT
If you are fetching multiple supercolumns, then that's what you can
control the order of.  If you are slicing within a single supercolumn,
the reverse parameter will affect the order of subcolumns.

On Sun, Dec 26, 2010 at 6:11 AM, Roshan Dawrani <roshandawrani@gmail.com> wrote:
> Hi Ran,
> I am not doing it the YAML way. I am defining my SCF through Hector API as
> below
>
> ================================================================
> ThriftCfDef cfDef = HFactory.createColumnFamilyDefinition(ksName, "SCF")
> cfDef.setColumnMetadata(...)
> cfDef.setColumnType(ColumnType.SUPER)
> cfDef.setSubComparatorType(ComparatorType.TIMEUUIDTYPE)
> ================================================================
>
> And this is the structure of the SCF:
> ================================================================
> "key1" :
>           "superCol1":
>                     SubColName1 (TimeUUID) : null
>                     SubColName2 (TimeUUID) : null
>                     SubColName3 (TimeUUID) : null
>           "superCol2":
>                     SubColName4 (TimeUUID) : null
>                     SubColName5 (TimeUUID) : null
>                     SubColName6 (TimeUUID) : null
> ================================================================
>
> I now try to retrieve the data as below, but for both reverse = true |
> false, it's only the order of supercolumns that changes. The subcolumns
> always come in the same order - oldest to newest
>
> ================================================================
> RangeSuperSlicesQuery#setRange (null, null, reverse, Integer.MAX_VALUE) //
> reverse = true | false
> ================================================================
>
> Anything I am doing wrong here?
>
> --
> Roshan
> Blog: http://roshandawrani.wordpress.com/
> Twitter: @roshandawrani
> Skype: roshandawrani
>
> On Sun, Dec 26, 2010 at 5:31 PM, Ran Tavory <rantav@gmail.com> wrote:
>>
>> Roshan, in cassandra.yaml did you define compare_subcolumns_with  for the
>> SCF?
>> The subcolumn names are the timeuuid, not the subcolumn values, right?
>>
>> On Sun, Dec 26, 2010 at 9:14 AM, Roshan Dawrani <roshandawrani@gmail.com>
>> wrote:
>>>
>>> Hi,
>>>
>>> I have a super ColumnFamily that has a few super columns, with each
>>> having a growing list of sub-columns where column name is a TimeUUID, so the
>>> sub-columns get stored chronologically (oldest to newest)
>>>
>>> When I retrieve this data, can I somehow retrieve the sub-columns in
>>> reverse order - newest first?
>>>
>>> I am using RangeSuperSlicesQuery to query the super columns and setting a
>>> range on it with reverse = true, but that only sorts the data by super
>>> column names.
>>>
>>> How can I tell RangeSuperSlicesQuery to get the sub-columns also in
>>> reverse order?
>>>
>>> Thanks.
>>>
>>> --
>>> Roshan
>>> Blog: http://roshandawrani.wordpress.com/
>>> Twitter: @roshandawrani
>>> Skype: roshandawrani
>>
>>
>>
>> --
>> /Ran
>
>



-- 
Jonathan Ellis
Project Chair, Apache Cassandra
co-founder of Riptano, the source for professional Cassandra support
http://riptano.com

Mime
View raw message