Avro
  1. Avro
  2. AVRO-1295

null namespace within non-null is not print/parse consistent

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.7.5
    • Component/s: java
    • Labels:
      None

      Description

      If a record with a null namespace is nested within a record with a non-null namespace then, when the outer schema is printed and re-parsed, the inner schema's namespace becomes the outer, rather than null as it should be.

      1. AVRO-1295-0.patch
        1 kB
        Nikita Makeev
      2. AVRO-1295.patch
        2 kB
        Doug Cutting

        Issue Links

          Activity

          Hide
          Sean Busbey added a comment -

          Since this jira has already been in a release, you should open a new jira and reference this one.

          Show
          Sean Busbey added a comment - Since this jira has already been in a release, you should open a new jira and reference this one.
          Hide
          Nikita Makeev added a comment -

          Hi.

          I've found that this issue still exists if we have nested records of depth three or more. For instance, if we have "A.space { B."" {C {} } }" it becomes "A.space { B."" { C.space {} }}"
          I ran into this when trying to use avro-mapred and org.apache.avro.mapred.Pair on avro file with nested records and no namespace.

          I've made my patch for this as well as patch for corresponding test.
          I'm not sure if I should open new JIRA or re-open this one, please advise.

          Show
          Nikita Makeev added a comment - Hi. I've found that this issue still exists if we have nested records of depth three or more. For instance, if we have "A.space { B."" {C {} } }" it becomes "A.space { B."" { C.space {} }}" I ran into this when trying to use avro-mapred and org.apache.avro.mapred.Pair on avro file with nested records and no namespace. I've made my patch for this as well as patch for corresponding test. I'm not sure if I should open new JIRA or re-open this one, please advise.
          Hide
          Hudson added a comment -

          Integrated in AvroJava #374 (See https://builds.apache.org/job/AvroJava/374/)
          AVRO-1331. Java: Fix schema-parsing incompatibility introduced in AVRO-1295. (Revision 1483463)

          Result = SUCCESS
          cutting :
          Files :

          • /avro/trunk/CHANGES.txt
          • /avro/trunk/lang/java/avro/src/main/java/org/apache/avro/Schema.java
          Show
          Hudson added a comment - Integrated in AvroJava #374 (See https://builds.apache.org/job/AvroJava/374/ ) AVRO-1331 . Java: Fix schema-parsing incompatibility introduced in AVRO-1295 . (Revision 1483463) Result = SUCCESS cutting : Files : /avro/trunk/CHANGES.txt /avro/trunk/lang/java/avro/src/main/java/org/apache/avro/Schema.java
          Hide
          Hudson added a comment -

          Integrated in AvroJava #362 (See https://builds.apache.org/job/AvroJava/362/)
          AVRO-1295. Java: Fix printing of a non-null namespace within a null namespace. (Revision 1468677)

          Result = SUCCESS
          cutting :
          Files :

          • /avro/trunk/CHANGES.txt
          • /avro/trunk/lang/java/avro/src/main/java/org/apache/avro/Schema.java
          • /avro/trunk/lang/java/ipc/src/test/java/org/apache/avro/TestSchema.java
          Show
          Hudson added a comment - Integrated in AvroJava #362 (See https://builds.apache.org/job/AvroJava/362/ ) AVRO-1295 . Java: Fix printing of a non-null namespace within a null namespace. (Revision 1468677) Result = SUCCESS cutting : Files : /avro/trunk/CHANGES.txt /avro/trunk/lang/java/avro/src/main/java/org/apache/avro/Schema.java /avro/trunk/lang/java/ipc/src/test/java/org/apache/avro/TestSchema.java
          Hide
          Doug Cutting added a comment -

          I committed this.

          Show
          Doug Cutting added a comment - I committed this.
          Hide
          Doug Cutting added a comment -

          I'll commit this soon unless there are objections.

          Show
          Doug Cutting added a comment - I'll commit this soon unless there are objections.
          Hide
          Doug Cutting added a comment -

          Here's a patch that fixes this and adds a test for it.

          The fix is to, when printing a schema with a null namespace nested inside a non-null namespace, explicitly specify the empty string as its namespace in order to override the inheritance of the enclosing namespace.

          Show
          Doug Cutting added a comment - Here's a patch that fixes this and adds a test for it. The fix is to, when printing a schema with a null namespace nested inside a non-null namespace, explicitly specify the empty string as its namespace in order to override the inheritance of the enclosing namespace.

            People

            • Assignee:
              Doug Cutting
              Reporter:
              Doug Cutting
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development