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

ResolveUnion in 1.6.3 thinks a HashMap is a Record.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 1.6.3
    • None
    • java
    • None
    • Windows, eclipse

    Description

      Getting an exception thrown on line 542 of ReflectData.java. Put a breakpoint there and found the following:

      1. Datum is a HashMap with 119 entries.
      2. If I select "getSchemaName(datum)" (line 539) and say inspect, it returns "java.util.HashMap"
      3. The "indexByName" also being accessed on line 539 =

      {map=1, null=0}

      4. In "getSchemaName" if I select "isMap(datum)" and say inspect, it returns "true" (this would then return "map" which DOES exist in the indexByName structure
      5. However, still in "getSchemaName" if I select "isRecord(datum)" and say inspect, I also get back "true". This then returns "getRecordSchema(datum).getFullName(), which is where the java.util.HashMap from item #2 comes from. Since this is not in the "indexByName" map, I get an UnresolvedUntionException.

      Either "isRecord" needs to be fixed to not return true for Maps, or the test for "isMap" at line 556 needs to moved up ahead of the test for "isRecord".

      This works fine under 1.5.4, but breaks under 1.6.3. I have a JUnit test that reproduces this, if I can figure out how to attach it , I will.

      Attachments

        1. IntegerMap.java
          0.4 kB
          Joe Gamache
        2. ReflectDataTest.java
          1 kB
          Joe Gamache

        Activity

          People

            Unassigned Unassigned
            zookeeperatcabot Joe Gamache
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: