Sorry, List<String> is not supported, rather one must use
GenericArray<Utf8>. The reason is that both the specific and the
reflect implementations inherit from the generic implementation,
primarily just overriding the implementation of records. So the mapping
from Avro to Java (excepting records) is described at:
http://hadoop.apache.org/avro/docs/current/api/java/org/apache/avro/generic/package-summary.html
The GenericArray interface is mostly a subset of the List interface, but
includes one non-List method, peek(), in order to permit reuse of instances.
Doug
tazan007 wrote:
Still getting similar error with Utf8:
ptype = java.util.List<org.apache.avro.util.Utf8> raw = interface
java.util.List
param =class org.apache.avro.util.Utf8
Exception in thread "main" org.apache.avro.AvroTypeException: Unknown
type: java.util.List<org.apache.avro.util.Utf8>
at
org.apache.avro.reflect.ReflectData.createSchema(ReflectData.java:192)
at
org.apache.avro.reflect.ReflectData.createSchema(ReflectData.java:185)
at org.apache.avro.reflect.ReflectData.getMessage(ReflectData.java:230)
at org.apache.avro.reflect.ReflectData.getProtocol(ReflectData.java:206)
Are lists not support?
-Hiral
On Fri, Jul 31, 2009 at 4:56 PM, Doug Cutting <[email protected]
<mailto:[email protected]>> wrote:
Avro uses org.apache.avro.util.Utf8 to represent strings, not
java.lang.String.
Doug
tazan007 wrote:
Hi guys, I am getting this error when trying to build a schema
using an existing class with ReflectData.getSchema method with a
List<String> field. Is this expected behaviour? Are List's not
supported?
ptype = java.util.List<java.lang.String> raw = interface
java.util.List
param =class java.lang.String
Exception in thread "main" org.apache.avro.AvroTypeException:
Unknown type: java.util.List<java.lang.String>
at
org.apache.avro.reflect.ReflectData.createSchema(ReflectData.java:192)
at
org.apache.avro.reflect.ReflectData.createSchema(ReflectData.java:185)
at
org.apache.avro.reflect.ReflectData.getSchema(ReflectData.java:107)
Thanks,
Hiral