thrift-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "" <>
Subject Re: C++ TimeUUID for Column Name
Date Tue, 17 Aug 2010 17:49:46 GMT
The client is in C++ using libcassandra as the interface to Thrift and Cassandra. I found my
problem about 30 seconds after sending the email... I was trying to assign a char* to a string
using the string constructor rather than using the assign method of the C++ string class.

Here is the C++ code I'm using to assign a TimeUUID to a string and have it passed successfully
to thrift:

uuid_t uu;
std::string suu

suu.assign((char *)uu, 16);

This type of assignment will successfully pass a TimeUUID to thrift and have it added as the
SuperColumn name to Cassandra.

Hope this helps someone else in the future.

> What language is your client in?
> On Tue, Aug 17, 2010 at 10:27 AM,
> > I have a ColumnFamily in Cassandra that is of Super type and each
> > SuperColumn name is a TimeUUID. I've had no problem using TimeUUID as the
> > SuperColumn name until now...
> >
> > I've looked at the thrift code and I see all of the writeBinary > functions
> > expect a std::string as the input which is perfectly fine for > everything
> > EXCEPT TimeUUID types. The TimeUUID I'm trying to insert has a 0x00 character within
it (and apparently that is valid for a TimeUUID). The string representation of my TimeUUID
> >
> > cb0b6a00-aa51-11df-9509-7071bc4c56eb
> >
> > Just to make sure this is accurate I wrote a quick C++ test using uuid_parse and
I was able to get the valid time back:
> >
> > 2010/08/17 18:50:12 (format: %Y/%m/%d %H:%M:%S)
> >
> > The 16-byte hex representation of this UUID is:
> >
> > 0xCB 0x0B 0x6A 0x00 0xAA 0x51 0x11 0xDF 0x95 0x09 0x70 0x71 0xBC 0x4C 0x56
> > 0xEB
> >
> > When trying to add this SuperColumn I'm obviously getting the error that
> > UUID's must be exactly 16 bytes. When the UUID is being converted to a
> > string, the copy looks to be stopping after the 3rd byte.
> >
> > Is there any way around this? This is kind of a show-stopper for me  and I
> > can't figure out how to workaround it... Any help would be MUCH appreciated.
Obama Urges Homeowners to Refinance
If you owe under $729k you probably qualify for Obama's Refi Program
View raw message