Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


Composite row key doesn't work for IntegerType component #244

jimooo opened this Issue · 2 comments

2 participants


I had a composite row key consisting of LongType:UTF8Type:IntegerType
In my AnnotatedCompositeSerializer class I had 3 components: long, String, and int

When iterating through the rows returned from my query, I kept getting an exception complaining that it could not set the "int" in my AnnotatedCompositeSerializer class to null.

I got the source and stepped through the code. The bytebuffer for the column name contains a short length for each component. Here is what mine had:

length: 8 followed by 8 bytes for my long
length: 2 followed by 2 bytes for my string
length: 1 followed by 1 byte for my integer

The problem is that the bytebuffer contained 8 bytes for my long, the correct number of bytes for my string, and only 1 byte for my integer. The value of that 1 byte was correct (it was a 2) but because it was only 1 byte long instead of 4, the code in

fromByteBuffer(ByteBuffer byteBuffer)

in AnnotatedCompositeSerializer returned null and caused the exception.


Which version of cassandra are you using? IntegerType in cassandra is actually a variable length BigInteger and not a 32 bit integer. Try changing your comparator to LongType:UTF8Type:Int32Type or change the 'int' to BigInteger.


Ok, that's probably my misunderstanding. I was expecting IntegerType to be 4 bytes. I'll switch to Int32Type and see if that works for me.

@elandau elandau closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.