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

Java: ReflectData cannot resolve union with fixed

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.7.6
    • Fix Version/s: 1.7.7
    • Component/s: java
    • Labels:
      None
    • Hadoop Flags:
      Reviewed

      Description

      Writing records with the following schema fail when using the Reflect API:

      {
        "type" : "record",
        "name" : "simple_schema",
        "namespace" : "com.foo.bar",
        "fields" : [ {
          "name" : "foo",
          "type" : {
            "type" : "fixed",
            "name" : "bar",
            "size" : 2
          }
        }, {
          "name" : "baz",
          "type" : [ "null", "bar" ],
          "default" : null
        } ]
      }
      

      This was found by Harsh J Chouraria.

        Issue Links

          Activity

          Hide
          hudson Hudson added a comment -

          SUCCESS: Integrated in AvroJava #459 (See https://builds.apache.org/job/AvroJava/459/)
          AVRO-1525. Java: ReflectData cannot resolve union with fixed. (tomwhite: rev 1602095)

          • /avro/trunk/CHANGES.txt
          • /avro/trunk/lang/java/avro/src/main/java/org/apache/avro/reflect/ReflectData.java
          • /avro/trunk/lang/java/avro/src/test/java/org/apache/avro/reflect/TestReflect.java
          Show
          hudson Hudson added a comment - SUCCESS: Integrated in AvroJava #459 (See https://builds.apache.org/job/AvroJava/459/ ) AVRO-1525 . Java: ReflectData cannot resolve union with fixed. (tomwhite: rev 1602095) /avro/trunk/CHANGES.txt /avro/trunk/lang/java/avro/src/main/java/org/apache/avro/reflect/ReflectData.java /avro/trunk/lang/java/avro/src/test/java/org/apache/avro/reflect/TestReflect.java
          Hide
          tomwhite Tom White added a comment -

          I just committed this. Thanks for the reviews.

          Show
          tomwhite Tom White added a comment - I just committed this. Thanks for the reviews.
          Hide
          jira-bot ASF subversion and git services added a comment -

          Commit 1602095 from tomwhite@apache.org in branch 'avro/trunk'
          [ https://svn.apache.org/r1602095 ]

          AVRO-1525. Java: ReflectData cannot resolve union with fixed.

          Show
          jira-bot ASF subversion and git services added a comment - Commit 1602095 from tomwhite@apache.org in branch 'avro/trunk' [ https://svn.apache.org/r1602095 ] AVRO-1525 . Java: ReflectData cannot resolve union with fixed.
          Hide
          cutting Doug Cutting added a comment -

          +1

          Show
          cutting Doug Cutting added a comment - +1
          Hide
          qwertymaniac Harsh J added a comment -

          The fix of pre-checking the instance type and the added tests look good to me.

          Show
          qwertymaniac Harsh J added a comment - The fix of pre-checking the instance type and the added tests look good to me.
          Hide
          qwertymaniac Harsh J added a comment -

          Thanks Tom!

          Find creds. to John actually: http://search-hadoop.com/m/icC867tor

          Show
          qwertymaniac Harsh J added a comment - Thanks Tom! Find creds. to John actually: http://search-hadoop.com/m/icC867tor
          Hide
          tomwhite Tom White added a comment -

          Here's a patch that fixes the problem. The test fails without the fix.

          Show
          tomwhite Tom White added a comment - Here's a patch that fixes the problem. The test fails without the fix.

            People

            • Assignee:
              tomwhite Tom White
              Reporter:
              tomwhite Tom White
            • Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development