tazan007 wrote:
public class MyString
{
* public String string;*
That's https://issues.apache.org/jira/browse/AVRO-80. String is not
currently used to represent Avro strings, Utf8 is. Yes, that's not very
friendly, and the error message is horrible, but it is a lot faster than
java.lang.String. We should either make java.lang.String work too or at
least generate a better error message.
--- a/trunk/src/java/org/apache/avro/reflect/ReflectData.java
+++ b/trunk/src/java/org/apache/avro/reflect/ReflectData.java
@@ -123,6 +123,8 @@ public class ReflectData {
Map<String,Schema> names) {
if (type == Utf8.class)
return Schema.create(Type.STRING);
+ else if (type == String.class)
+ return Schema.create(Type.STRING);
else if (type == ByteBuffer.class)
return Schema.create(Type.BYTES);
else if ((type == Integer.class) || (type == Integer.TYPE))
That's sufficient to generate the schema, but don't think it will work
when you attempt to read or write the record. So fixing AVRO-80 will
take a bit more work than that.
Doug