Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
1.11.0
-
Important
Description
The attached schema has top-level AVRO Union type. Whenever the client tries to deserialize the message it fails at parsing field - opt_amount, with stack trace -
Caused by: java.lang.ClassCastException: class java.nio.HeapByteBuffer cannot be cast to class java.math.BigDecimal (java.nio.HeapByteBuffer and java.math.BigDecimal are in module java.base of loader 'bootstrap') at io.confluent.base.model.Test1.put(Test1.java:115) at org.apache.avro.generic.GenericData.setField(GenericData.java:837) at org.apache.avro.specific.SpecificDatumReader.readField(SpecificDatumReader.java:139) at org.apache.avro.generic.GenericDatumReader.readRecord(GenericDatumReader.java:248) at org.apache.avro.specific.SpecificDatumReader.readRecord(SpecificDatumReader.java:123) at org.apache.avro.generic.GenericDatumReader.readWithoutConversion(GenericDatumReader.java:180) at org.apache.avro.generic.GenericDatumReader.read(GenericDatumReader.java:161) at org.apache.avro.generic.GenericDatumReader.readWithoutConversion(GenericDatumReader.java:188) at org.apache.avro.generic.GenericDatumReader.read(GenericDatumReader.java:161) at org.apache.avro.generic.GenericDatumReader.read(GenericDatumReader.java:154) at io.confluent.kafka.serializers.AbstractKafkaAvroDeserializer$DeserializationContext.read(AbstractKafkaAvroDeserializer.java:400)
The sample message you can try is -
{ "io.confluent.base.model.Test1": { "opt_amount": { "bytes": "10.2" } } }