|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.crunch.types.avro.AvroMode
public class AvroMode
AvroMode is an immutable object used for configuring the reading and writing of Avro types. The mode will not be used or honored unless it has been appropriately configured using one of the supported methods. Certain sources might also support specifying a specific mode to use.
Nested Class Summary | |
---|---|
static class |
AvroMode.ModeType
Internal enum which represents the various Avro data types. |
Field Summary | |
---|---|
static String |
AVRO_MODE_PROPERTY
|
static String |
AVRO_SHUFFLE_MODE_PROPERTY
|
static AvroMode |
GENERIC
Default mode to use for reading and writing Generic types. |
static AvroMode |
REFLECT
Default mode to use for reading and writing Reflect types. |
static AvroMode |
SPECIFIC
Default mode to use for reading and writing Specific types. |
Method Summary | ||
---|---|---|
void |
configure(org.apache.hadoop.conf.Configuration conf)
Populates the conf with mode specific settings. |
|
void |
configure(FormatBundle bundle)
Populates the bundle with mode specific settings for the specific FormatBundle . |
|
void |
configureFactory(org.apache.hadoop.conf.Configuration conf)
Deprecated. use configure(org.apache.hadoop.conf.Configuration) |
|
void |
configureShuffle(org.apache.hadoop.conf.Configuration conf)
Populates the conf with mode specific settings for use during the shuffle phase. |
|
boolean |
equals(Object o)
|
|
static AvroMode |
fromConfiguration(org.apache.hadoop.conf.Configuration conf)
Creates an AvroMode based on the AVRO_MODE_PROPERTY property in the conf . |
|
static AvroMode |
fromShuffleConfiguration(org.apache.hadoop.conf.Configuration conf)
Creates an AvroMode based on the AVRO_SHUFFLE_MODE_PROPERTY property in the conf . |
|
static AvroMode |
fromType(AvroType<?> type)
Creates an AvroMode based upon the specified type . |
|
org.apache.avro.generic.GenericData |
getData()
Returns a GenericData instance based on the mode type. |
|
ReaderWriterFactory |
getFactory()
Returns the factory that will be used for the mode. |
|
|
getReader(org.apache.avro.Schema schema)
Creates a DatumReader based on the schema . |
|
|
getWriter(org.apache.avro.Schema schema)
Creates a DatumWriter based on the schema . |
|
int |
hashCode()
|
|
AvroMode |
override(ReaderWriterFactory factory)
Deprecated. use withFactory(ReaderWriterFactory) instead. |
|
static void |
setSpecificClassLoader(ClassLoader loader)
|
|
AvroMode |
withFactory(ReaderWriterFactory factory)
Creates a new AvroMode instance which will utilize the factory instance
for creating Avro readers and writers. |
|
AvroMode |
withFactoryFromConfiguration(org.apache.hadoop.conf.Configuration conf)
|
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final AvroMode REFLECT
Reflect
types.
public static final AvroMode SPECIFIC
Specific
types.
public static final AvroMode GENERIC
Generic
types.
public static final String AVRO_MODE_PROPERTY
public static final String AVRO_SHUFFLE_MODE_PROPERTY
Method Detail |
---|
public static AvroMode fromConfiguration(org.apache.hadoop.conf.Configuration conf)
AVRO_MODE_PROPERTY
property in the conf
.
conf
- The configuration holding the properties for mode to be created.
AVRO_MODE_PROPERTY
property in the conf
.public static AvroMode fromShuffleConfiguration(org.apache.hadoop.conf.Configuration conf)
AVRO_SHUFFLE_MODE_PROPERTY
property in the conf
.
conf
- The configuration holding the properties for mode to be created.
AVRO_SHUFFLE_MODE_PROPERTY
property in the conf
.public static AvroMode fromType(AvroType<?> type)
AvroMode
based upon the specified type
.
type
- the Avro type which indicates a specific mode.
AvroMode
based upon the specified type
.public static void setSpecificClassLoader(ClassLoader loader)
public org.apache.avro.generic.GenericData getData()
GenericData
instance based on the mode type.
getData
in interface ReaderWriterFactory
GenericData
instance based on the mode type.public <T> org.apache.avro.io.DatumReader<T> getReader(org.apache.avro.Schema schema)
DatumReader
based on the schema
.
getReader
in interface ReaderWriterFactory
T
- the record type created by the reader.schema
- the schema to be read
DatumReader
based on the schema
.public <T> org.apache.avro.io.DatumWriter<T> getWriter(org.apache.avro.Schema schema)
DatumWriter
based on the schema
.
getWriter
in interface ReaderWriterFactory
T
- the record type created by the writer.schema
- the schema to be read
DatumWriter
based on the schema
.@Deprecated public AvroMode override(ReaderWriterFactory factory)
withFactory(ReaderWriterFactory)
instead.
AvroMode
instance which will utilize the factory
instance
for creating Avro readers and writers.
factory
- factory implementation for the mode to use
AvroMode
instance which will utilize the factory
instance
for creating Avro readers and writers.public AvroMode withFactory(ReaderWriterFactory factory)
AvroMode
instance which will utilize the factory
instance
for creating Avro readers and writers. If null
the default factory for the mode
will be used.
factory
- factory implementation for the mode to use
AvroMode
instance which will utilize the factory
instance
for creating Avro readers and writers.public void configureShuffle(org.apache.hadoop.conf.Configuration conf)
conf
with mode specific settings for use during the shuffle phase.
conf
- the configuration to populate.public void configure(FormatBundle bundle)
bundle
with mode specific settings for the specific FormatBundle
.
bundle
- the bundle to populate.public void configure(org.apache.hadoop.conf.Configuration conf)
conf
with mode specific settings.
conf
- the configuration to populate.@Deprecated public void configureFactory(org.apache.hadoop.conf.Configuration conf)
configure(org.apache.hadoop.conf.Configuration)
conf
with mode specific settings.
conf
- the configuration to populate.public ReaderWriterFactory getFactory()
public boolean equals(Object o)
equals
in class Object
public int hashCode()
hashCode
in class Object
public AvroMode withFactoryFromConfiguration(org.apache.hadoop.conf.Configuration conf)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |