Open
Description
An JDBC Source Connector publishes data to a kafka topic. In Kafka Streams, using GenericAvroSerde
, for all the numeric fields, the streams application is printing bytes and not the decimal.
Sample code to address this:
LogicalTypes.Decimal decimal = (LogicalTypes.Decimal) value.getSchema().getField("NUMBER_VALUE").schema().getLogicalType();
ByteBuffer number = (ByteBuffer) value.get("NUMBER_VALUE");
byte[] numberArray = Utils.toArray(number);
BigDecimal decimal_number = new BigDecimal(new BigInteger(numberArray), decimal.getScale());
reference: Slack convo