Uploaded image for project: 'Apache NiFi'
  1. Apache NiFi
  2. NIFI-9629

Avro Writer Schema Default Value not correctly being set

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.15.0, 1.16.0, 1.15.1, 1.15.2, 1.15.3
    • 1.16.0
    • Core Framework
    • None
    • WSL Ubuntu, Java 11 Open JDK

    Description

      Using the Avro Record Set Writer to create fields that don't exist and set default values is currently causing issues. I haven't tested all the possible types, but below are the ones I have tested:

      • String with string default value - OK
      • String with null - Error
      • Byte with null - Error
      • Int with 0 Default value - OK
      • Long with 0 default value - Error

      Looking at the AvroTypeUtil class when the field is put with its default value the null, is actually an org.apache.avro.JsonProperties$Null instead of an actual null value. The long is actually a default of an int value. These both throw errors when being encoded to the Avro Format.

      The attached flow successfully reproduces the errors.

       

      I have tested the flow and it successfully works in v1.12.1, but not a build from the main branch.

       

      This issue leads on from NIFI-9594

      Attachments

        Issue Links

          Activity

            People

              markap14 Mark Payne
              06nenglish Nathan English
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 0.5h
                  0.5h