cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kuldeep Mishra <kuld.cs.mis...@gmail.com>
Subject Re: error when creating column family using cql3 and persisting data using thrift
Date Thu, 17 Jan 2013 07:13:31 GMT
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 <aaron@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 <jschappet@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.mishra@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

Mime
View raw message