views:

1223

answers:

2

In Cassandra, I have the following Column Family:

<ColumnFamily CompareWith="TimeUUIDType" Name="Posts"/>

I'm trying to insert a record into it as follows using a C++ generated function generated by Thrift:

ColumnPath new_col;
new_col.__isset.column = true; /* this is required! */
new_col.column_family.assign("Posts");
new_col.super_column.assign("");
new_col.column.assign("1968ec4a-2a73-11df-9aca-00012e27a270");
client.insert("Keyspace1", "somekey", new_col, "Random Value", 1234, ONE);

However, I'm getting the following error: "UUIDs must be exactly 16 bytes"

I've even tried the Cassandra CLI with the following command:

set Keyspace1.Posts['somekey']['1968ec4a-2a73-11df-9aca-00012e27a270'] = 'Random Value'

but I still get the following error:

Exception null
InvalidRequestException(why:UUIDs must be exactly 16 bytes)
 at org.apache.cassandra.thrift.Cassandra$insert_result.read(Cassandra.java:11994)
 at org.apache.cassandra.thrift.Cassandra$Client.recv_insert(Cassandra.java:659)
 at org.apache.cassandra.thrift.Cassandra$Client.insert(Cassandra.java:632)
 at org.apache.cassandra.cli.CliClient.executeSet(CliClient.java:420)
 at org.apache.cassandra.cli.CliClient.executeCLIStmt(CliClient.java:80)
 at org.apache.cassandra.cli.CliMain.processCLIStmt(CliMain.java:132)
 at org.apache.cassandra.cli.CliMain.main(CliMain.java:173)
+4  A: 

Thrift is a binary protocol; 16 bytes means 16 bytes. "1968ec4a-2a73-11df-9aca-00012e27a270" is 36 bytes. You need to get your library to give you the raw, 16 bytes form.

I don't use C++ myself, but "version 1 uuid" is the magic string you want to google for when looking for a library that can do this. http://www.google.com/search?q=C%2B%2B+version+1+uuid

jbellis
A: 

I have the same problem. mixmasteralan, how did you resolve it ?

Olivier