Open themanatuf opened 14 years ago
Ok, I think I found it - libgenthrift/cassandra_types.cpp. I took the warning at the top in the comments to heart, but I couldn't resist :)
ColumnPath::write function at (or near) line 687. For both this->super_column and this->column I added the .c_str() to return the character array rather than writing the string struct. The new function should look as follows:
uint32_t ColumnPath::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
xfer += oprot->writeStructBegin("ColumnPath");
xfer += oprot->writeFieldBegin("column_family", ::apache::thrift::protocol::T_STRING, 3);
xfer += oprot->writeString(this->column_family);
xfer += oprot->writeFieldEnd();
if (this->__isset.super_column) {
xfer += oprot->writeFieldBegin("super_column", ::apache::thrift::protocol::T_STRING, 4);
xfer += oprot->writeBinary(this->super_column.c_str());
xfer += oprot->writeFieldEnd();
}
if (this->__isset.column) {
xfer += oprot->writeFieldBegin("column", ::apache::thrift::protocol::T_STRING, 5);
xfer += oprot->writeBinary(this->column.c_str());
xfer += oprot->writeFieldEnd();
}
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
I haven't thoroughly tested this, but I AM able to add a column (or super column) with TimeUUID name. I hope this receives everyone well.
Ok, disregard my comment/changes earlier. I was not assigning my strings properly in C++ to accomodate TimeUUID's. Here is the proper way (in C++) to assign a TimeUUID to a string and have it get added successfully into Cassandra:
uuid_t uu;
string suu;
uuid_generate_time(uu);
suu.assign((char *)uu, 16);
key_space->insertColumn(row_key, cf, suu, col, val);
Hope that helps someone else in the future. Sorry for any confusion with my earlier posts.
I haven't been able to use a TimeUUID as a column name because TimeUUID's are supposed to be exactly 16 bytes. I've been reading through the libcassandra code and it looks like everything is getting converted into a std::string which is fine for everything except TimeUUID. Is there another way to use this as a column name or am I missing something? I'll dig deeper into the code to see if there is a quick way to fix it (although I do not think there is).