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 B960D17E5D for ; Fri, 27 Mar 2015 09:55:35 +0000 (UTC) Received: (qmail 33127 invoked by uid 500); 27 Mar 2015 09:54:58 -0000 Delivered-To: apmail-cassandra-user-archive@cassandra.apache.org Received: (qmail 33081 invoked by uid 500); 27 Mar 2015 09:54:58 -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 33071 invoked by uid 99); 27 Mar 2015 09:54:58 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 27 Mar 2015 09:54:58 +0000 X-ASF-Spam-Status: No, hits=1.8 required=5.0 tests=FREEMAIL_ENVFROM_END_DIGIT,HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS,T_REMOTE_IMAGE X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of amila1204@gmail.com designates 209.85.223.169 as permitted sender) Received: from [209.85.223.169] (HELO mail-ie0-f169.google.com) (209.85.223.169) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 27 Mar 2015 09:54:55 +0000 Received: by iedfl3 with SMTP id fl3so74778602ied.1 for ; Fri, 27 Mar 2015 02:53:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=x6U0mba4lNMcy6MYCq7BkV4FX+1TpiNiuVniyznBNYk=; b=Mh1r/W+3vI03EoowHp0yz0gKpx4fokxfjcgrEI5W4btBdOSGrVyu9o99kJBoe05YG7 3GfgmeUuswi7TUaxQqbkQrvIC6YBjyDq3irktXJNx8XBTODulnIz8cko7m4W+V6V1Yjh 7JgYuYraO8AusK3z3FvUYMJtCoO4WH+7NheUb+FOdu9xhjqEyX66ww8aX4k54qTV29zy 3aeVP/NQOtA4T81l+9oIjFzN6MioYy/SSEw4U4+kebVgAR8I5gfnZzZgZfSfn8bVCj3f taj0gfFpb86fVpJ/ivDUtJwJ/7lpP5L3XpMKYqn1C+Y5OmMz2hPto3sMF1pwR63GUfeU n7uw== X-Received: by 10.50.79.161 with SMTP id k1mr3818571igx.14.1427450004580; Fri, 27 Mar 2015 02:53:24 -0700 (PDT) MIME-Version: 1.0 Received: by 10.36.90.210 with HTTP; Fri, 27 Mar 2015 02:53:04 -0700 (PDT) In-Reply-To: References: From: Amila Paranawithana Date: Fri, 27 Mar 2015 15:23:04 +0530 Message-ID: Subject: Re: Java Driver 2.1 reading counter values from row To: user@cassandra.apache.org Content-Type: multipart/alternative; boundary=089e01183c36752f860512421ad2 X-Virus-Checked: Checked by ClamAV on apache.org --089e01183c36752f860512421ad2 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hi All, This is possible with cassandra-driver-core-2.1.5, with 'row.getLong("sum")'. Thanks On Fri, Mar 27, 2015 at 2:51 PM, Amila Paranawithana wrote: > in Apache Cassandra Java Driver 2.1 how to read counter type values from = a > row when iterating over result set. > > eg: If I have a counter table called 'countertable' with key and a counte= r > colum 'sum' how can I read the value of the counter column using Java > driver? > If I say, row.getInt("sum") this gives the following error, > > com.datastax.driver.core.exceptions.InvalidTypeException: Value sum is of > type counter > > Code :: > > ResultSet results =3D session.execute("SELECT * FROM simplex.countertable= ") > > for (Row row : results) { > System.out.println(row.getString("key"),row.getInt("sum"))); > } > > Thanks, > Amila > > > -- > > *Amila Iroshani Paranawithana , **Senior Software Engineer* *, > AdroitLogic * > | =E2=98=8E: +94779747398 > | =E2=9C=8D: http://amilaparanawithana.blogspot.com > [image: Facebook] [image: > Twitter] [image: LinkedIn] > [image= : > Skype] amila.paranawithana > =E2=80=8B > --=20 *Amila Iroshani Paranawithana , **Senior Software Engineer* *, AdroitLogic * | =E2=98=8E: +94779747398 | =E2=9C=8D: http://amilaparanawithana.blogspot.com [image: Facebook] [image: Twitter] [image: LinkedIn] [image: Skype] amila.paranawithana =E2=80=8B --089e01183c36752f860512421ad2 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hi All,

This is possible with cass= andra-driver-core-2.1.5, with 'row.getLong("sum")'.
Thanks

On Fri, Mar 27, 2015 at 2:51 PM, Amila Paranawithana <amila1204@g= mail.com> wrote:
in Apache Cassandra Java Driver 2.1 how to read cou= nter type values from a row when iterating over result set.

eg= : If I have a counter table called 'countertable' with key and a co= unter colum 'sum' how can I read the value of the counter column us= ing Java driver?
If I say, row.getInt("sum") this gives = the following error,

com.datastax= .driver.core.exceptions.InvalidTypeException: Value sum is of type counter<= /span>

Code ::
ResultSet results =3D se=
ssion.execute("SELECT * FROM simplex.countertable ")=
 
for (Row row : results) {
    System.out.println(row.getString("key"),row.getI=
nt("sum")));
}

Thanks,
Amila

--

<= p style=3D"margin:0px"> Amila Iroshani Paranawithana , Senior Software Engineer , AdroitLogic
| =E2=98=8E: +94779747398
|=C2=A0= =E2=9C=8D: http://amilaparanawithana.blogspot.com

=3D"Facebook" 3D"Twitter" =C2=A0 amila.paranawithana
=E2=80=8B =09



--

Amila Iroshani Paranawithana , Senior Software Engineer , AdroitLogic=
= | =E2=98=8E: = +94779747398
|=C2=A0=E2=9C=8D: http://amilaparanawithana.blogspot.com<= /span>

3D"Facebook" 3D"Twitter" 3D"LinkedIn"=C2=A03D"Skype" amila.par= anawithana
=E2=80=8B =09
--089e01183c36752f860512421ad2--