org.apache.avro.mapreduce
Class AvroKeyRecordWriter<T>

java.lang.Object
  extended by org.apache.hadoop.mapreduce.RecordWriter<AvroKey<T>,org.apache.hadoop.io.NullWritable>
      extended by org.apache.avro.mapreduce.AvroKeyRecordWriter<T>
Type Parameters:
T - The Java type of the Avro data to write.

public class AvroKeyRecordWriter<T>
extends org.apache.hadoop.mapreduce.RecordWriter<AvroKey<T>,org.apache.hadoop.io.NullWritable>

Writes Avro records to an Avro container file output stream.


Constructor Summary
AvroKeyRecordWriter(org.apache.avro.Schema writerSchema, org.apache.avro.file.CodecFactory compressionCodec, OutputStream outputStream)
          Constructor.
 
Method Summary
 void close(org.apache.hadoop.mapreduce.TaskAttemptContext context)
          
 void write(AvroKey<T> record, org.apache.hadoop.io.NullWritable ignore)
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AvroKeyRecordWriter

public AvroKeyRecordWriter(org.apache.avro.Schema writerSchema,
                           org.apache.avro.file.CodecFactory compressionCodec,
                           OutputStream outputStream)
                    throws IOException
Constructor.

Parameters:
writerSchema - The writer schema for the records in the Avro container file.
compressionCodec - A compression codec factory for the Avro container file.
outputStream - The output stream to write the Avro container file to.
Throws:
IOException - If the record writer cannot be opened.
Method Detail

write

public void write(AvroKey<T> record,
                  org.apache.hadoop.io.NullWritable ignore)
           throws IOException

Specified by:
write in class org.apache.hadoop.mapreduce.RecordWriter<AvroKey<T>,org.apache.hadoop.io.NullWritable>
Throws:
IOException

close

public void close(org.apache.hadoop.mapreduce.TaskAttemptContext context)
           throws IOException

Specified by:
close in class org.apache.hadoop.mapreduce.RecordWriter<AvroKey<T>,org.apache.hadoop.io.NullWritable>
Throws:
IOException


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