I have a follow on question on this.

I have a super column family like this:

<ColumnFamily Name="EventSpace" CompareWith="TimeUUIDType"
CompareSubcolumnsWith="BytesType" ColumnType="Super"/>

I store some events keyed by a subscriber id, and for each such "row",
I have a number of super columns which are keyed by an event time
stamp. For example:

subscriber1 {
     ts11 { some columns}
     ts12 { some columns}
     ....
     ts1n { some columns}
}
subscriber2 {
     ts21 {...}
     ...
}

and so on.

What I want to do is to find all events within a period (given T, the
period starts from time (T-1 min) to (T+1 min)) for each subscriber,
given the subscriber ID and the starting time T. I used this piece of
code:

SlicePredicate sliceP = new SlicePredicate();
SliceRange range = new SliceRange();
range.setStart(getUUIDForTimeStamp(T-1));
range.setStart(getUUIDForTimeStamp(T+1));
sliceP.setSlice_range(range);
ColumnParent parent = new ColumnParent(CF_NAME);
List<ColumnOrSuperColumn> result = client.get_sllice(KS, subscriberID,
parent, slieceP, ConsistencyLevel.ALL);

I've helper routines to add/subtract minutes/hours/seconds to a time
stamp, and converting that to UUID and back. But is the approach
correct?

Regards
Arijit



On 12 January 2011 08:19, Aaron Morton <aa...@thelastpickle.com> wrote:
>
> If you were using OPP and get_range_slices then set the start_key to be 
> "com.google" and the end_key to be "". Get is slices of say 1,000 (use the 
> last key read as the next start_ket) and when you see the first key that does 
> not start with com.google top making calls.
> If you move the data from rows to columns, you can use the same approach.
> Aaron
>
> On 12 Jan, 2011,at 03:25 PM, Roshan Dawrani <roshandawr...@gmail.com> wrote:
>
> On Wed, Jan 12, 2011 at 7:41 AM, Koert Kuipers 
> <koert.kuip...@diamondnotch.com> wrote:
>>
>> Ok I see get_range_slice is really only useful for paging with RP..
>>
>> So if I were using OPP (which I am not) and I wanted all keys starting with 
>> "com.google", what should my start_key and end_key be?
>
> I think you can't. It's the columns that are sorted, and not the rows (if u r 
> not using OPP). With your "com.google....." data arranged in columns instead 
> of rows, you should be able to specify start_col, end_col to filter it.
>
>
>
>
>
>


--
"And when the night is cloudy,
There is still a light that shines on me,
Shine on until tomorrow, let it be."

Reply via email to