T
- The Java type of the Avro data.public class AvroSerializer<T> extends Object implements org.apache.hadoop.io.serializer.Serializer<AvroWrapper<T>>
Keys and values containing Avro types are more efficiently serialized outside of the
WritableSerialization model, so they are wrapped in AvroWrapper
objects and serialization is handled by this
class.
MapReduce jobs that use AvroWrapper objects as keys or values need to be configured
with org.apache.avro.io.AvroSerialization
. Use AvroJob
to help with Job configuration.
Constructor and Description |
---|
AvroSerializer(Schema writerSchema)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
close() |
Schema |
getWriterSchema()
Gets the writer schema being used for serialization.
|
void |
open(OutputStream outputStream) |
void |
serialize(AvroWrapper<T> avroWrapper) |
public AvroSerializer(Schema writerSchema)
writerSchema
- The writer schema for the Avro data being serialized.public Schema getWriterSchema()
public void open(OutputStream outputStream) throws IOException
open
in interface org.apache.hadoop.io.serializer.Serializer<AvroWrapper<T>>
IOException
public void serialize(AvroWrapper<T> avroWrapper) throws IOException
serialize
in interface org.apache.hadoop.io.serializer.Serializer<AvroWrapper<T>>
IOException
public void close() throws IOException
close
in interface org.apache.hadoop.io.serializer.Serializer<AvroWrapper<T>>
IOException
Copyright © 2009-2013 The Apache Software Foundation. All Rights Reserved.