Hi,

I have a problem when insert data of the map type into a cassandra table. I
tried all kinds of MapSerializer to serialize the Map data and did not
succeed.

My code is like this:
            Column column = new Column();
            column.name=columnSerializer.toByteBuffer(colname); // the
column name of the map type, it works with other kinds of data type
            column.value =
MapSerializer.getInstance(AsciiSerializer.instance,
DecimalSerializer.instance).serialize(someMapData);
            column.timestamp = new Date().getTime();

            Mutation mutation = new Mutation();
            mutation.column_or_supercolumn = new ColumnOrSuperColumn();
            mutation.column_or_supercolumn.column = column;
            mutationList.add(mutation);

The data was input into the cassandra DB however it cannot be retrieved by
CQL3 with the following error:
ERROR 14:32:48,192 Exception in thread Thread[Thrift:4,5,main]
java.lang.AssertionError
    at
org.apache.cassandra.cql3.statements.ColumnGroupMap.getCollection(ColumnGroupMap.java:88)
    at
org.apache.cassandra.cql3.statements.SelectStatement.getCollectionValue(SelectStatement.java:1185)
    at
org.apache.cassandra.cql3.statements.SelectStatement.handleGroup(SelectStatement.java:1169)
    at
org.apache.cassandra.cql3.statements.SelectStatement.processColumnFamily(SelectStatement.java:1076)
...

So the question is how to write map data into cassandra by thrift API.
Appreciated for any help.

Thanks,
Huiliang

Reply via email to