Support arbitrary-precision numbers
Support for Postgres arbitrary-precision numeric datatypes is currently broken in Bottled Water. Need to work out how to map it to Avro:
- One option is to use the Avro "decimal" logical type, which uses a byte array as the underlying storage, and I believe it maps to a java.math.BigInteger in the Java implementation of Avro.
- Or it could simply be an ascii string containing the decimal digits. (That would take 2.4 times as much space.)
My vote is for the first option, because it provides for an exact mapping from Postgres NUMERIC(precision, scale) type in it's most general form.
On a second thought it's not all that easy to convert numeric internal representation into 2's complement bytea, since there appears to be no core function that would do that.
Do you think it would be OK to just re-use the logicalType: "decimal" spec with type: "string"?
(replying to myself)
Actually, I've later found out that Avro spec defines logicalType: "decimal", type: "fixed", but doesn't seem to be supported by current C lib implementation.
As of PR #114 (just merged) we now represent NUMERIC as a double. That's not ideal, as it could lose precision, therefore leaving this issue open; but it's better than just sending zero like we used to :)