T
- The type of Avro wrapper.D
- The Java type of the Avro data being wrapped.public abstract class AvroDeserializer<T extends AvroWrapper<D>,D> extends Object implements Deserializer<T>
Keys and values containing Avro types are more efficiently serialized outside
of the WritableSerialization model, so they are wrapper in
AvroWrapper
objects and deserialization is
handled by this class.
MapReduce jobs that use AvroWrapper objects as keys or values need to be
configured with AvroSerialization
. Use
AvroJob
to help with Job configuration.
Modifier | Constructor and Description |
---|---|
protected |
AvroDeserializer(Schema writerSchema,
Schema readerSchema,
ClassLoader classLoader)
Constructor.
|
protected |
AvroDeserializer(Schema writerSchema,
Schema readerSchema,
DatumReader<D> datumReader)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
close() |
protected abstract T |
createAvroWrapper()
Creates a new empty
T (extends AvroWrapper) instance. |
T |
deserialize(T avroWrapperToReuse) |
Schema |
getReaderSchema()
Gets the reader schema used for deserializing.
|
Schema |
getWriterSchema()
Gets the writer schema used for deserializing.
|
void |
open(InputStream inputStream) |
protected AvroDeserializer(Schema writerSchema, Schema readerSchema, ClassLoader classLoader)
writerSchema
- The Avro writer schema for the data to deserialize.readerSchema
- The Avro reader schema for the data to deserialize (may
be null).protected AvroDeserializer(Schema writerSchema, Schema readerSchema, DatumReader<D> datumReader)
writerSchema
- The Avro writer schema for the data to deserialize.readerSchema
- The Avro reader schema for the data to deserialize (may
be null).datumReader
- The Avro datum reader to use for deserialization.public Schema getWriterSchema()
public Schema getReaderSchema()
public void open(InputStream inputStream) throws IOException
open
in interface Deserializer<T extends AvroWrapper<D>>
IOException
public T deserialize(T avroWrapperToReuse) throws IOException
deserialize
in interface Deserializer<T extends AvroWrapper<D>>
IOException
public void close() throws IOException
close
in interface Deserializer<T extends AvroWrapper<D>>
IOException
protected abstract T createAvroWrapper()
T
(extends AvroWrapper) instance.T
instance.Copyright © 2009–2022 The Apache Software Foundation. All rights reserved.