Class AvroSerializer<T>

java.lang.Object
org.apache.avro.hadoop.io.AvroSerializer<T>
Type Parameters:
T - The Java type of the Avro data.
All Implemented Interfaces:
Serializer<AvroWrapper<T>>

public class AvroSerializer<T> extends Object implements Serializer<AvroWrapper<T>>
Serializes AvroWrapper objects within Hadoop.

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 AvroSerialization. Use AvroJob to help with Job configuration.

  • Constructor Details

    • AvroSerializer

      public AvroSerializer(Schema writerSchema)
      Constructor.
      Parameters:
      writerSchema - The writer schema for the Avro data being serialized.
    • AvroSerializer

      public AvroSerializer(Schema writerSchema, DatumWriter<T> datumWriter)
      Constructor.
      Parameters:
      writerSchema - The writer schema for the Avro data being serialized.
      datumWriter - The datum writer to use for serialization.
  • Method Details