org.apache.avro.hadoop.io
Class AvroSerialization<T>

java.lang.Object
  extended by org.apache.hadoop.conf.Configured
      extended by org.apache.avro.hadoop.io.AvroSerialization<T>
Type Parameters:
T - The Java type of the Avro data to serialize.
All Implemented Interfaces:
org.apache.hadoop.conf.Configurable, org.apache.hadoop.io.serializer.Serialization<AvroWrapper<T>>

public class AvroSerialization<T>
extends org.apache.hadoop.conf.Configured
implements org.apache.hadoop.io.serializer.Serialization<AvroWrapper<T>>

The Serialization used by jobs configured with AvroJob.


Constructor Summary
AvroSerialization()
           
 
Method Summary
 boolean accept(Class<?> c)
          
static void addToConfiguration(org.apache.hadoop.conf.Configuration conf)
          Adds the AvroSerialization scheme to the configuration, so SerializationFactory instances constructed from the given configuration will be aware of it.
 org.apache.hadoop.io.serializer.Deserializer<AvroWrapper<T>> getDeserializer(Class<AvroWrapper<T>> c)
          Gets an object capable of deserializing the output from a Mapper.
static org.apache.avro.Schema getKeyReaderSchema(org.apache.hadoop.conf.Configuration conf)
          Gets the reader schema of the AvroKey datum that is being serialized/deserialized.
static org.apache.avro.Schema getKeyWriterSchema(org.apache.hadoop.conf.Configuration conf)
          Gets the writer schema of the AvroKey datum that is being serialized/deserialized.
 org.apache.hadoop.io.serializer.Serializer<AvroWrapper<T>> getSerializer(Class<AvroWrapper<T>> c)
          Gets an object capable of serializing output from a Mapper.
static org.apache.avro.Schema getValueReaderSchema(org.apache.hadoop.conf.Configuration conf)
          Gets the reader schema of the AvroValue datum that is being serialized/deserialized.
static org.apache.avro.Schema getValueWriterSchema(org.apache.hadoop.conf.Configuration conf)
          Gets the writer schema of the AvroValue datum that is being serialized/deserialized.
static void setKeyReaderSchema(org.apache.hadoop.conf.Configuration conf, org.apache.avro.Schema schema)
          Sets the reader schema of the AvroKey datum that is being serialized/deserialized.
static void setKeyWriterSchema(org.apache.hadoop.conf.Configuration conf, org.apache.avro.Schema schema)
          Sets the writer schema of the AvroKey datum that is being serialized/deserialized.
static void setValueReaderSchema(org.apache.hadoop.conf.Configuration conf, org.apache.avro.Schema schema)
          Sets the reader schema of the AvroValue datum that is being serialized/deserialized.
static void setValueWriterSchema(org.apache.hadoop.conf.Configuration conf, org.apache.avro.Schema schema)
          Sets the writer schema of the AvroValue datum that is being serialized/deserialized.
 
Methods inherited from class org.apache.hadoop.conf.Configured
getConf, setConf
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AvroSerialization

public AvroSerialization()
Method Detail

accept

public boolean accept(Class<?> c)

Specified by:
accept in interface org.apache.hadoop.io.serializer.Serialization<AvroWrapper<T>>

getDeserializer

public org.apache.hadoop.io.serializer.Deserializer<AvroWrapper<T>> getDeserializer(Class<AvroWrapper<T>> c)
Gets an object capable of deserializing the output from a Mapper.

Specified by:
getDeserializer in interface org.apache.hadoop.io.serializer.Serialization<AvroWrapper<T>>
Parameters:
c - The class to get a deserializer for.
Returns:
A deserializer for objects of class c.

getSerializer

public org.apache.hadoop.io.serializer.Serializer<AvroWrapper<T>> getSerializer(Class<AvroWrapper<T>> c)
Gets an object capable of serializing output from a Mapper.

Specified by:
getSerializer in interface org.apache.hadoop.io.serializer.Serialization<AvroWrapper<T>>
Parameters:
c - The class to get a serializer for.
Returns:
A serializer for objects of class c.

addToConfiguration

public static void addToConfiguration(org.apache.hadoop.conf.Configuration conf)
Adds the AvroSerialization scheme to the configuration, so SerializationFactory instances constructed from the given configuration will be aware of it.

Parameters:
conf - The configuration to add AvroSerialization to.

setKeyWriterSchema

public static void setKeyWriterSchema(org.apache.hadoop.conf.Configuration conf,
                                      org.apache.avro.Schema schema)
Sets the writer schema of the AvroKey datum that is being serialized/deserialized.

Parameters:
conf - The configuration.
schema - The Avro key schema.

setKeyReaderSchema

public static void setKeyReaderSchema(org.apache.hadoop.conf.Configuration conf,
                                      org.apache.avro.Schema schema)
Sets the reader schema of the AvroKey datum that is being serialized/deserialized.

Parameters:
conf - The configuration.
schema - The Avro key schema.

setValueWriterSchema

public static void setValueWriterSchema(org.apache.hadoop.conf.Configuration conf,
                                        org.apache.avro.Schema schema)
Sets the writer schema of the AvroValue datum that is being serialized/deserialized.

Parameters:
conf - The configuration.
schema - The Avro value schema.

setValueReaderSchema

public static void setValueReaderSchema(org.apache.hadoop.conf.Configuration conf,
                                        org.apache.avro.Schema schema)
Sets the reader schema of the AvroValue datum that is being serialized/deserialized.

Parameters:
conf - The configuration.
schema - The Avro value schema.

getKeyWriterSchema

public static org.apache.avro.Schema getKeyWriterSchema(org.apache.hadoop.conf.Configuration conf)
Gets the writer schema of the AvroKey datum that is being serialized/deserialized.

Parameters:
conf - The configuration.
Returns:
The Avro key writer schema, or null if none was set.

getKeyReaderSchema

public static org.apache.avro.Schema getKeyReaderSchema(org.apache.hadoop.conf.Configuration conf)
Gets the reader schema of the AvroKey datum that is being serialized/deserialized.

Parameters:
conf - The configuration.
Returns:
The Avro key reader schema, or null if none was set.

getValueWriterSchema

public static org.apache.avro.Schema getValueWriterSchema(org.apache.hadoop.conf.Configuration conf)
Gets the writer schema of the AvroValue datum that is being serialized/deserialized.

Parameters:
conf - The configuration.
Returns:
The Avro value writer schema, or null if none was set.

getValueReaderSchema

public static org.apache.avro.Schema getValueReaderSchema(org.apache.hadoop.conf.Configuration conf)
Gets the reader schema of the AvroValue datum that is being serialized/deserialized.

Parameters:
conf - The configuration.
Returns:
The Avro value reader schema, or null if none was set.


Copyright © 2009-2013 The Apache Software Foundation. All Rights Reserved.