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 04E2A77C1 for ; Mon, 5 Dec 2011 17:13:41 +0000 (UTC) Received: (qmail 70589 invoked by uid 500); 5 Dec 2011 17:13:38 -0000 Delivered-To: apmail-cassandra-user-archive@cassandra.apache.org Received: (qmail 70551 invoked by uid 500); 5 Dec 2011 17:13:38 -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 70543 invoked by uid 99); 5 Dec 2011 17:13:38 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 05 Dec 2011 17:13:38 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of sdddilrukshi@gmail.com designates 209.85.161.44 as permitted sender) Received: from [209.85.161.44] (HELO mail-fx0-f44.google.com) (209.85.161.44) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 05 Dec 2011 17:13:30 +0000 Received: by faas1 with SMTP id s1so1026491faa.31 for ; Mon, 05 Dec 2011 09:13:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=9uwToYhr1+h3hacsaiHbQQ8A9k71+g0KQIEGnB/5gpk=; b=bGkRNrbObDtX4vXsJ6V8AWVGBnnKcZreoNkOwwefALLlRyjs5cgwM9vvdlBWXQe2z0 A2UdJsTQHuY8pKV+k1nvyKhWU7TcGHzAlC5cXhqov8ElBy+88E0zQQOZlIEDRnrorvYW c2RlEkQdJ0aPH8iMNL9gMhUDZAzaDXwOdbbg8= MIME-Version: 1.0 Received: by 10.227.207.205 with SMTP id fz13mr16127315wbb.0.1323105190174; Mon, 05 Dec 2011 09:13:10 -0800 (PST) Received: by 10.216.5.208 with HTTP; Mon, 5 Dec 2011 09:13:10 -0800 (PST) In-Reply-To: References: Date: Mon, 5 Dec 2011 22:43:10 +0530 Message-ID: Subject: Re: Setting Key Validation Class From: Dinusha Dilrukshi To: user@cassandra.apache.org Content-Type: multipart/alternative; boundary=000e0cd5146adc620e04b35b6ef0 X-Virus-Checked: Checked by ClamAV on apache.org --000e0cd5146adc620e04b35b6ef0 Content-Type: text/plain; charset=ISO-8859-1 Hi Filipe/ Samal, Thanks for clarifications. Regards, ~Dinusha~ On Mon, Dec 5, 2011 at 10:28 PM, samal wrote: > key_validation_class is different from validation_class > validation are BytesType by default. > > key_valdation_class => key > default_validation_class=>column_values > comparator=>column_name > > default_validation_class is global scope of validation_class > > > > On Mon, Dec 5, 2011 at 10:10 PM, Dinusha Dilrukshi > wrote: > >> Hi, >> >> I am using apache-cassandra-1.0.0 and I tried to insert/retrieve data in >> a column family using cassandra-jdbc program. >> Here is how I created 'USER' column family using cassandra-cli. >> >> create column family USER with comparator=UTF8Type >> and column_metadata=[{column_name: user_id, validation_class: UTF8Type, >> index_type: KEYS}, >> {column_name: username, validation_class: UTF8Type, index_type: KEYS}, >> {column_name: password, validation_class: UTF8Type}]; >> >> But, when i try to insert data to USER column family it gives the error >> "java.sql.SQLException: Mismatched types: java.lang.String cannot be cast >> to java.nio.ByteBuffer". >> >> Since I have set user_id as a KEY and it's validation_class as UTF8Type, >> I was expected Key Validation Class as UTF8Type. >> But when I look at the meta-data of USER column family it shows as "Key >> Validation Class: org.apache.cassandra.db.marshal.BytesType" which has >> cause for the above error. >> >> When I created USER column family as follows, it solves the above issue. >> >> create column family USER with comparator=UTF8Type and >> key_validation_class=UTF8Type >> and column_metadata=[{column_name: user_id, validation_class: UTF8Type, >> index_type: KEYS}, >> {column_name: username, validation_class: UTF8Type, index_type: KEYS}, >> {column_name: password, validation_class: UTF8Type}]; >> >> Do we always need to define *key_validation_class* as in the above query >> ? Isn't it not enough to add validation classes for each column ? >> >> Regards, >> ~Dinusha~ >> >> > --000e0cd5146adc620e04b35b6ef0 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Hi Filipe/ Samal,

Thanks for=A0clarifications.=A0
<= div>
Regards,
~Dinus= ha~



On Mon, Dec 5, 2011 at 10:28 PM, samal <= span dir=3D"ltr"><samalgorai@gma= il.com> wrote:
key_validation_class is different from validation_class
validation are B= ytesType by default.

key_valdation_class =3D> key
default_val= idation_class=3D>column_values
comparator=3D>column_name

de= fault_validation_class is global scope of validation_class



On Mon, Dec 5, 2011 at 10:10 PM, Dinusha= Dilrukshi <sdddilrukshi@gmail.com> wrote:
Hi,

I am using=A0apache-c= assandra-1.0.0 and I tried to insert/retrieve=A0data in a column family usi= ng cassandra-jdbc program.
Here is how I created 'USER' column family using cassandra-cli= .

create column family USER with comparator=3DUTF8Ty= pe
and column_metadata=3D[{column_name: user_id, validation_class= : UTF8Type, index_type: KEYS},
{column_name: username, validation= _class: UTF8Type, index_type: KEYS},
{column_name: password, validation_class: UTF8Type}];
=
But, when i try to insert data to USER column family it give= s the error "java.sql.SQLException: Mismatched types: java.lang.String= cannot be cast to java.nio.ByteBuffer".

Since I have set user_id as a KEY and it's=A0valida= tion_class as UTF8Type, I was expected=A0Key Validation Class as=A0UTF8Type= .=A0
But when I look at the meta-data of USER column family it sh= ows as "Key Validation Class: org.apache.cassandra.db.marshal.BytesTyp= e" which has cause for the above error.

When I created USER column family as follows, it solves= the above issue.

create column family USER w= ith comparator=3DUTF8Type and key_validation_class= =3DUTF8Type
and column_metadata=3D[{column_name: user_id, validation_class: UTF8Ty= pe, index_type: KEYS},
{column_name: username, validation_class: = UTF8Type, index_type: KEYS},
{column_name: password, validation_c= lass: UTF8Type}];

Do we always need to define=A0key_validation_class=A0as in the above query ? Isn't = it not enough to add validation classes for each column ?

Regards,
~Dinusha~



--000e0cd5146adc620e04b35b6ef0--