incubator-cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Eric Evans <>
Subject Re: Need help to overcome: InvalidRequestException(why:UUIDs must be exactly 16 bytes)
Date Thu, 14 Oct 2010 18:55:57 GMT
On Thu, 2010-10-14 at 13:42 -0500, Eric Evans wrote:
> This list is for the development of Cassandra directly, your question is
> better posed on (moving it there).
> Before following up though, you might want to check the wiki and list
> archives, questions about creating TimeUUIDs from Java have been pretty
> common.  For example:
> On Thu, 2010-10-14 at 11:34 -0700, Wicked J wrote:
> > Hi,
> > I'm having issues with inserting data of TimeUUIDType in Cassandra v0.6.4.
> > The exception that I'm getting is: *InvalidRequestException(why:UUIDs must
> > be exactly 16 bytes)*
> > 
> > My objective is I want to insert comments and retrieve them in the order
> > they were inserted. My storage-conf.xml and code snippets are mentioned
> > below. Seems like the method "insert" in Cassandra.Client takes a String as
> > the id and in my case this value is actually a UUID and in the process of
> > converting the UUID (though 16 bytes in size) to String, the string value is
> > larger than 16 bytes which is causing the exception. 

The signature of insert() is:

  insert(String keyspace,
         String key, 
         ColumnPath column_path,
         byte[] value,
         long timestamp,
         ConsistencyLevel consistency_level)

So to store comments in a time-series manner use a TimeUUID *encoded to
a byte array* (byte[]) for the column attribute of column_path, with the
comment itself as the value (also as a byte[]).

Eric Evans

View raw message