I guess, you suggest I just borrow the logic from that CompositeType.java, the “decompose” method, to comply with the protocol.
I thought I can just call it, but I don’t see the “decompose(Object... objects)” in the current 1.1.2 version, so probably your snippet is from the older version.
On the other hand, in the new version I see CompositeType.Builder inner class, looks like I should use that.
Could you please confirm?
I would really prefer to do it in Cassandra itself,
On 6/07/2012, at 10:40 AM, Leonid Ilyevsky wrote:
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.
This email, along with any attachments, is confidential and may be legally privileged or otherwise protected from disclosure. Any unauthorized dissemination, copying or use of the contents of this email is strictly prohibited and may be in violation of law. If you are not the intended recipient, any disclosure, copying, forwarding or distribution of this email is strictly prohibited and this email and any attachments should be deleted immediately. This email and any attachments do not constitute an offer to sell or a solicitation of an offer to purchase any interest in any investment vehicle sponsored by Moon Capital Management LP (“Moon Capital”). Moon Capital does not provide legal, accounting or tax advice. Any statement regarding legal, accounting or tax matters was not intended or written to be relied upon by any person as advice. Moon Capital does not waive confidentiality or privilege as a result of this email.