jonvines jonvines - 2 months ago 20
C# Question

Kafka Connect to MSSQL Server Decimal conversion

We're using the Confluent JDBC connector to extract data from a MS SQL database. We're experiencing problems with the extraction of a decimal column with a column data format of

decimal(10,2)
which is passing data as bytes rather than decimal.
"charge":{"bytes":"\u0006IĆ“"}
(this is taken from the console from a consumer and shows the schema registry structure).

Has anybody seen this behavior with the Connectors before and know how we'd go about resolving?

Cheers

Answer Source

There is currently limited support for use of Schema Registry with .Net. Therefore, we had to manually manipulate the byte array to produce the decimal.

This involved padding and reversing the byte array, making an assumption on precision and scale, and determining whether positive or negative based on the first value ( > 128 == negative). We also had to append a .01 for every negative decimal.