Added few more information:
I need some help in reading CQL3 Collection type values while getting a
callback to the Custom Secondary Index (cassandra 2.1.0).
Column Family:
CREATE TABLE IF NOT EXISTS test1(
id text,
mymap map<text,text>,
PRIMARY KEY(id)
)
Added value:
Insert into test(id, mymap) values ('1', {'1':'value1'});
Then in my custom class I am trying to read mymap Cell.value() and
deserialize the ByteBuffervalue to get the full map content as below:
To get the row data based on a rowKey in callback:
DecoratedKey dkey = StorageService.getPartitioner().decorateKey(rowKey);
QueryFilter qf = QueryFilter.getIdentityFilter(dkey,
baseCfs.metadata.cfName,
Calendar.getInstance().getTimeInMillis());
ColumnFamily cf = baseCfs.getColumnFamily(qf);
for (Cell cell : cf)
{
if( cell name is "mymap" )
{
LOGGER.debug("for column mymap");
Map<String, String> mymap= MapType.getInstance(UTF8Type.instance,
UTF8Type.instance).compose(cell.value().duplicate());
for(String key: mymap.keySet())
{
LOGGER.debug("mymapkey [{}]: [{}]", key, mymap.get(key));
}
}
}
But I am not getting the values in the persisted in the Map. It says *"Not
enough bytes to read a map"*
Is there anyone who can help?
Regards,
Arindam Bose
On Wed, Aug 27, 2014 at 11:21 AM, Arindam Bose <[email protected]>
wrote:
> Hello,
>
> I need some help in reading CQL3 Collection type values while getting a
> callback to the Custom Secondary Index.
>
> Column Family:
>
> CREATE TABLE IF NOT EXISTS test1(
> id text,
> mymap map<text,text>,
> PRIMARY KEY(id)
> )
>
> Added value:
>
> Insert into test(id, mymap) values ('1', {'1':'value1'});
>
> Then in my custom class I am trying to read mymap Cell.value() and
> deserialize the ByteBuffervalue to get the full map content.
>
> But I am not getting the values as persisted in the mymap Column within
> Cassandra.
>
> Is there anyone who can help?
>
>
> Regards,
> Arindam Bose
>