According to the CQL datatypes documentation, the types int, bigint and varint refer to signed integers.
Helenus incorrectly interprets them as unsigned integers, at least from CQL.
The first commit contains tests to test number parsing in CQL3. This test fails on negative integers.
The second commit fixes the test.
add (failing) tests for negative integers in CQL3
Add the possibility to parse negative integers for the types int, big…
…int and varint to CQL3
Add decoding for varInts with odd sizes
Support for sizes other than 1, 2, 4 or 8 bytes.
Includes test with 3 byte variant.
This is great. What are the issues with CQL2 and Thrift?
This has no issues with CQL2, as they have the same integer datatypes as CQL3, so it fixes the same issue with CQL2.
I do not know what impact this does have on thrift, as i currently do not use it. helenus-thrift does include its own binary parser (which has even more trouble with large negative numbers as my solution, but does work fine for 32 bit negative numbers). I do not if the one in helenus-thrift is used, or if helenus parses the actual results back to numbers.
The same datatypes for CQL apply for the thrift protocol, as the same java classes are used by cassandra internally. So this might be a fix for thrift as well. All current tests still pass. If anyone wants to write a thrift test with negative numbers, we know for sure :)
This is published in version 0.6.0