You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by Gustavo Gustavo <do...@gmail.com> on 2012/01/25 05:19:39 UTC
CF Comparator type and get_slice
I suppose that a CF Comparator type is used to sort the columns based on
its type, right?
So, let's suppose I have two columns: 1, 3. If I insert column 2 I will end
up with 1, 2, 3, ok?
I'm using the default BytesType as the Comparator type to store time series
columns (actually the value is a C# DateTime.Ticks value - a long int). The
columns aren't inserted in order. But, later, when I use get_slice with
something like:
slice.Slice_range.Start
= BitConverter.GetBytes(dateFrom.Value.Ticks);
slice.Slice_range.Finish
= BitConverter.GetBytes(dateTo.Value.Ticks);
where dateFrom and dateTo are supplied by the user and may not (most
likely) correspond to an existing column name. I'm getting some
really weird results, from dates that are even outside the range supplied.
Any hint about this?
/Gustavo
Re: CF Comparator type and get_slice
Posted by aaron morton <aa...@thelastpickle.com>.
What are the column names you are getting back and the the byte values you are using in the start and from.
My guess is it's a serialization thing, try using an IntegerType in cassandra and have your client serialise the ticks long for you. If that works then work back to see whats going on.
Cheers
-----------------
Aaron Morton
Freelance Developer
@aaronmorton
http://www.thelastpickle.com
On 25/01/2012, at 5:19 PM, Gustavo Gustavo wrote:
> I suppose that a CF Comparator type is used to sort the columns based on its type, right?
> So, let's suppose I have two columns: 1, 3. If I insert column 2 I will end up with 1, 2, 3, ok?
>
> I'm using the default BytesType as the Comparator type to store time series columns (actually the value is a C# DateTime.Ticks value - a long int). The columns aren't inserted in order. But, later, when I use get_slice with something like:
>
> slice.Slice_range.Start = BitConverter.GetBytes(dateFrom.Value.Ticks);
> slice.Slice_range.Finish = BitConverter.GetBytes(dateTo.Value.Ticks);
>
> where dateFrom and dateTo are supplied by the user and may not (most likely) correspond to an existing column name. I'm getting some really weird results, from dates that are even outside the range supplied. Any hint about this?
>
> /Gustavo
Re: CF Comparator type and get_slice
Posted by Jianhui Zhang <wu...@yahoo.com>.
BytesType sorts values in byte order. That is: "2" (byte 50) is bigger than "10" (byte 49 48). It may or may not be relevant to your problem, depending on your column names and the inputs.
James
________________________________
From: Gustavo Gustavo <do...@gmail.com>
To: user@cassandra.apache.org
Sent: Tuesday, January 24, 2012 8:19 PM
Subject: CF Comparator type and get_slice
I suppose that a CF Comparator type is used to sort the columns based on its type, right?
So, let's suppose I have two columns: 1, 3. If I insert column 2 I will end up with 1, 2, 3, ok?
I'm using the default BytesType as the Comparator type to store time series columns (actually the value is a C# DateTime.Ticks value - a long int). The columns aren't inserted in order. But, later, when I use get_slice with something like:
slice.Slice_range.Start = BitConverter.GetBytes(dateFrom.Value.Ticks);
slice.Slice_range.Finish = BitConverter.GetBytes(dateTo.Value.Ticks);
where dateFrom and dateTo are supplied by the user and may not (most likely) correspond to an existing column name. I'm getting some really weird results, from dates that are even outside the range supplied. Any hint about this?
/Gustavo