Package org.apache.trevni.avro.mapreduce

# Class AvroTrevniKeyValueRecordWriter<K,V>

java.lang.Object
org.apache.hadoop.mapreduce.RecordWriter<org.apache.avro.mapred.AvroKey<K>,org.apache.avro.mapred.AvroValue<V>>
org.apache.trevni.avro.mapreduce.AvroTrevniRecordWriterBase<org.apache.avro.mapred.AvroKey<K>,org.apache.avro.mapred.AvroValue<V>,org.apache.avro.generic.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<org.apache.avro.mapred.AvroKey<K>,org.apache.avro.mapred.AvroValue<V>,org.apache.avro.generic.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

Constructors
Constructor
Description
`AvroTrevniKeyValueRecordWriter(TaskAttemptContext context)`
Constructor.

## Method Summary

Modifier and Type
Method
Description
`protected org.apache.avro.Schema`
`initSchema(TaskAttemptContext context)`
Use the task context to construct a schema for writing
`void`
`write(org.apache.avro.mapred.AvroKey<K> key, org.apache.avro.mapred.AvroValue<V> value)`

### Methods inherited from class org.apache.trevni.avro.mapreduce.AvroTrevniRecordWriterBase

`close, flush`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### AvroTrevniKeyValueRecordWriter

public AvroTrevniKeyValueRecordWriter(TaskAttemptContext context) throws IOException
Constructor.

Parameters:
  `context` - The TaskAttempContext to supply the writer with information form the job configuration
Throws:
  `IOException`

## Method Details

### write

public void write(org.apache.avro.mapred.AvroKey<K> key, org.apache.avro.mapred.AvroValue<V> value) throws IOException, InterruptedException

Specified by:
  `write` in class `RecordWriter<org.apache.avro.mapred.AvroKey<K>,org.apache.avro.mapred.AvroValue<V>>`
Throws:
  `IOException`
  `InterruptedException`

### initSchema

protected org.apache.avro.Schema initSchema(TaskAttemptContext context)
Use the task context to construct a schema for writing

Specified by:
  `initSchema` in class `AvroTrevniRecordWriterBase<org.apache.avro.mapred.AvroKey<K>,org.apache.avro.mapred.AvroValue<V>,org.apache.avro.generic.GenericRecord>`