Avro
  1. Avro
  2. AVRO-1337

Transform a single .avdl into many .avsc

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.7.4
    • Fix Version/s: 1.7.5
    • Component/s: None
    • Labels:
      None

      Description

      The syntax of avro IDL is attractive in order to build more readable and thus maintainable avro schemadata, even when not using protocols. However, there is currently no way of extracting the types of a schema (avdl) into multiple independent schemata (avsc). Here is a proposal.

      1. AVRO-1337-0.diff
        6 kB
        Bertrand Dechoux
      2. AVRO-1337-1.diff
        6 kB
        Bertrand Dechoux

        Activity

        Bertrand Dechoux created issue -
        Hide
        Bertrand Dechoux added a comment -

        Proposal.
        Limitations :

        • does not handle IO errors because there is no smart Exception strategy here (it fails if it fails)
        • assumes that the name of the type is unique (which might not be the case and that's why namespace exist but it should be a good practice inside a single protocol anyway)
        Show
        Bertrand Dechoux added a comment - Proposal. Limitations : does not handle IO errors because there is no smart Exception strategy here (it fails if it fails) assumes that the name of the type is unique (which might not be the case and that's why namespace exist but it should be a good practice inside a single protocol anyway)
        Bertrand Dechoux made changes -
        Field Original Value New Value
        Attachment AVRO-1337-0.diff [ 12584176 ]
        Bertrand Dechoux made changes -
        Status Open [ 1 ] Patch Available [ 10002 ]
        Bertrand Dechoux made changes -
        Affects Version/s 1.7.4 [ 12323742 ]
        Fix Version/s 1.7.5 [ 12324096 ]
        Hide
        Doug Cutting added a comment -

        Generally looks good to me.

        A few minor things:

        • the tool might be better named idl2schemata or avdl2avsc
        • we should update Main.java, adding this tool there
        • indentation should be consistently two spaces per level, with <80 column lines

        Thanks!

        Show
        Doug Cutting added a comment - Generally looks good to me. A few minor things: the tool might be better named idl2schemata or avdl2avsc we should update Main.java, adding this tool there indentation should be consistently two spaces per level, with <80 column lines Thanks!
        Doug Cutting made changes -
        Assignee Bertrand Dechoux [ bdechoux ]
        Hide
        Bertrand Dechoux added a comment -

        Thanks, I didn't see your answer.

        • I really didn't know how to name it. I wanted something simple to type/remember. I will use idl2schemata then.
        • I forgot to update Main.java. I will do it too.
        • I know about indentations and tried to respect the format rules. I will check again.

        Thanks for the feedback.

        Show
        Bertrand Dechoux added a comment - Thanks, I didn't see your answer. I really didn't know how to name it. I wanted something simple to type/remember. I will use idl2schemata then. I forgot to update Main.java. I will do it too. I know about indentations and tried to respect the format rules. I will check again. Thanks for the feedback.
        Bertrand Dechoux made changes -
        Status Patch Available [ 10002 ] In Progress [ 3 ]
        Hide
        Bertrand Dechoux added a comment -

        See attachment for updated patch.

        Show
        Bertrand Dechoux added a comment - See attachment for updated patch.
        Bertrand Dechoux made changes -
        Status In Progress [ 3 ] Patch Available [ 10002 ]
        Bertrand Dechoux made changes -
        Attachment AVRO-1337-1.diff [ 12587725 ]
        Hide
        ASF subversion and git services added a comment -

        Commit 1511449 from Doug Cutting in branch 'avro/trunk'
        [ https://svn.apache.org/r1511449 ]

        AVRO-1337. Java: Add a command line tool to generate schema files from a protocol. Contributed by Bertrand Dechoux.

        Show
        ASF subversion and git services added a comment - Commit 1511449 from Doug Cutting in branch 'avro/trunk' [ https://svn.apache.org/r1511449 ] AVRO-1337 . Java: Add a command line tool to generate schema files from a protocol. Contributed by Bertrand Dechoux.
        Hide
        Doug Cutting added a comment -

        I committed this. Thanks, Bertrand!

        Show
        Doug Cutting added a comment - I committed this. Thanks, Bertrand!
        Doug Cutting made changes -
        Status Patch Available [ 10002 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Hide
        Hudson added a comment -

        SUCCESS: Integrated in AvroJava #388 (See https://builds.apache.org/job/AvroJava/388/)
        AVRO-1337. Java: Add a command line tool to generate schema files from a protocol. Contributed by Bertrand Dechoux. (cutting: rev 1511449)

        • /avro/trunk/CHANGES.txt
        • /avro/trunk/lang/java/tools/src/main/java/org/apache/avro/tool/IdlToSchemataTool.java
        • /avro/trunk/lang/java/tools/src/main/java/org/apache/avro/tool/Main.java
        • /avro/trunk/lang/java/tools/src/test/idl
        • /avro/trunk/lang/java/tools/src/test/idl/protocol.avdl
        • /avro/trunk/lang/java/tools/src/test/java/org/apache/avro/tool/TestIdlToSchemataTool.java
        Show
        Hudson added a comment - SUCCESS: Integrated in AvroJava #388 (See https://builds.apache.org/job/AvroJava/388/ ) AVRO-1337 . Java: Add a command line tool to generate schema files from a protocol. Contributed by Bertrand Dechoux. (cutting: rev 1511449) /avro/trunk/CHANGES.txt /avro/trunk/lang/java/tools/src/main/java/org/apache/avro/tool/IdlToSchemataTool.java /avro/trunk/lang/java/tools/src/main/java/org/apache/avro/tool/Main.java /avro/trunk/lang/java/tools/src/test/idl /avro/trunk/lang/java/tools/src/test/idl/protocol.avdl /avro/trunk/lang/java/tools/src/test/java/org/apache/avro/tool/TestIdlToSchemataTool.java
        Doug Cutting made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open Patch Available Patch Available
        14h 27m 1 Bertrand Dechoux 22/May/13 13:00
        Patch Available Patch Available In Progress In Progress
        22d 10h 43m 1 Bertrand Dechoux 13/Jun/13 23:43
        In Progress In Progress Patch Available Patch Available
        44s 1 Bertrand Dechoux 13/Jun/13 23:44
        Patch Available Patch Available Resolved Resolved
        54d 20h 38m 1 Doug Cutting 07/Aug/13 20:23
        Resolved Resolved Closed Closed
        12d 22h 22m 1 Doug Cutting 20/Aug/13 18:46

          People

          • Assignee:
            Bertrand Dechoux
            Reporter:
            Bertrand Dechoux
          • Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development