Details
-
Improvement
-
Status: Resolved
-
P3
-
Resolution: Fixed
-
2.1.0
Description
The AvroCoder currently supports GenericData and ReflectData, but not SpecificData.
It should relatively easy to incorporate it by expanding the logic while constructing the Reader and Writer by also checking if the type implements the SpecificRecord interface. It would greatly speed up (de-)serialization of Avro-generated java classes.
return myCoder.getType().equals(GenericRecord.class) ? new GenericDatumReader<T>(myCoder.getSchema()) : new ReflectDatumReader<T>( myCoder.getSchema(), myCoder.getSchema(), myCoder.reflectData.get());
should be
if (myCoder.getType().equals(GenericRecord.class)) { return new GenericDatumReader<T>(myCoder.getSchema()); } if (SpecificRecord.class.isAssignableFrom(myCoder.getType())) { return new SpecificDatumReader<T>(myCoder.getType()); } return new ReflectDatumReader<T>( myCoder.getSchema(), myCoder.getSchema(), myCoder.reflectData.get());
Attachments
Issue Links
- links to