You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by ROGER PUIG GANZA <rp...@tid.es> on 2009/10/02 10:50:24 UTC

client code supercolumn insertion from cassandra 0.3.0 to 0.4.0

Hi, I'm having problems with the translation of the client code for Cassandra 0.3.0 to the 0.4.0
My code for inserting columns is working properly but the one for the supercolumns is not working.
Can anyone point me where the error is?

I'm skipping the exception handling code.

Code for Cassandra 0.3.0  is working properly, I can get the values with the client code using the get_superColumn method and throught Cassandra-cli using get <tablename>.<CFName>[<key>][<col>][<subcol>]

Map<String, List<superColumn_t>> sColMap = new HashMap<String,List<superColumn_t>>();;
Map<String,List<column_t>> colMap = new HashMap<String,List<column_t>>();;
List<superColumn_t> sCol = new ArrayList<superColumn_t>();;
List<column_t> columns= new ArrayList<column_t>();

columns.add(new column_t(subColKey, "".getBytes("UTF-8"), timestamp));

sCol.add(new superColumn_t(columnName, columns));

sColMap.put(superColumnName, sCol);

batch_mutation_super_t bms = new batch_mutation_super_t(keyspace, superColKey, sColMap);

client.batch_insert_superColumn(bms, false);


Code for Cassandra 0.4.0 . It's suppoded to be working but when I fetch a superColumn with using the superKey, it returns a NotFoundException and when using the Cassandra-cli, I get this
InvalidRequestException(why:column parameter is not optional for super CF <CFName>

List<Column> colums = new ArrayList<Column>();
Map<String,List<ColumnOrSuperColumn>> map = new HashMap<String, List<ColumnOrSuperColumn>>();
List<ColumnOrSuperColumn> subColumns = new ArrayList<ColumnOrSuperColumn>();

columns.add(new Column(key.getBytes("UTF-8"), "".getBytes("UTF-8"), timestamp));
subColumns.add(new ColumnOrSuperColumn(null, new SuperColumn(InfoPerUserColNames.CFDevel.getBytes("UTF-8"), columns)));

map.put(superColumnName, subColumns);
client.batch_insert(keyspace, superKey, map, ConsistencyLevel.ZERO);


thanks for your help.

Roger Puig


Re: client code supercolumn insertion from cassandra 0.3.0 to 0.4.0

Posted by Jonathan Ellis <jb...@gmail.com>.
On Fri, Oct 2, 2009 at 3:50 AM, ROGER PUIG GANZA <rp...@tid.es> wrote:
> Code for Cassandra 0.4.0 . It’s suppoded to be working but when I fetch a
> superColumn with using the superKey, it returns a NotFoundException and when
> using the Cassandra-cli, I get this
>
> InvalidRequestException(why:column parameter is not optional for super CF
> <CFName>

Eh, I didn't read closely enough and tried to reproduce the problem
with your java code below.  That seems to work fine.  So it would be
more useful to give the fetch code that doesn't. :P

(the cli has never supported supercolumns.  one reason we need to replace it.)

-Jonathan