> I would really prefer to do it in Cassandra itself, See https://github.com/apache/cassandra/blob/trunk/src/java/org/apache/cassandra/db/marshal/CompositeType.java
Cheers ----------------- Aaron Morton Freelance Developer @aaronmorton http://www.thelastpickle.com 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. > > Thanks! > > Leonid > > > 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.