Hello cassandra community,

I'm having headache understanding the collections serialization as part of the 
org.apache.cassandra.triggers.ITrigger API.
let me explain.
let's suppose I'm creating a table with following column

stamps map<text,bigint>


and I'm writing a Java implementation of the Itrigger interface

my goal is to translate the cell value of that column into some Java 
Map<String,Long>



so, when a new row is inserted with for example the value

{"produced":123488492, "consumed": 987654321}




what I got in the trigger implemention for that row is a cell of type
org.apache.cassandra.db.marshal.MapType(org.apache.cassandra.db.marshal.UTF8Type,org.apache.cassandra.db.marshal.LongType)
(so far so good)
but a value of
java.nio.HeapByteBuffer[pos=0 lim=8 cap=8]=00000000075c48ec

So, to me, it looks very strange, as if I deserialize using the MapSerializer, 
I got 0 elements in the map (the first 4 bytes)
Then , it complains about the extra bytes being there.. and sends back an 
exception.
Strange thing is that the next 4 bytes are reflecting the 1st value of the map 
: 123488492

But where are the other values gone in the serialized buffer?

I'm wondering if someone has faced the same kind of issue or knows how to 
deserialize correctly a cassandra collection.
Thank you.

Note: I have tested on cassandra 3.11 and 4.0.1 , and same thing applies 
unfortunately.

Christophe

Reply via email to