Package org.apache.trevni.avro.mapreduce
Class AvroTrevniKeyValueRecordWriter<K,V>
java.lang.Object
org.apache.hadoop.mapreduce.RecordWriter<AvroKey<K>,AvroValue<V>>
org.apache.trevni.avro.mapreduce.AvroTrevniRecordWriterBase<AvroKey<K>,AvroValue<V>,GenericRecord>
org.apache.trevni.avro.mapreduce.AvroTrevniKeyValueRecordWriter<K,V>
- Type Parameters:
K
- The type of key to write.V
- The type of value to write.
public class AvroTrevniKeyValueRecordWriter<K,V>
extends AvroTrevniRecordWriterBase<AvroKey<K>,AvroValue<V>,GenericRecord>
Writes key/value pairs to an Trevni container file.
Each entry in the Trevni 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.
-
Field Summary
Fields inherited from class org.apache.trevni.avro.mapreduce.AvroTrevniRecordWriterBase
EXT, meta, META_PREFIX, part, schema, writer
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected Schema
initSchema
(TaskAttemptContext context) Use the task context to construct a schema for writingvoid
Methods inherited from class org.apache.trevni.avro.mapreduce.AvroTrevniRecordWriterBase
close, flush
-
Constructor Details
-
AvroTrevniKeyValueRecordWriter
Constructor.- Parameters:
context
- The TaskAttempContext to supply the writer with information form the job configuration- Throws:
IOException
-
-
Method Details
-
write
- Specified by:
write
in classRecordWriter<AvroKey<K>,
AvroValue<V>> - Throws:
IOException
InterruptedException
-
initSchema
Use the task context to construct a schema for writing- Specified by:
initSchema
in classAvroTrevniRecordWriterBase<AvroKey<K>,
AvroValue<V>, GenericRecord>
-