Hi Lewis,

I think the problem here was having recursive reference to same schema (ie.
for defining Employee, we need Employee schema). After a closer look at how
it is handled in Avro [0], I feel that using a queue to tackle this
recursive-ness would help. Adding the same to GoraCompiler seems to solve
the same:
mvn test
.........
.........
[INFO]
------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] Apache Gora ....................................... SUCCESS [0.575s]
[INFO] Apache Gora :: Compiler ........................... SUCCESS [1.004s]
[INFO] Apache Gora :: Compiler-CLI ....................... SUCCESS [0.271s]
[INFO] Apache Gora :: Core ............................... SUCCESS [11.520s]
[INFO] Apache Gora :: Tutorial ........................... SUCCESS [0.509s]
[INFO] Apache Gora :: Sources-Dist ....................... SUCCESS [0.052s]
[INFO]
------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO]
------------------------------------------------------------------------

Attached the modified GoraCompiler.java.

[0]
https://github.com/apache/avro/blob/trunk/lang/java/compiler/src/main/java/org/apache/avro/compiler/specific/SpecificCompiler.java



On Sat, Aug 24, 2013 at 6:20 PM, Lewis John Mcgibbney <
[email protected]> wrote:

> Hi,
> There are some issues when attempting to use the new GoraCompiler within
> the GORA_94 codebase.
> I refer specifically to the employee.json schema [0], where we have the
> following field in particular
>
>       {"name": "boss", "type":["null","Employee","string"]},
>
> It seems that the new compiler is allergic to the definitions within this
> field. Specifically that a boss can have >=1 Employee's however it seems
> that this results in the following
>
> @CEE279Law3-Linux:~/Downloads/asf/GORA_94$ ./bin/gora goracompiler
> gora-core/src/examples/avro/employee.json .
> Exception in thread "main" java.lang.StackOverflowError
>     at java.util.Arrays.copyOfRange(Arrays.java:2695)
>     at java.lang.String.<init>(String.java:203)
>     at java.lang.StringBuilder.toString(StringBuilder.java:405)
>     at org.apache.avro.Schema$Name.<init>(Schema.java:436)
>     at org.apache.avro.Schema.createRecord(Schema.java:144)
>     at
>
> org.apache.gora.compiler.GoraCompiler.getRecordSchemaWithDirtySupport(GoraCompiler.java:170)
>     at
>
> org.apache.gora.compiler.GoraCompiler.getSchemaWithDirtySupport(GoraCompiler.java:128)
>
> If we remove the offending field... all is well.
>
> Any ideas here?
> If we can get this fixed, we can compile the schema and stabilize this
> branch.
> Thanks
> Lewis
>
> [0]
>
> http://svn.apache.org/repos/asf/gora/branches/GORA_94/gora-core/src/examples/avro/employee.json
>
>
>
> --
> *Lewis*
>

Reply via email to