Hey all,
I am using avro to deserialize a message with 8000 fields from kafka, we
use binary encoding scheme , so the schema is not sent with each poll. We
don't use any schema registry. My problem is I only want 20 fields from
this message. I tried to make my deserialization schema a subset of the
producer schema but it does not work. I get this error :
"org.apache.avro.AvroRuntimeException: Malformed data. Length is negative:
-27". How can I fix this? Should I read the entire message and then filter
what I require ? Thanks you so much for your help.

For instance if my producer schema is like this :

"fields" : [ {
  "name" : "CMLS_MRCH_CTRY_CD_NUM_DRVD",
  "type" : "int",
  "doc" : "decimal(3,0)",
  "default" : 0
},{
  "name" : "CMLS_ISSR_BIN_DRVD",
  "type" : "int",
  "doc" : "decimal(6,0)",
  "default" : 0
}, {
  "name" : "CMLS_DGTL_CMRC_PGM_IND",
  "type" : "int",
  "doc" : "decimal(1,0)",
  "default" : 0
}]

If I only want the first field from the message , my code breaks when I
change the deserialization schema to

"fields" : [ {
  "name" : "CMLS_MRCH_CTRY_CD_NUM_DRVD",
  "type" : "int",
  "doc" : "decimal(3,0)",
  "default" : 0
}]

Reply via email to