Return-Path: Delivered-To: apmail-cassandra-user-archive@www.apache.org Received: (qmail 63984 invoked from network); 5 Dec 2010 08:00:07 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 5 Dec 2010 08:00:07 -0000 Received: (qmail 75778 invoked by uid 500); 5 Dec 2010 08:00:04 -0000 Delivered-To: apmail-cassandra-user-archive@cassandra.apache.org Received: (qmail 75615 invoked by uid 500); 5 Dec 2010 08:00:04 -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 75607 invoked by uid 99); 5 Dec 2010 08:00:03 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 05 Dec 2010 08:00:03 +0000 X-ASF-Spam-Status: No, hits=1.5 required=10.0 tests=FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of hpk.warrier@gmail.com designates 209.85.216.44 as permitted sender) Received: from [209.85.216.44] (HELO mail-qw0-f44.google.com) (209.85.216.44) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 05 Dec 2010 07:59:55 +0000 Received: by qwg5 with SMTP id 5so10153011qwg.31 for ; Sat, 04 Dec 2010 23:59:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:date:message-id :subject:from:to:content-type; bh=yIelHvsLAZIhfu/sxfAATzEpbO6KeI/l41JIurtrWP0=; b=oEHsqVpgrW18DMk4GmRbXZPmxeTQeCy21h+wy6QwY7SfA4zR91Cj5e1UQ+sw90ywp4 D0rEk6oJ1pPoUHfMhhCh4LNgX2fDzMRbh6YNhFuxcXatQLQJFmz4cfXNRsAcebLEeK7w WIUXTKL1tjZAR4lUsJ4newDClrrRvxd57hEW8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=XQCNmDYCc9/zrb/0Y68UMrKbkjTDTflZfaffftgyk3Mv/3MPC4pZyp6CPv54R/vS55 jGWqzA5ifIlVQWo7MaXCVSMPOA3/fqTde/9Y45vt02T1ixVkEYqjFo7k+y5GJMSWq5qP uPsdpbmYHWr71Pu064Z/LOt4FWAjbcK8iRJ/w= MIME-Version: 1.0 Received: by 10.224.2.79 with SMTP id 15mr1609975qai.177.1291535973209; Sat, 04 Dec 2010 23:59:33 -0800 (PST) Received: by 10.224.217.66 with HTTP; Sat, 4 Dec 2010 23:59:33 -0800 (PST) Date: Sun, 5 Dec 2010 13:29:33 +0530 Message-ID: Subject: facing problem while using Erlang for Cassandra From: pradeep w To: user@cassandra.apache.org Content-Type: multipart/alternative; boundary=0015175ca98ae5d83b0496a52612 X-Virus-Checked: Checked by ClamAV on apache.org --0015175ca98ae5d83b0496a52612 Content-Type: text/plain; charset=ISO-8859-1 Hi I'm new to Erlang and Cassandra. I just tried to do a simple insert and i'm getting below error. I'm using Cassandra 0.6.8 . I took the erlang library code from,http://svn.apache.org/viewvc/thrift/trunk/lib/erl . And generated thrift interfaces from the cassandra.thrift available with cassandra. Where am i going wrong? Is there any document available mapping the cassandra interface parameter types to Erlang structures? Details are : Windows XP, Cassandra0.6.8, Erlang5.8.1 [R14], Java 1.6.0_17. I face no problems when I try the code in Java with Hector. So i guess i'm doing wrong mapping for erlang. The code is as follows: > timestamp() -> {MegaSecs, Secs, Microsec} = now(), MegaSecs*1000000000000 + Secs*1000000 + Microsec. > insert(N)-> Ts = timestamp(), COL_PATH = #columnPath{column_family = "OBJ", column = #column{name = "OBJID", value = > term_to_binary(N), timestamp = Ts} }, ARGS = ["TEST",integer_to_list(N),COL_PATH,term_to_binary(N),Ts,1], {ok, C} = thrift_client_util:new("localhost", 9090, cassandra_thrift, []), {C2,ok} = thrift_client:call(C, 'insert', ARGS). i tried giving column value as N and also as term_to_binary(N) but the result is same as error below. The error i get is following: > =ERROR REPORT==== 4-Dec-2010::22:18:56 === Bad value on output port 'tcp_inet' > ** exception error: no match of right hand side value {{protocol,thrift_binary_protocol, {binary_protocol, {transport,thrift_buffered_transport, {buffered_transport, {transport,thrift_socket_transport, {data,#Port<0.2193>,infinity}}, []}}, true,true}}, {error,einval}} in function thrift_client:send_function_call/3 in call from thrift_client:call/3 I get the same error when i try to use the "batch_mutate" as follows: > Mutation = #mutation{ column_or_supercolumn = #columnOrSuperColumn{ column = #column{name = "OBJID", value = N, timestamp = timestamp()} } }, Args = ["TEST", dict:store(N, dict:store("OBJ", [Mutation], dict:new()), dict:new()), ?cassandra_ONE], Response = thrift_client:call(State#state.connection, 'batch_mutate', Args), thanks pradeep --0015175ca98ae5d83b0496a52612 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
Hi
=A0I'm new to Erlang and Cassandra. I just tried to d= o a simple insert and i'm getting below error. I'm using Cassandra = 0.6.8 . I took the erlang library code from,http://svn.apache.org/viewvc/thrift/trunk/li= b/erl . And generated thrift interfaces from the cassandra.thrift avail= able with cassandra.=A0
Where am i going wrong? Is there any document available mapping the ca= ssandra interface parameter types =A0to Erlang structures?
Detail= s are : Windows XP, Cassandra0.6.8, Erlang5.8.1 [R14], Java 1.6.0_17.

I face no problems when I try the code in Java with Hec= tor. So i guess i'm doing wrong mapping for erlang.

The code is as follows:
timestamp() ->
{MegaSecs,= Secs, Microsec} =3D now(),
MegaSecs*1= 000000000000 + Secs*1000000 + Microsec.

insert(N)->
Ts =3D tim= estamp(), <= /blockquote>
COL_PATH = =3D #columnPath{column_family =3D "OBJ",
=A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 column =3D #column{name =3D "OBJID= ", value =3D term_to_binary(N), timestamp =3D Ts}
=A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 },
ARGS =3D [= "TEST",integer_to_list(N),COL_PATH,term_to_binary(N),Ts,1],
{ok, C} = =3D thrift_client_util:new("localhost", 9090, cassandra_thrift, [= ]),
{C2,ok} = =3D thrift_client:call(C, 'insert', ARGS).

i tried giving column value as N and also as term_to_binary(N) but = the result is same as error below.
The error i get is following:=A0
=3DERROR REPORT=3D=3D=3D=3D 4-Dec-2010::22:18:56 =3D=3D=3D
Bad value on output port 'tcp_inet'

** exception error: no match of right hand side value
=A0=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0{{protocol,thrift_binary_protocol= ,
=A0=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0{binary_protocol,
=A0=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 {transport,thrift_buffered_t= ransport,
=A0=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0{buffered_transport,
=A0=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 {transport,thrift_socket= _transport,
=A0=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0{data,#Port<0.2193= >,infinity}},
=A0=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 []}},
=A0=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 true,true}},
=A0=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 {error,einval}}
=A0=A0 =A0 in function =A0thrift_client:send_function_call/3 Mutation =3D #mutation{
column_or_= supercolumn =3D #columnOrSuperColumn{
column = =3D #column{name =3D "OBJID", value =3D N, timestamp =3D timestam= p()}
}
},
Args =3D ["TEST",=A0
dict:store= (N,=A0
dict:stor= e("OBJ", [Mutation], dict:new()),=A0
dict:new()= ),=A0
?cassandra_ONE],
Response =3D thrift_client:call(State#state.connection, 'batch_mutate&#= 39;, Args),
=A0
thanks
pradeep
--0015175ca98ae5d83b0496a52612--