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

GoraCompiler cannot compile array type.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 0.2.1
    • schema
    • None

    Description

      test.json has:
      { "name": "arrayString", "type":

      { "type" : "array", "items" : "string" }

      },
      bin/gora compile test.json .
      Exception in thread "main" org.apache.avro.AvroRuntimeException: Not a map:

      {"type":"array","items":"string"}

      at org.apache.avro.Schema.getValueType(Schema.java:274)
      at org.apache.gora.compiler.GoraCompiler.compile(GoraCompiler.java:327)
      at org.apache.gora.compiler.GoraCompiler.compile(GoraCompiler.java:123)
      at org.apache.gora.compiler.GoraCompiler.compileSchema(GoraCompiler.java:63)
      at org.apache.gora.compiler.GoraCompiler.main(GoraCompiler.java:448)

      Here is the patch to fix this issue:

      diff --git gora-core/src/main/java/org/apache/gora/compiler/GoraCompiler.java gora-core/src/main/java/org/apache/gora/compiler/GoraCompiler.java
      index cf0ca83..ec1e53d 100644
      — gora-core/src/main/java/org/apache/gora/compiler/GoraCompiler.java
      +++ gora-core/src/main/java/org/apache/gora/compiler/GoraCompiler.java
      @@ -324,7 +324,7 @@ public class GoraCompiler {
      break;
      case ARRAY:
      unboxed = unbox(fieldSchema.getElementType());

      • fieldType = type(fieldSchema.getValueType());
        + fieldType = type(fieldSchema.getElementType());
        line(1, "public GenericArray<"fieldType"> get"camelKey"() {"); line(2, "return (GenericArray<"+fieldType+">) get("+i+");"); line(1, "}

        ");

      Attachments

        1. GORA-133.patch
          1 kB
          Kazuomi Kashii

        Issue Links

          Activity

            People

              Unassigned Unassigned
              kazk Kazuomi Kashii
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: