cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Leonid Ilyevsky <lilyev...@mooncapital.com>
Subject RE: Composite key in thrift java api
Date Fri, 06 Jul 2012 14:04:55 GMT
Thanks Aaron,

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?



Thanks,



Leonid


From: aaron morton [mailto:aaron@thelastpickle.com]
Sent: Thursday, July 05, 2012 7:10 PM
To: user@cassandra.apache.org
Subject: Re: Composite key in thrift java api

 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.


________________________________
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.

Mime
View raw message