Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

NIFI: COnvertRecord not conveting avro to JSON

Highlighted

NIFI: COnvertRecord not conveting avro to JSON

New Contributor

I have an Avro which uses another record type and fixed type Avro as fields types. I have all of them in the schema registry:


[
 {
  "type": "fixed",
  "name": "uuid",
  "size": 16
 },
 {
  "type": "record",
  "name": "ParamValue",
  "fields": [
   {
    "name": "values",
    "type": {
     "type": "map",
     "values": [
      "null",
      "boolean",
      "int",
      "long",
      "float",
      "double",
      "bytes",
      "string",
      "uuid",
      {
       "type": "array",
       "items": [
        "boolean",
        "int",
        "long",
        "float",
        "double",
        "bytes",
        "string",
        "uuid",
        "ParamValue"
       ]
      },
      "ParamValue"
     ]
    }
   }
  ]
 },
 {
  "type": "record",
  "name": "Action",
  "fields": [
    {
    "name": "modifiedBy",
    "type": [
     "null",
     "uuid"
    ],
    "default": null
   },
    {
    "name": "parameterValues",
    "type": "ParamValue",
    "default": {
     "values": {}
    }
   }
  ]
 }
]


I am trying to convert the Serialized Action Instance Avro to JSON using NIFI convert record processor but getting below error

java.lang.IllegalArgumentException: Cannot set the default value for field [parameterValues] to [{values={}}] because that is not a valid value for Data Type [RECORD]
    at org.apache.nifi.serialization.record.RecordField.<init>(RecordField.java:65)
    at org.apache.nifi.avro.AvroTypeUtil.addFieldToList(AvroTypeUtil.java:630)
    at org.apache.nifi.avro.AvroTypeUtil.createSchema(AvroTypeUtil.java:474)
    at org.apache.nifi.avro.AvroTypeUtil.createSchema(AvroTypeUtil.java:444)
    at org.apache.nifi.avro.AvroTypeUtil.createSchema(AvroTypeUtil.java:435)
    at org.apache.nifi.avro.AvroReaderWithEmbeddedSchema.<init>(AvroReaderWithEmbeddedSchema.java:38)
    at org.apache.nifi.avro.AvroReader.createRecordReader(AvroReader.java:100)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Delega


For simple Avro's, the convert record processor is working but it is failing for this Avro conversion.