Github user markap14 commented on the issue:

    https://github.com/apache/nifi/pull/2480
  
    @gardellajuanpablo I think for this case we should avoid making any changes 
to RecordField or DataTypeUtils at all. This is an oddity of Avro specifically. 
I do think that it makes sense to honor the way that Avro deals with this case, 
but I think this should be done purely by addressing the issue in AvroTypeUtil. 
I think we can just update the AvroTypeUtil#createSchema(Schema, String, 
SchemaIdentifier) with something like this:
    ```
                    Object defaultValue = field.defaultVal();
                    if (fieldSchema.getType() == Schema.Type.ARRAY && 
!DataTypeUtils.isArrayTypeCompatible(defaultValue)) {
                        defaultValue = new Object[0];
                    }
                    recordFields.add(new RecordField(fieldName, dataType, 
defaultValue, field.aliases(), nullable));
    ```
    And I think that will address the issue without breaking anything else. 
Thoughts?


---

Reply via email to