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

Nested schema reference with empty namespace cannot be parsed

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.7.7
    • java
    • None

    Description

      Related to AVRO-1295, a reference to a nested named schema with an empty namespace cannot be parsed. An example of such a schema is as follows:

      {
        "type" : "record",
        "name" : "Outer",
        "namespace" : "space",
        "fields" : [ {
          "name" : "f1",
          "type" : {
            "type" : "record",
            "name" : "Inner",
            "namespace" : "",
            "fields" : [ ]
          }
        }, {
          "name" : "f2",
          "type" : "Inner"
        } ]
      }
      

      Attempting to parse this results in the following exception:

      org.apache.avro.SchemaParseException: "Inner" is not a defined name. The type of the "f2" field must be a defined name or a {"type": ...} expression.

      The issue seems to be that the lookup for the name "Inner" is done with the namspace of the encoding record, and not with the empty namespace for this case.

      Attachments

        1. AVRO-1473.patch
          5 kB
          Gabriel Reid

        Activity

          People

            gabriel.reid Gabriel Reid
            gabriel.reid Gabriel Reid
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: