stringnullapache-nifi

nifi 1.23.2 string type value is not allowed to be defaulted to null


nifi was upgraded to 1.23.2 and we found a potential incompatibility issue: We have some messages serialized based on this schema: {"name":"myKey","type":"string","default":null} so null is allowed as default value of string type key before.

After nifi upgrade, with nifi 1.23.2 when using split record to deserialize, we've got an error: avroTypeException: invalid default for field myKey, null is not string

Is it due to more strict type check by higher version of nifi? Other than changing all source data from null to "" or "null" is there a quick fix to work around?

Thanks.


Solution

  • You declare the type of your field as "string". This type does not include the null pointer value. In case you want to allow null as well, you have to declare a union type of both "string" and "null" like this:

    {
       "name":"myKey",
       "type":[
          "string",
          "null"
       ],
       "default": null
    }