> and thrift operation code :- You life will be a lot easier if you use one of the many find Java Cassandra clients such as https://github.com/Netflix/astyanax or https://github.com/hector-client/hector.
They know how to talk to C* Cheers ----------------- Aaron Morton Freelance Cassandra Developer New Zealand @aaronmorton http://www.thelastpickle.com On 17/01/2013, at 8:13 PM, Kuldeep Mishra <kuld.cs.mis...@gmail.com> wrote: > Hi Aaron, > I am using thrift client. > > Here is column family creation script:- > ``````````````````````````````````````````````````````````` > String colFamily = "CREATE COLUMNFAMILY users (key varchar PRIMARY > KEY,full_name varchar, birth_date int,state varchar)"; > conn.execute_cql3_query(ByteBuffer.wrap(colFamily.getBytes()), > Compression.NONE, ConsistencyLevel.ONE); > `````````````````````````````````````````````````````````````` > > and thrift operation code :- > > ``````````````````````````````````````````` > Cassandra.Client conn > > Map<ByteBuffer, Map<String, List<Mutation>>> mutationMap = new > HashMap<ByteBuffer, Map<String, List<Mutation>>>(); > > List<Mutation> insertion_list = new ArrayList<Mutation>(); > > Mutation mut = new Mutation(); > Column column = new Column(ByteBuffer.wrap("full_name".getBytes())); > column.setValue(ByteBuffer.wrap("emp".getBytes())); > mut.setColumn_or_supercolumn(new ColumnOrSuperColumn().setColumn(column)); > insertion_list.add(mut); > > Map<String, List<Mutation>> columnFamilyValues = new HashMap<String, > List<Mutation>>(); > columnFamilyValues.put("users", insertion_list); > > mutationMap.put(ByteBuffer.wrap("K".getBytes()), columnFamilyValues); > > conn.batch_mutate(mutationMap, ConsistencyLevel.ONE); > `````````````````````````````````````````````````````````````````````````````````````````````````````` > > and error stack trace :- > `````````````````````````````````` > InvalidRequestException(why:Not enough bytes to read value of component 0) > at > org.apache.cassandra.thrift.Cassandra$batch_mutate_result.read(Cassandra.java:20833) > at org.apache.thrift.TServiceClient.receiveBase(TServiceClient.java:78) > at > org.apache.cassandra.thrift.Cassandra$Client.recv_batch_mutate(Cassandra.java:964) > at > org.apache.cassandra.thrift.Cassandra$Client.batch_mutate(Cassandra.java:950) > ```````````````````````````````````````````````````````````````````````` > > > Thanks > Kuldeep Mishra > > On Thu, Jan 17, 2013 at 8:40 AM, aaron morton <aa...@thelastpickle.com> wrote: > The thrift request is not sending a composite type where it should. CQL 3 > uses composites in a lot of places. > > What was your table definition? > > Are you using a high level client or rolling your own? > > Cheers > > ----------------- > Aaron Morton > Freelance Cassandra Developer > New Zealand > > @aaronmorton > http://www.thelastpickle.com > > On 16/01/2013, at 5:32 AM, James Schappet <jschap...@gmail.com> wrote: > >> I also saw this while testing the >> https://github.com/boneill42/naughty-or-nice example project. >> >> >> >> >> --Jimmy >> >> >> From: Kuldeep Mishra <kuld.cs.mis...@gmail.com> >> Reply-To: <user@cassandra.apache.org> >> Date: Tuesday, January 15, 2013 10:29 AM >> To: <user@cassandra.apache.org> >> Subject: error when creating column family using cql3 and persisting data >> using thrift >> >> Hi, >> I am facing following problem, when creating column family using cql3 and >> trying to persist data using thrift 1.2.0 >> in cassandra-1.2.0. >> >> Details: >> InvalidRequestException(why:Not enough bytes to read value of component 0) >> at >> org.apache.cassandra.thrift.Cassandra$batch_mutate_result.read(Cassandra.java:20833) >> at org.apache.thrift.TServiceClient.receiveBase(TServiceClient.java:78) >> at >> org.apache.cassandra.thrift.Cassandra$Client.recv_batch_mutate(Cassandra.java:964) >> at >> org.apache.cassandra.thrift.Cassandra$Client.batch_mutate(Cassandra.java:950) >> at >> com.impetus.client.cassandra.thrift.ThriftClient.onPersist(ThriftClient.java:157) >> >> >> >> Please help me. >> >> >> -- >> Thanks and Regards >> Kuldeep Kumar Mishra >> +919540965199 > > > > > -- > Thanks and Regards > Kuldeep Kumar Mishra > +919540965199