cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jonathan Ellis <>
Subject Re: Trying to insert a TimeUUID via Java/Thrift -- "UUIDs must be exactly 16 bytes"
Date Fri, 27 Aug 2010 12:35:38 GMT
I recommend starting with,
then reading the other Recommended articles at

On Fri, Aug 27, 2010 at 3:07 AM, Sean Bowman <> wrote:
> Do I not want to get the key to be the UUID, so I can slice based on timestamp?  If
so, the only thing the insert statement takes is a String for a key.  Why would I place the
UUID into a column value?  Doesn't it belong as the key if I want to be able to slice and
sort on it?
> I guess I'm just completely confused about how Cassandra works.  All I'm trying to do
is record a history of what' going on in my app, and be able to pull it out in the order that
it happens, similar to the comments example in the WTF? article.  Am I going about this the
wrong way?
> On Aug 27, 2010, at 1:51 AM, Benjamin Black wrote:
>> 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."
>> b
>> 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:
>>> <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?

Jonathan Ellis
Project Chair, Apache Cassandra
co-founder of Riptano, the source for professional Cassandra support

View raw message