kcat icon indicating copy to clipboard operation
kcat copied to clipboard

Decimal Support in avro format

Open maver1ck opened this issue 3 years ago • 4 comments

Is it possible to add Decimal support in Avro format to kafkacat ? Right now decimals are displayed as byte arrays.

maver1ck avatar Apr 08 '21 09:04 maver1ck

We rely on avro-c to generate JSON from Avro, maybe Avro-C 1.8.x doesn't support decimal?

edenhill avatar Apr 08 '21 10:04 edenhill

I did a bit of research on this (because I'd like decimal support too).

Avro-C doesn't support decimal because it doesn't support logical types. There's a PR open for it but it seems to be stuck in PR purgatory.

krisajenkins avatar Jun 24 '21 18:06 krisajenkins

Thanks @krisajenkins !

edenhill avatar Jul 06 '21 08:07 edenhill

I opened https://github.com/apache/avro/pull/2891 as an alternative to add decimal support to avro-c

with that said though, I think there's a small misunderstanding why kcat currently displays decimal objects as a series of bytes: it's not because avro-c lacks decimal support, it's because the json representation you're seeing is actually specified that way in the spec

so even after avro-c adds decimal support, we'll probably have to add some logic here in kcat to print decimals more readably...that should be relatively straightforward to do though

SahilKang avatar May 06 '24 07:05 SahilKang