How to insert row with column TimeUUIDType in Cassandra?

In Kassandra, I have the following column family:

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

I am trying to insert a record into it, as shown below, using the generated C ++ function created 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 get the following error: "UUID must be exactly 16 bytes"

I even tried CLI Cassandra 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)
+5
source share
1 answer

Thrift is a binary protocol; 16 bytes - 16 bytes. "1968ec4a-2a73-11df-9aca-00012e27a270" - 36 bytes. You need your library to provide you with a raw 16-byte form.

++, " 1 uuid" - , Google, , . http://www.google.com/search?q=C%2B%2B+version+1+uuid

+7

All Articles