T
- The Java type of the Avro data to serialize.public class AvroSerialization<T> extends Configured implements Serialization<AvroWrapper<T>>
Serialization
used by jobs configured with
AvroJob
.Constructor and Description |
---|
AvroSerialization() |
Modifier and Type | Method and Description |
---|---|
boolean |
accept(Class<?> c) |
static void |
addToConfiguration(Configuration conf)
Adds the AvroSerialization scheme to the configuration, so SerializationFactory
instances constructed from the given configuration will be aware of it.
|
static GenericData |
createDataModel(Configuration conf)
Gets an instance of data model implementation, defaulting to
ReflectData if not explicitly specified. |
static Class<? extends GenericData> |
getDataModelClass(Configuration conf)
Gets the data model class for de/seralization.
|
Deserializer<AvroWrapper<T>> |
getDeserializer(Class<AvroWrapper<T>> c)
Gets an object capable of deserializing the output from a Mapper.
|
static Schema |
getKeyReaderSchema(Configuration conf)
Gets the reader schema of the AvroKey datum that is being serialized/deserialized.
|
static Schema |
getKeyWriterSchema(Configuration conf)
Gets the writer schema of the AvroKey datum that is being serialized/deserialized.
|
Serializer<AvroWrapper<T>> |
getSerializer(Class<AvroWrapper<T>> c)
Gets an object capable of serializing output from a Mapper.
|
static Schema |
getValueReaderSchema(Configuration conf)
Gets the reader schema of the AvroValue datum that is being serialized/deserialized.
|
static Schema |
getValueWriterSchema(Configuration conf)
Gets the writer schema of the AvroValue datum that is being serialized/deserialized.
|
static void |
setDataModelClass(Configuration conf,
Class<? extends GenericData> modelClass)
Sets the data model class for de/seralization.
|
static void |
setKeyReaderSchema(Configuration conf,
Schema schema)
Sets the reader schema of the AvroKey datum that is being serialized/deserialized.
|
static void |
setKeyWriterSchema(Configuration conf,
Schema schema)
Sets the writer schema of the AvroKey datum that is being serialized/deserialized.
|
static void |
setValueReaderSchema(Configuration conf,
Schema schema)
Sets the reader schema of the AvroValue datum that is being serialized/deserialized.
|
static void |
setValueWriterSchema(Configuration conf,
Schema schema)
Sets the writer schema of the AvroValue datum that is being serialized/deserialized.
|
getConf, setConf
public boolean accept(Class<?> c)
accept
in interface Serialization<AvroWrapper<T>>
public Deserializer<AvroWrapper<T>> getDeserializer(Class<AvroWrapper<T>> c)
getDeserializer
in interface Serialization<AvroWrapper<T>>
c
- The class to get a deserializer for.c
.public Serializer<AvroWrapper<T>> getSerializer(Class<AvroWrapper<T>> c)
getSerializer
in interface Serialization<AvroWrapper<T>>
c
- The class to get a serializer for.c
.public static void addToConfiguration(Configuration conf)
conf
- The configuration to add AvroSerialization to.public static void setKeyWriterSchema(Configuration conf, Schema schema)
conf
- The configuration.schema
- The Avro key schema.public static void setKeyReaderSchema(Configuration conf, Schema schema)
conf
- The configuration.schema
- The Avro key schema.public static void setValueWriterSchema(Configuration conf, Schema schema)
conf
- The configuration.schema
- The Avro value schema.public static void setValueReaderSchema(Configuration conf, Schema schema)
conf
- The configuration.schema
- The Avro value schema.public static void setDataModelClass(Configuration conf, Class<? extends GenericData> modelClass)
conf
- The configuration.modelClass
- The data model class.public static Schema getKeyWriterSchema(Configuration conf)
conf
- The configuration.public static Schema getKeyReaderSchema(Configuration conf)
conf
- The configuration.public static Schema getValueWriterSchema(Configuration conf)
conf
- The configuration.public static Schema getValueReaderSchema(Configuration conf)
conf
- The configuration.public static Class<? extends GenericData> getDataModelClass(Configuration conf)
conf
- The configuration.public static GenericData createDataModel(Configuration conf)
ReflectData
if not explicitly specified.conf
- The job configuration.Copyright © 2009–2016 The Apache Software Foundation. All rights reserved.