[
https://issues.apache.org/jira/browse/GORA-133?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Lewis John McGibbney updated GORA-133:
--------------------------------------
Fix Version/s: (was: 0.3)
0.2.1
> GoraCompiler cannot compile array type.
> ---------------------------------------
>
> Key: GORA-133
> URL: https://issues.apache.org/jira/browse/GORA-133
> Project: Apache Gora
> Issue Type: Bug
> Components: schema
> Reporter: Kazuomi Kashii
> Fix For: 0.2.1
>
> Attachments: GORA-133.patch
>
>
> 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, "}");
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira