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

Avro 1.9 applyAliases broken with self-referential records

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: 1.9.0
    • Fix Version/s: 1.9.0
    • Component/s: java
    • Labels:
      None
    • Flags:
      Patch, Important

      Description

      If a schema has a field with a self-referential record, the applyAliases function produces a NullPointerException.

      The problem appears to be that the value for the record put into "seen" has no fields, and then when the equality check is done, the `Schema.equals` method assumes that fields is not null. Making the `equals` method more defensive with null-checking "fields" solves the problem, as the `putAll` method adds the fields back in, but I'm not sure if that is actually the best fix.

      I will attach a patch with this fix.

      I'm marking this as a blocker for 1.9, as this behavior will cause a NullPointerException in this situation any time data is decoded where the writer and reader schema are different, and there are any aliases defined in the reader (even if these aliases are unrelated to the self-referential record).

        Attachments

        1. AVRO-2383.patch
          2 kB
          Raman Gupta

          Issue Links

            Activity

              People

              • Assignee:
                rocketraman Raman Gupta
                Reporter:
                rocketraman Raman Gupta
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: