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

GenericDatumWriter broken with Enum

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Blocker
    • Resolution: Fixed
    • 1.8.0
    • 1.9.0
    • java
    • None

    Description

      Description

      Using the GenericDatumWriter with either Generic OR SpecificRecord will break if an Enum is present.

      Steps To Reproduce

      I have been tracking Avro decoding oddities for a while.
      The tests for this issue can be found here

      Notes

      Due to the debacle that is the Avro "UTF8" object, we have been avoiding it by using the following scheme:

      • Write incoming records to a byte array using the GenericDatumWriter
      • Read back the byte array to our compiled Java domain objects using a SpecificDatumWriter

      This worked great with Avro 1.7.7, and this is a binary-incompatable breaking change with 1.8.0.

      This would appear to be caused by an addition in the GenericDatumWriter:163-164:

        if (!data.isEnum(datum))
            throw new AvroTypeException("Not an enum: "+datum);
      

      Attachments

        Issue Links

          Activity

            People

              fokko Fokko Driesprong
              ryonday Ryon Day
              Votes:
              5 Vote for this issue
              Watchers:
              17 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: