I need to create a ByteBuffer instance containing the proper composite key, based on the values of the components of the key. I am going to use it for update operation.
I tried to simply concatenate the buffers corresponding to the components, but I am not sure this is correct, because I am getting exception that comes from the server :
InvalidRequestException(why:Not enough bytes to read value of component 0)
In the server log I see this:
org.apache.thrift.transport.TTransportException: Cannot read. Remote side has closed. Tried to read 4 bytes, but only got 0 bytes. (This is often indicative of an internal error on the server side. Please check your server logs.)
(I believe here when it says “server side” it actually means client, because it is the server’s log).
Seems like the buffer that my client sends is too short. I suspect there is a way in thrift to do it properly, but I don’t know how.
Looks like Hector has a Composite class that maybe can help, but at this point I would really prefer to do it in Cassandra itself, without Hector.