incubator-cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ben Hood <0x6e6...@gmail.com>
Subject Re: CQL decimal encoding
Date Thu, 27 Feb 2014 00:01:02 GMT
On Wed, Feb 26, 2014 at 12:10 PM, Laing, Michael
<michael.laing@nytimes.com> wrote:
> go uses 'zig-zag' encoding, perhaps that is the difference?
>
>
> On Wed, Feb 26, 2014 at 6:52 AM, Peter Lin <woolfel@gmail.com> wrote:
>>
>>
>> You may need to bit shift if that is the case

Thanks for everybody's help, I've managed to solve the issue: the
unscaled part of the decimal needs to be encoded using two's
compliment. Neither the standard Go big.Rat type nor the more amenable
replacement inf.Dec use two's compliment encoding, which is what Java
BigDecimal and the other languages are doing.

Ironically, the code to do the two's compliment packing and unpacking
is available in the the asn1 module of the standard Go library.
Unfortunately the functions are not exported outside the package
scope, since they designed for internal use only. So open source to
the rescue.

Hopefully the gocql team can code review this soon and if that's good
to go, we'll have another CQL driver that can deal with decimals.

Mime
View raw message