Uploaded image for project: 'Apache Gora'
  1. Apache Gora
  2. GORA-331

Gora 0.4 compiler crash with "enum" type

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 0.4, 0.5
    • 0.5
    • gora-compiler

    Description

      As part of my work on GORA-199 I've updated some Dictanova projects to 0.4 release (more precisly to 0.5-SNAPSHOT) for testing.

      Unfortunelly, I've detected that Gora Compiler crash if there is an "enum" type field inside a record.

      {
          "name": "RecordWithEnum",
          "namespace": "com.drazzib.com",
          "type": "record",
          "fields": [
              {
                  "name": "type",
                  "type": {
                      "name": "MyEnum",
                      "type": "enum",
                      "symbols": [
                          "PERIOD",
                          "INSTANT"
                      ]
                  }
              }
          ]
      }
      

      If you try to compile this schema with Gora 0.4, you'll get the following error :

      /bin/gora goracompiler record_with_enum.avsc test/
       
      Compiling: record_with_enum.avsc
      74 [main] ERROR AvroVelocityLogChute - ResourceManager : unable to find resource '/org/apache/gora/compiler/templates/enum.vm' in any resource loader.
      Exception in thread "main" java.lang.RuntimeException: org.apache.velocity.exception.ResourceNotFoundException: Unable to find resource '/org/apache/gora/compiler/templates/enum.vm'
              at org.apache.avro.compiler.specific.SpecificCompiler.renderTemplate(SpecificCompiler.java:329)
              at org.apache.avro.compiler.specific.SpecificCompiler.compile(SpecificCompiler.java:371)
              at org.apache.avro.compiler.specific.SpecificCompiler.compileToDestination(SpecificCompiler.java:316)
              at org.apache.gora.compiler.GoraCompiler.compileSchema(GoraCompiler.java:65)
              at org.apache.gora.compiler.cli.GoraCompilerCLI.main(GoraCompilerCLI.java:56)
      Caused by: org.apache.velocity.exception.ResourceNotFoundException: Unable to find resource '/org/apache/gora/compiler/templates/enum.vm'
              at org.apache.velocity.runtime.resource.ResourceManagerImpl.loadResource(ResourceManagerImpl.java:474)
              at org.apache.velocity.runtime.resource.ResourceManagerImpl.getResource(ResourceManagerImpl.java:352)
              at org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstance.java:1533)
              at org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstance.java:1514)
              at org.apache.velocity.app.VelocityEngine.getTemplate(VelocityEngine.java:373)
              at org.apache.avro.compiler.specific.SpecificCompiler.renderTemplate(SpecificCompiler.java:327)
              ... 4 more
      

      I've managed to workaround this problem by simply dropping avro enum.vm inside gora source.

      You can easily clone this gist https://gist.github.com/drazzib/35e504e6e689f96dae8f so that you can reproduce this issue.

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            drazzib Damien Raude-Morvan
            drazzib Damien Raude-Morvan
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment