Uploaded image for project: 'Avro'
  1. Avro
  2. AVRO-1954

Schema.Field.defaultVal() generates: Unknown datum type org.apache.avro.JsonProperties$Null

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.8.1, 1.9.0
    • Fix Version/s: 1.9.0
    • Component/s: java
    • Labels:
      None
    • Hadoop Flags:
      Reviewed

      Description

      I was creating GenericRecords and populating some fields – which i could not find the content on some json files – with the Schema.Field.defaultVal().

      It seems if the schema has explicitly set the default value to be null, the records generated this way can't be written. In this case, if default value is null in the schema, an instance of org.apache.avro.JsonProperties.NULL_VALUE is returned by Schema.Field.defaultVal().

      I created an unit test which replicates the bug. I was thinking modify the class org.apache.avro.generic.GenericData to evaluate org.apache.avro.JsonProperties.NULL_VALUE as null. Is this the way to go? or org.apache.avro.JsonProperties.NULL_VALUE is intend for other purposes?

        Attachments

          Activity

            People

            • Assignee:
              nkollar Nandor Kollar
              Reporter:
              iamwrong rui miranda
            • Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: