You need to set the __isset on the Mutation object as well.
On Thu, Mar 17, 2011 at 10:13 AM, Anurag Gujral <[email protected]>wrote:
> Hi All,
> I am using function batch_mutate of cassandra 0.7 and I am
> getting the error InvalidRequestException: Mutation must have one
> ColumnOrSuperColumn or one Deletion. I have my own C++ cassandra client
> using thrift 0.0.5 api.
>
> Any Suggestions.
>
> Sample Code
> map<string, vector<Mutation> > cfmap;
>
> vector<Mutation> mutations;
>
> Column temp_col;
> temp_col.name.assign("abcd");
> temp_col.value.assign("efgh");
> temp_col.timestamp = timestamp;
> temp_col.ttl = 0; // TODO: TTL
> ColumnOrSuperColumn cosc;
> cosc.column = temp_col;
> cosc.__isset.column = true; // must set which data type, col or
> super
>
> Mutation mutation ;
> mutation.column_or_supercolumn=cosc;
> mutations.push_back(mutation);
>
> cfmap.insert(make_pair(colspace, mutations));
> map<string, map<string, vector<Mutation> > > mutationMap;
> mutationMap.insert(make_pair("firstRow",cfmap))
>
> conn->client->batch_mutate(
> mutationMap,
> (org::apache::cassandra::ConsistencyLevel::type)cons);
>
>
> Thanks
> Anurag
>
--
Tyler Hobbs
Software Engineer, DataStax <http://datastax.com/>
Maintainer of the pycassa <http://github.com/pycassa/pycassa> Cassandra
Python client library