org.apache.avro.mapreduce
Class AvroKeyValueRecordWriter<K,V>
java.lang.Object
org.apache.hadoop.mapreduce.RecordWriter<K,V>
org.apache.avro.mapreduce.AvroKeyValueRecordWriter<K,V>
- Type Parameters:
K - The type of key to write.V - The type of value to write.
public class AvroKeyValueRecordWriter<K,V>
- extends org.apache.hadoop.mapreduce.RecordWriter<K,V>
Writes key/value pairs to an Avro container file.
Each entry in the Avro container file will be a generic record with two fields,
named 'key' and 'value'. The input types may be basic Writable objects like Text or
IntWritable, or they may be AvroWrapper subclasses (AvroKey or AvroValue). Writable
objects will be converted to their corresponding Avro types when written to the generic
record key/value pair.
|
Method Summary |
void |
close(org.apache.hadoop.mapreduce.TaskAttemptContext context)
|
org.apache.avro.Schema |
getWriterSchema()
Gets the writer schema for the key/value pair generic record. |
void |
write(K key,
V value)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
AvroKeyValueRecordWriter
public AvroKeyValueRecordWriter(AvroDatumConverter<K,?> keyConverter,
AvroDatumConverter<V,?> valueConverter,
org.apache.avro.file.CodecFactory compressionCodec,
OutputStream outputStream)
throws IOException
- Throws:
IOException
getWriterSchema
public org.apache.avro.Schema getWriterSchema()
- Gets the writer schema for the key/value pair generic record.
- Returns:
- The writer schema used for entries of the Avro container file.
write
public void write(K key,
V value)
throws IOException
-
- Specified by:
write in class org.apache.hadoop.mapreduce.RecordWriter<K,V>
- Throws:
IOException
close
public void close(org.apache.hadoop.mapreduce.TaskAttemptContext context)
throws IOException
-
- Specified by:
close in class org.apache.hadoop.mapreduce.RecordWriter<K,V>
- Throws:
IOException
Copyright © 2009-2013 The Apache Software Foundation. All Rights Reserved.