Is it possible to serialize schemaless object?

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Is it possible to serialize schemaless object?

tj5527
I am able to serialize and deserialize object into Avro that contains schema. However, when trying to test passing a plain java object in order to convert that object to bytes arrary. It throws Not a Specific class exception.

org.apache.avro.AvroRuntimeException: avro.shaded.com.google.common.util.concurrent.UncheckedExecutionException: org.apache.avro.AvroRuntimeException: Not a Specific class
   at org.apache.avro.specific.SpecificData.getSchema(SpecificData.java:227)
   at org.apache.avro.specific.SpecificDatumWriter.<init>(SpecificDatumWriter.java:35)

The code used to serialize object is based on http://grokbase.com/t/avro/user/142ke6ymcm/general-purpose-serialization-and-deserialization-for-avro-generated-specificrecords except the record is not an instance of SpecificRecord. 

Does that mean user can only serialize object with schema provided because it will need to obtain schema (SpecificData line 227)? Is there any alternative ways to serialize object without schema? 

Thanks