From user-return-27460-apmail-cassandra-user-archive=cassandra.apache.org@cassandra.apache.org Fri Jul 6 14:05:33 2012 Return-Path: X-Original-To: apmail-cassandra-user-archive@www.apache.org Delivered-To: apmail-cassandra-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 9178FD3AD for ; Fri, 6 Jul 2012 14:05:33 +0000 (UTC) Received: (qmail 58541 invoked by uid 500); 6 Jul 2012 14:05:31 -0000 Delivered-To: apmail-cassandra-user-archive@cassandra.apache.org Received: (qmail 58166 invoked by uid 500); 6 Jul 2012 14:05:29 -0000 Mailing-List: contact user-help@cassandra.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@cassandra.apache.org Delivered-To: mailing list user@cassandra.apache.org Received: (qmail 58138 invoked by uid 99); 6 Jul 2012 14:05:29 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 06 Jul 2012 14:05:29 +0000 X-ASF-Spam-Status: No, hits=2.2 required=5.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of lilyevsky@mooncapital.com designates 38.105.147.185 as permitted sender) Received: from [38.105.147.185] (HELO mcm-exch-hc.MoonCapital.Corp) (38.105.147.185) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 06 Jul 2012 14:05:23 +0000 Received: from mcm-exch-mb.MoonCapital.Corp ([::1]) by mcm-exch-hc.MoonCapital.Corp ([10.5.1.85]) with mapi; Fri, 6 Jul 2012 10:04:56 -0400 From: Leonid Ilyevsky To: "'user@cassandra.apache.org'" Date: Fri, 6 Jul 2012 10:04:55 -0400 Subject: RE: Composite key in thrift java api Thread-Topic: Composite key in thrift java api Thread-Index: Ac1bA3vUg0He7JVFRUqeWsuf+v5dAgAexE1Q Message-ID: References: <41A0E175-CC7F-49CE-8D1C-5B6624777D19@thelastpickle.com> In-Reply-To: <41A0E175-CC7F-49CE-8D1C-5B6624777D19@thelastpickle.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US Content-Type: multipart/alternative; boundary="_000_A663AF0EC22BAB47966CA61D63C01B385606D232mcmexchmbMoonCa_" MIME-Version: 1.0 X-Virus-Checked: Checked by ClamAV on apache.org --_000_A663AF0EC22BAB47966CA61D63C01B385606D232mcmexchmbMoonCa_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable 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... obje= cts)" in the current 1.1.2 version, so probably your snippet is from the ol= der version. On the other hand, in the new version I see CompositeType.Builder inner cla= ss, 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/cass= andra/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 come= s 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 h= as closed. Tried to read 4 bytes, but only got 0 bytes. (This is often indi= cative of an internal error on the server side. Please check your server lo= gs.) (I believe here when it says "server side" it actually means client, becaus= e it is the server's log). Seems like the buffer that my client sends is too short. I suspect there i= s 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 po= int 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 dissemi= nation, 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 so= licitation of an offer to purchase any interest in any investment vehicle s= ponsored 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 privi= lege 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 dissemi= nation, 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 so= licitation of an offer to purchase any interest in any investment vehicle s= ponsored 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 privi= lege as a result of this email. --_000_A663AF0EC22BAB47966CA61D63C01B385606D232mcmexchmbMoonCa_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

Thanks Aaron,

 

I guess, you suggest I just borrow the logic from that Compo= siteType.java, the “decompose” method, to comply with the proto= col.

I thought I can just call it, but I don’t see the R=
20;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 u=
se that.
Could you please confirm?=
 
Thanks,
 
Leonid

 

 

From: aaron mo= rton [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/cassand= ra/db/marshal/CompositeType.java

 

Cheers

 

 

-----------------

Aaron Morton

Freelance Developer

@aaronmorton

 

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 goin= g to use it for update operation.

I tried to simply concatenate the buffers corresponding to t= he components, but I am not sure this is correct, because I am getting exce= ption that comes from the server :

 

InvalidRequestException(why:Not enough bytes to read value o= f 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. (Thi= s 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 ac= tually means client, because it is the server’s log).

 

Seems like the buffer that my client sends is too short. &nb= sp;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, with= out Hector.

 

Thanks!

 

Leonid

 

 


This email, along with any attachments, is confidential and may= be legally privileged or otherwise protected from disclosure. Any unauthor= ized 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, co= pying, 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 a= n offer to sell or a solicitation of an offer to purchase any interest in a= ny 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 r= esult of this email.

 



This email, along with any a= ttachments, is confidential and may be legally privileged or otherwise prot= ected from disclosure. Any unauthorized dissemination, copying or use of th= e 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 purcha= se any interest in any investment vehicle sponsored by Moon Capital Managem= ent LP (“Moon Capital”). Moon Capital does not provide legal, a= ccounting 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 o= r privilege as a result of this email.
--_000_A663AF0EC22BAB47966CA61D63C01B385606D232mcmexchmbMoonCa_--