flavray / avro-rs

Avro client library implementation in Rust
MIT License
169 stars 95 forks source link

Increasing Decimal Logical Types Support #187

Open AlexRiedler opened 3 years ago

AlexRiedler commented 3 years ago

I work a fair bit with logical types, and noticed we could probably increase support a fair bit by adding precision and scale to our decoded logical types (or even better potentially add support for bigdecimal crate).

I tried to implement this, was going to give it a PR but ran into an issue that would require significant refactoring of the code, and the public interface 😢 . In particular, the BigInt provided in Decimal type currently could be more than the number of bytes supported by the Fixed field and its unclear how to return an error in this case when encoding.

Suggestions on how to move forward on this? or should we just panic like we currently do?

https://github.com/AlexRiedler/avro-rs/commit/0ac5e1f1ab08de35b994f2fbbd3221e6b117b9e9 is my current change-set if you are interested