cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Benjamin>
Subject Re: Trying to insert a TimeUUID via Java/Thrift -- "UUIDs must be exactly 16 bytes"
Date Fri, 27 Aug 2010 07:51:59 GMT
You are using the wrong part of the example.  That code sample just
produces the string representation.  Scroll down in that FAQ entry to
the sample labeled:

"When you want to actually place the UUID into the Column then you'll
want to convert it like this. This method is often used in conjuntion
with the getTimeUUID() mentioned above."


On Fri, Aug 27, 2010 at 12:28 AM, Sean Bowman <> wrote:
> I'm at my wits end with Cassandra; is 0.6.4 just broken?  I've created a very simple
> <Keyspace Name="MyApp">
>  <ColumnFamily Name="History" CompareWith="TimeUUIDType"/>
> Using the Thrift sample code for 0.6 on the wiki, and the FAQ about TimeUUID's and Java,
I tried to generate a GUID using this method:
>        String key = new com.eaio.uuid.UUID().toString()
> Since all the Thrift get and insert statements use Strings for the keys.  But when I
send one of these GUID's, I get:
>        Exception in thread "main" InvalidRequestException(why:UUIDs must be exactly
16 bytes)
>                at org.apache.cassandra.thrift.Cassandra$
>                at org.apache.cassandra.thrift.Cassandra$Client.recv_insert(
>                at org.apache.cassandra.thrift.Cassandra$Client.insert(
> I even tried something like:
>        client.insert(keyspace, new String(asByteArray(getTimeUUID()), path, "Some
value".getBytes("UTF-8"), timestamp, ConsistencyLevel.ONE);
> Can anyone point me in the direction of how I send a time-based UUID to Cassandra 0.6.4
through the Java Thrift client?  Or am I missing the point of all of this somehow?

View raw message