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 DCAD910169 for ; Thu, 18 Jul 2013 06:38:55 +0000 (UTC) Received: (qmail 13535 invoked by uid 500); 18 Jul 2013 06:38:51 -0000 Delivered-To: apmail-cassandra-user-archive@cassandra.apache.org Received: (qmail 13388 invoked by uid 500); 18 Jul 2013 06:38:50 -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 13199 invoked by uid 99); 18 Jul 2013 06:38:48 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 18 Jul 2013 06:38:48 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,NORMAL_HTTP_TO_IP,RCVD_IN_DNSWL_LOW,SPF_PASS,WEIRD_PORT X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of sylvain@datastax.com designates 209.85.160.48 as permitted sender) Received: from [209.85.160.48] (HELO mail-pb0-f48.google.com) (209.85.160.48) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 18 Jul 2013 06:38:41 +0000 Received: by mail-pb0-f48.google.com with SMTP id ma3so2780199pbc.35 for ; Wed, 17 Jul 2013 23:38:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:x-gm-message-state; bh=kc40gtLl0xZ9VmxBUZB0NAnGLfD/L+cubikSoCX0b84=; b=azbdNa39FKVOmNBFyiUcznTW8sOEP8QCKUtmCqv8shOQQiGbZzHFEBKbXFFCla6DqN TGRRc1LG/GCRDgxBa94Nx3R1hAYBk0rSxnXLtk4CwvJDhgwiL1mXPxWTKuJujMGHetUv CZW9srKMzyOytVwQVjzWbhEkg/FtJJiC+xfa9SlSkmSJ1LcIYLpoEyBCMoRmLf7z5Mq5 LEuNKfAzKusxYrAsSOlsN9yGOA3DVKOST9lViQOHGHcJfaYmnwFJ9FJNzF074NJbrc4M uolxTe2jvhq1eWyn+phYDmuPWWMs2k6+pBi9Y/L7oGdeoXdUgFzlSDqV3D3QTfa78E/A 58YA== MIME-Version: 1.0 X-Received: by 10.66.179.78 with SMTP id de14mr11449331pac.18.1374129500061; Wed, 17 Jul 2013 23:38:20 -0700 (PDT) Received: by 10.68.88.37 with HTTP; Wed, 17 Jul 2013 23:38:19 -0700 (PDT) In-Reply-To: <0A40042D85E7C84DB443060EC44B3FD34751BDC60B@dekaexchange07.deka.local> References: <0A40042D85E7C84DB443060EC44B3FD34751BDC60B@dekaexchange07.deka.local> Date: Thu, 18 Jul 2013 08:38:19 +0200 Message-ID: Subject: Re: InvalidRequestException(why:Not enough bytes to read value of component 0) From: Sylvain Lebresne To: "user@cassandra.apache.org" Content-Type: multipart/alternative; boundary=047d7bea3ccaba113404e1c37442 X-Gm-Message-State: ALoCoQmLlnM7xZdFo1Umouf7HcpTGi7XDgttzTVX22hIzgCfrCfylDuEOJ63VnpK8sQu3U5fKfF0 X-Virus-Checked: Checked by ClamAV on apache.org --047d7bea3ccaba113404e1c37442 Content-Type: text/plain; charset=ISO-8859-1 I don't know Hector very much really, but I highly suspect that "ts.toString()" is wrong, since composite column names are not strings. So again, not a Hector expert, but I can't really see how converting the composite into string could work. -- Sylvain On Wed, Jul 17, 2013 at 11:14 PM, Rahul Gupta wrote: > Getting error while trying to persist data in a Column Family having a > CompositeType comparator**** > > ** ** > > *Using Cassandra ver 1.1.9.7* > > *Hector Core ver 1.1.5 API ( which uses Thrift 1.1.10)* > > ** ** > > *Created Column Family using cassandra-cli:* > > ** ** > > create column family event_counts**** > > with comparator = 'CompositeType(DateType,UTF8Type)'**** > > and key_validation_class = 'UUIDType'**** > > and default_validation_class = 'CounterColumnType';**** > > ** ** > > *Persistence Code(*sumLoad.java):**** > > ** ** > > *import* me.prettyprint.cassandra.serializers.StringSerializer;**** > > *import* me.prettyprint.cassandra.serializers.DateSerializer;**** > > *import* me.prettyprint.cassandra.service.CassandraHostConfigurator;**** > > *import* me.prettyprint.hector.api.Cluster;**** > > *import* me.prettyprint.hector.api.Keyspace;**** > > *import* me.prettyprint.hector.api.beans.Composite;**** > > *import* me.prettyprint.hector.api.beans.HCounterColumn;**** > > *import* me.prettyprint.hector.api.factory.HFactory;**** > > *import* me.prettyprint.hector.api.mutation.Mutator;**** > > *import* java.sql.Date;**** > > *import* java.util.logging.Level;**** > > ** ** > > *public* *class* sumLoad { **** > > **** > > *final* *static* Cluster *cluster* = HFactory.* > getOrCreateCluster*("Dev", *new* CassandraHostConfigurator(" > 100.10.0.6:9160"));**** > > *final* *static* Keyspace *keyspace* = HFactory.* > createKeyspace*("Events", *cluster*);**** > > *final* *static* StringSerializer *ss* = StringSerializer. > *get*();**** > > ** ** > > *private* *boolean* storeCounts(String vKey, String > counterCF, Date dateStr, String vStr, *long* value)**** > > {**** > > *try***** > > {**** > > Mutator m1 = HFactory.*createMutator*(* > keyspace*, StringSerializer.*get*());**** > > **** > > Composite ts = *new* Composite();**** > > ts.addComponent(dateStr, DateSerializer.*get*());** > ** > > ts.addComponent(vStr, StringSerializer.*get*());*** > * > > HCounterColumn hColumn_ts = HFactory.* > createCounterColumn*(ts.toString(), value, StringSerializer.*get*());**** > > **** > > m1.insertCounter(vKey, counterCF, hColumn_ts);**** > > m1.execute(); **** > > *return* *true*;**** > > }**** > > *catch*(Exception ex)**** > > {**** > > LOGGER.*log*(Level.*WARNING*, "Unable > to store record", ex); **** > > }**** > > *return* *false*;**** > > } **** > > ** ** > > *public* *static* *void* main(String[] args) {**** > > ** ** > > Date vDate = *new* Date(0);**** > > sumLoad SumLoad = *new* sumLoad();**** > > SumLoad.storeCounts("b9874e3e-4a0e-4e60-ae23-c3f1e575af93", "event_counts", > vDate, "StoreThisString", 673);**** > > }**** > > ** ** > > }**** > > ** ** > > *Error:* > > ** ** > > [main] INFO me.prettyprint.cassandra.service.JmxMonitor - Registering JMX > me.prettyprint.cassandra.service_Dev:ServiceType=hector,MonitorType=hector > **** > > Unable to store record**** > > *me.prettyprint.hector.api.exceptions.HInvalidRequestException*: > InvalidRequestException(why:Not enough bytes to read value of component 0) > **** > > ** ** > > ** ** > > *Rahul Gupta* > This e-mail and the information, including any attachments, it contains > are intended to be a confidential communication only to the person or > entity to whom it is addressed and may contain information that is > privileged. If the reader of this message is not the intended recipient, > you are hereby notified that any dissemination, distribution or copying of > this communication is strictly prohibited. If you have received this > communication in error, please immediately notify the sender and destroy > the original message.**** > > ** ** > > ------------------------------ > This e-mail and the information, including any attachments, it contains > are intended to be a confidential communication only to the person or > entity to whom it is addressed and may contain information that is > privileged. If the reader of this message is not the intended recipient, > you are hereby notified that any dissemination, distribution or copying of > this communication is strictly prohibited. If you have received this > communication in error, please immediately notify the sender and destroy > the original message. > > Thank you. > > Please consider the environment before printing this email. > --047d7bea3ccaba113404e1c37442 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
I don't know Hector very much really, but I highly sus= pect that "ts.toString()" is wrong, since composite column names = are not strings. So again, not a Hector expert, but I can't really see = how converting the composite into string could work.

--
Sylvain
<= br>
On Wed, Jul 17, 2013 at 11:14 PM, Rahul G= upta <rgupta@dekaresearch.com> wrote:

Getting error while trying to persist data in a Colu= mn Family having a CompositeType comparator

=A0

Using Cassandra ver 1.1.9.7

Hector Core ver 1.1.5 API ( which uses Thrift 1.1= .10)

=A0

Created Column Family using cassandra-cli:=

=A0

= create column family event_counts

= with comparator =3D 'CompositeType(DateType,UTF8Type)'

= and key_validation_class =3D 'UUIDType'

= and default_validation_class =3D 'CounterColumnType';=

=A0

Persistence Code(sumLoad.java):

=A0

import me.prettyprint.cassandra.se= rializers.StringSerializer;

import me.prettyprint.cassandra.se= rializers.DateSerializer;

import me.prettyprint.cassandra.se= rvice.CassandraHostConfigurator;

import me.prettyprint.hector.api.C= luster;

import me.prettyprint.hector.api.K= eyspace;

import me.prettyprint.hector.api.b= eans.Composite;

import me.prettyprint.hector.api.beans.HCounterC= olumn;=

import me.prettyprint.hector.api.f= actory.HFactory;

import me.prettyprint.hector.api.m= utation.Mutator;

import java.sql.Date;

import java.util.logging.Level;

=A0

=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 public class= sumLoad {

=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 final static Cluster cluster =3D HFactory.getOrCreateCluster("Dev", new C= assandraHostConfigurator("100.10.0.6:9160"));

=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 =A0=A0= =A0 final static Keyspace keyspace =3D HFactory.createKeyspace("Events", cluster);

=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 =A0=A0= =A0 final static StringSerializer ss = =3D StringSerializer.get();

=A0

=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 =A0=A0= =A0 private boolean storeCounts(String vKey, String counterCF, Date dateStr, String vStr, long = value)=

=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 =A0=A0= =A0 {<= u>

=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=A0 try

=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=A0 {

=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 =A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0 Mutator<String> m1 =3D HFactory.createMut= ator(keyspace, StringSerializer.get());

=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=A0=A0=A0=A0=A0=A0=A0 =A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0Composite ts =3D new C= omposite();

=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 =A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0 ts.addComponent(dateStr, DateSerializer.get= ());

=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 =A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0 ts.addComponent(vStr, StringSerializer.get(= ));=

=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 =A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0 HCounterColumn<String> hColu= mn_ts =3D HFactory.createCounterColumn(ts.toString(), value, StringS= erializer.get());

=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=A0=A0=A0=A0=A0=A0=A0=A0 =A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0m1.insertCounter(vKey, counterCF, hColumn_ts);<= /span>

=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 =A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0 m1.execute();=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=A0=A0=A0=A0=A0return true;=

=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=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=A0=A0 catch= (Exception ex)

=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=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=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 =A0=A0=A0= =A0LOGGER.log(Level.WARNING, "Unable to store record", ex);=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=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=A0=A0=A0=A0=A0 =A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 return false= ;

=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

=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 =A0=A0= =A0 public static void = main(String[] args) {

=A0

=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 =A0=A0= =A0 =A0=A0=A0=A0=A0=A0=A0 Date vDate =3D new D= ate(0);

=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 =A0=A0= =A0 =A0=A0=A0=A0=A0=A0=A0 sumLoad SumLoad =3D new s= umLoad();<= /u>

SumLoad.storeCounts(= "b9874e3e-4a0e-4e60-ae23-c3f1e575af93", "event_counts", vDate, "StoreThisString", 673);

=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 =A0=A0= =A0 }<= u>

=A0

=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 }

=A0

Error:

=A0

[main] INFO me.prettyprint.cassa= ndra.service.JmxMonitor - Registering JMX me.prettyprint.cassandra.service_= Dev:ServiceType=3Dhector,MonitorType=3Dhector

Unable to store record

me.prettyprint.hector.api.ex= ceptions.HInvalidRequestException: InvalidRequestException(why:Not enough bytes to read value of component 0)

=A0

=A0

Rahul Gupta
This e-mail and the information, including any attachments= , it contains are intended to be a confidential communication only to the p= erson or entity to whom it is addressed and may contain information that is privileged. If the reader of this message = is not the intended recipient, you are hereby notified that any disseminati= on, distribution or copying of this communication is strictly prohibited. I= f you have received this communication in error, please immediately notify the sender and destroy the original me= ssage.

=A0



This e-mail and the informat= ion, including any attachments, it contains are intended to be a confidenti= al communication only to the person or entity to whom it is addressed and m= ay contain information that is privileged. If the reader of this message is not the intended recipient, you are hereb= y notified that any dissemination, distribution or copying of this communic= ation is strictly prohibited. If you have received this communication in er= ror, please immediately notify the sender and destroy the original message.

Thank you.

Please consider the environment before printing this email.

--047d7bea3ccaba113404e1c37442--