Avro
  1. Avro
  2. AVRO-872

Allow interdependancies across IDL schema imports

    Details

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

      Description

      This currently doesn't work because Player depends on Position, but it should:

      $ cat position.avsc 
      {"type":"enum", "name": "Position", "namespace": "avro.examples.baseball",
          "symbols": ["P", "C", "B1", "B2", "B3", "SS", "LF", "CF", "RF", "DH"]
      }
      
      $ cat player.avsc 
      {"type":"record", "name":"Player", "namespace": "avro.examples.baseball",
        "fields": [
         {"name": "number", "type": "int"},
         {"name": "first_name", "type": "string"},
         {"name": "last_name", "type": "string"},
         {"name": "position", "type": {"type": "array", "items": "avro.examples.baseball.Position"} }
        ]
      }
      
      $ cat baseball.avdl 
      @namespace("avro.examples.baseball")
      protocol Baseball {
         import schema "position.avsc";
         import schema "player.avsc";
      }
      
      $ java -jar avro-tools-1.5.1.jar idl baseball.avdl baseball.avpr
      
      1. AVRO-872.patch
        8 kB
        Doug Cutting
      2. AVRO-872.patch
        8 kB
        Doug Cutting
      3. AVRO-872.patch
        8 kB
        Doug Cutting
      4. AVRO-872_4.patch
        8 kB
        Bill Graham
      5. AVRO-872.patch
        9 kB
        Doug Cutting
      6. AVRO_872_commit.patch
        9 kB
        Bill Graham

        Activity

        Bill Graham created issue -
        Bill Graham made changes -
        Field Original Value New Value
        Description This currently doesn't work because Player depends on Position, but it should:

        {noformat}
        $ cat position.avsc
        {"type":"enum", "name": "Position", "namespace": "avro.examples.baseball",
            "symbols": ["P", "C", "B1", "B2", "B3", "SS", "LF", "CF", "RF", "DH"]
        }

        $ cat player.avsc
        {"type":"record", "name":"Player", "namespace": "avro.examples.baseball",
          "fields": [
           {"name": "number", "type": "int"},
           {"name": "first_name", "type": "string"},
           {"name": "last_name", "type": "string"},
           {"name": "position", "type": {"type": "array", "items": "avro.examples.baseball.Position"} }
          ]
        }

        $ cat baseball.avdl
        @namespace("avro.examples.baseball")
        protocol Baseball {
           import schema "position.avsc";
           import schema "player.avsc";
        }

        $ java -jar avro-tools-1.5.1.jar idl baseball.avdl baseball.avpr
        This currently doesn't work because Player depends on Position, but it should:

        {noformat}
        $ cat position.avsc
        {"type":"enum", "name": "Position", "namespace": "avro.examples.baseball",
            "symbols": ["P", "C", "B1", "B2", "B3", "SS", "LF", "CF", "RF", "DH"]
        }

        $ cat player.avsc
        {"type":"record", "name":"Player", "namespace": "avro.examples.baseball",
          "fields": [
           {"name": "number", "type": "int"},
           {"name": "first_name", "type": "string"},
           {"name": "last_name", "type": "string"},
           {"name": "position", "type": {"type": "array", "items": "avro.examples.baseball.Position"} }
          ]
        }

        $ cat baseball.avdl
        @namespace("avro.examples.baseball")
        protocol Baseball {
           import schema "position.avsc";
           import schema "player.avsc";
        }

        $ java -jar avro-tools-1.5.1.jar idl baseball.avdl baseball.avpr
        {noformat}
        Doug Cutting made changes -
        Assignee Doug Cutting [ cutting ]
        Doug Cutting made changes -
        Attachment AVRO-872.patch [ 12489904 ]
        Doug Cutting made changes -
        Attachment AVRO-872.patch [ 12489911 ]
        Doug Cutting made changes -
        Attachment AVRO-872.patch [ 12490023 ]
        Bill Graham made changes -
        Attachment AVRO-872_4.patch [ 12490031 ]
        Doug Cutting made changes -
        Attachment AVRO-872.patch [ 12490180 ]
        Doug Cutting made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Hadoop Flags [Reviewed]
        Fix Version/s 1.6.0 [ 12316198 ]
        Resolution Fixed [ 1 ]
        Bill Graham made changes -
        Attachment AVRO_872_commit.patch [ 12490297 ]
        Doug Cutting made changes -
        Fix Version/s 1.5.3 [ 12317647 ]
        Fix Version/s 1.6.0 [ 12316198 ]
        Doug Cutting made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Doug Cutting made changes -
        Component/s java [ 12312780 ]

          People

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

            Dates

            • Created:
              Updated:
              Resolved:

              Development