This compiles clean and I'm able to create data in the schema. However, if I try to serialize a record:
= new DataFileWriter<TransactionStatic>(new SpecificDatumWriter<TransactionStatic>(schema));
ByteArrayOutputStream staticOutputStream = new ByteArrayOutputStream(1024);
I get an Avro exception stating that TransactionStaticInstance is not defined:
Exception in thread "main" org.apache.avro.file.DataFileWriter$AppendWriteException: org.apache.avro.AvroRuntimeException: Unknown datum type: [Lcom.wily.apm.blackjack.TransactionStaticComponent;@3ffa1b16
How can I serialize a TransactionStatic? Also, where did the "L" come from in "Lcom.wily..."?
On Mon, Jan 21, 2013 at 6:14 AM, yimca <[hidden email]> wrote:
> How can I serialize a TransactionStatic? Also, where did the "L" come from
> in "Lcom.wily..."?
The L means it's a Java array, i.e., TransactionStatic. Avro's
specific representation uses List to represent arrays. (Look at the
generated code.) If you instead use a ReflectDatumWriter then you
should be able to write TransactionStatic too.
Thanks very much Doug and Rob for the quick and accurate replies. Doug's suggestion helped make sense of the error, and Rob's suggestion got me most of the way to resolving it. It turned out there was a second error in the definition of the first "components" field - instead of: