Re: Unable to compile a namespace-less schema

2013-10-11 Thread Vitaly Gordon
Thanks Doug. That does seem to compile the schema, unfortunately however, I am still unable to read the record. Exception in thread "main" org.apache.avro.AvroTypeException: Found TUPLE_21, expecting union Have you managed to read the record? On Fri, Oct 11, 2013 at 2:43 PM, Doug Cutting wrote

Re: Unable to compile a namespace-less schema

2013-10-11 Thread Doug Cutting
Thanks for the complete example. I can get this to compile by removing the "package com.company" from Main.java. The Java specification says, "It is a compile time error to import a type from the unnamed package." So you'll only be able to use these classes from other classes in the unnamed pack

Re: Unable to compile a namespace-less schema

2013-10-11 Thread Vitaly Gordon
Thanks Sean. Unfortunately, I already have massive amounts of data that were written without a namespace (from Apache Pig's AvroStorage). Is there any way to read it using specific records in real code (i.e. one that has packages)? Vitaly On Fri, Oct 11, 2013 at 2:15 PM, Sean Busbey wrote: >

Re: Unable to compile a namespace-less schema

2013-10-11 Thread Sean Busbey
Hi Vitaly, In general, Java does not allow classes outside of the default package to import classes from within the default package. I think this means that this is expected behavior, given that Avro says non-namespaced schemas generate code in the default package. For your particular issue, thi

Re: Unable to compile a namespace-less schema

2013-10-10 Thread Doug Cutting
I encourage you to please provide a complete test, code that fails. If maven is involved, create a simple, Maven project that illustrates the problem. Thanks, Doug On Wed, Oct 9, 2013 at 11:21 PM, Vitaly Gordon wrote: > Hi Doug, > You are right, the code does compile with javac. Apparently it i

Re: Unable to compile a namespace-less schema

2013-10-09 Thread Vitaly Gordon
Hi Doug, You are right, the code does compile with javac. Apparently it is some maven error, where it doesn't like to compile package-less files. Having said that, I still have the issue of not being able to use these java files in my code, because there is no way to import them. One thing I tried

Re: Unable to compile a namespace-less schema

2013-10-09 Thread Doug Cutting
Using the current trunk of Avro I am able to: - extract the schema from the data file you provided (using avro-tools schema command) - generate Java classes for this schema (using the avro-tools compile command) - compile these generated Java classes (using the javac command) Can you provide a

Re: Unable to compile a namespace-less schema

2013-10-09 Thread Vitaly Gordon
Does anyone else might have an idea how I can resolve this "namespace-less" Avro schema code generation? Thanks, Vitaly On Mon, Oct 7, 2013 at 2:04 PM, Vitaly Gordon wrote: > Hi Sean, > Here is a file that contains a single record that I cannot read using a > specific reader. > > It's hard for

Re: Unable to compile a namespace-less schema

2013-10-07 Thread Vitaly Gordon
Hi Sean, Here is a file that contains a single record that I cannot read using a specific reader. It's hard for me to add code because the problem is a compilation problem with the generated Java files. So to recreate the problem: 1. Extract the schema from the record 2. Generate the code from th

Re: Unable to compile a namespace-less schema

2013-10-07 Thread Sean Busbey
Hi Vitay! Can you give us a minimal schema and test program that illustrates the problem you're describing? -- Sean On Oct 7, 2013 12:27 PM, "Vitaly Gordon" wrote: > Hi All, > I am trying to read Avro data that its schema does not have a namespace. > The problem is that I cannot compile the cl

Unable to compile a namespace-less schema

2013-10-07 Thread Vitaly Gordon
Hi All, I am trying to read Avro data that its schema does not have a namespace. The problem is that I cannot compile the classes, because the generated Java code does not have a package. On the other hand, if I do add some arbitrary namespace to the schema, the record is resolved as a generic one,