kafka-rest icon indicating copy to clipboard operation
kafka-rest copied to clipboard

WIP - Decimal support

Open simplesteph opened this issue 8 years ago • 2 comments
trafficstars

A big feature that was missing from the Rest proxy is the ability to send decimal fields. As it stands it requires the user to figure out a string to send, which is super risky and quite a complicated process.

Instead, my wish is for the rest proxy to take {"foo": 123.45 } as an input, and do the conversion to avro correctly on its own. On read of decimal fields, it should do the opposite operation and return {"foo": 123.45 }

I have added test cases that demonstrate all of this.

I look forward to feedback. The one thing I'm not happy with is the use of "ISO-8859-1". If you see a simpler solution please do let me know.

The accuracy of this has been tested on a wide range of decimal numbers, and the deserialisation code from byte to BigDecimal has been directly sourced from the master version of avro at: https://github.com/apache/avro/blob/33d495840c896b693b7f37b5ec786ac1acacd3b4/lang/java/avro/src/main/java/org/apache/avro/Conversions.java#L79

Needless to say, an update to the avro library would greatly simplify this PR

simplesteph avatar Apr 27 '17 02:04 simplesteph

Can one of the admins verify this patch?

ConfluentJenkins avatar Apr 27 '17 02:04 ConfluentJenkins

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

cla-assistant[bot] avatar Sep 12 '24 17:09 cla-assistant[bot]