Re: Sorting problem on supercolumns names using OPP on 0.6.2

2010-12-06 Thread Guillermo Winkler
o now it's behaving :) #define ntohll(x) (((_int64)(ntohl((int)((x << 32) >> 32))) << 32) | (unsigned int)ntohl(((int)(x >> 32 string result; result.resize(sizeof(long long)); long long bigendian = htonll(l); memcpy(&result[0], &bigendian, sizeof(long long)); => (super_column=1291668233,

Re: Sorting problem on supercolumns names using OPP on 0.6.2

2010-12-06 Thread Guillermo Winkler
uh, ok I was just copying :P string result; result.resize(sizeof(long long)); memcpy(&result[0], &l, sizeof(long long)); I'll try and let you know many thanks! On Mon, Dec 6, 2010 at 4:29 PM, Tyler Hobbs wrote: > How are you packing the longs into strings? The large negative numbers

Re: Sorting problem on supercolumns names using OPP on 0.6.2

2010-12-06 Thread David Replogle
+1 I'm doing this in my C++ client so contact me offlist if you need code David Sent from my iPhone On Dec 6, 2010, at 1:33 PM, Tyler Hobbs wrote: > Also, thought I should mention: > > When you make a std::string out of the char[], make sure to use the > constructor with the size_t parameter

Re: Sorting problem on supercolumns names using OPP on 0.6.2

2010-12-06 Thread Tyler Hobbs
Also, thought I should mention: When you make a std::string out of the char[], make sure to use the constructor with the size_t parameter (size 8). - Tyler On Mon, Dec 6, 2010 at 12:29 PM, Tyler Hobbs wrote: > That should be "big-endian". > > > On Mon, Dec 6, 2010 at 12:29 PM, Tyler Hobbs wro

Re: Sorting problem on supercolumns names using OPP on 0.6.2

2010-12-06 Thread Tyler Hobbs
That should be "big-endian". On Mon, Dec 6, 2010 at 12:29 PM, Tyler Hobbs wrote: > How are you packing the longs into strings? The large negative numbers > point to that being done incorrectly. > > Bitshifting and putting each byte of the long into a char[8] then > stringifying the char[] is th

Re: Sorting problem on supercolumns names using OPP on 0.6.2

2010-12-06 Thread Tyler Hobbs
How are you packing the longs into strings? The large negative numbers point to that being done incorrectly. Bitshifting and putting each byte of the long into a char[8] then stringifying the char[] is the best way to go. Cassandra expects big-ending longs, as well. - Tyler On Mon, Dec 6, 2010

Re: Sorting problem on supercolumns names using OPP on 0.6.2

2010-12-06 Thread Guillermo Winkler
I'm using thrift in C++ and inserting the results in a vector of pairs, so client-side-mangling does not seem to be the problem. Also I'm using a "test" column where I insert the same value I'm using as super column name (in this case the same date converted to string) and when queried using cassa

Re: Sorting problem on supercolumns names using OPP on 0.6.2

2010-12-06 Thread Tyler Hobbs
What client are you using? Is it storing the results in a hash map or some other type of non-order preserving dictionary? - Tyler On Mon, Dec 6, 2010 at 10:11 AM, Guillermo Winkler wrote: > Hi, I've the following schema defined: > > EventsByUserDate : { > UserId : { > epoch: { // SC > IID, >

Sorting problem on supercolumns names using OPP on 0.6.2

2010-12-06 Thread Guillermo Winkler
Hi, I've the following schema defined: EventsByUserDate : { UserId : { epoch: { // SC IID, IID, IID, IID }, // and the other events in time epoch: { IID, IID, IID } } } Where I'm expecting to store all the event ids for a user ordered by date (it's seconds since epoch as long long), I'm usin