datafu.hourglass.avro
Class AvroKeyWithMetadataRecordWriter<T>

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

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

Writes Avro records to an Avro container file output stream.


Field Summary
static java.lang.String TEXT_PREFIX
          The configuration key prefix for a text output metadata.
 
Constructor Summary
AvroKeyWithMetadataRecordWriter(org.apache.avro.Schema writerSchema, org.apache.avro.file.CodecFactory compressionCodec, java.io.OutputStream outputStream, org.apache.hadoop.conf.Configuration conf)
          Constructor.
 
Method Summary
 void close(org.apache.hadoop.mapreduce.TaskAttemptContext context)
          
 void write(org.apache.avro.mapred.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
 

Field Detail

TEXT_PREFIX

public static final java.lang.String TEXT_PREFIX
The configuration key prefix for a text output metadata.

See Also:
Constant Field Values
Constructor Detail

AvroKeyWithMetadataRecordWriter

public AvroKeyWithMetadataRecordWriter(org.apache.avro.Schema writerSchema,
                                       org.apache.avro.file.CodecFactory compressionCodec,
                                       java.io.OutputStream outputStream,
                                       org.apache.hadoop.conf.Configuration conf)
                                throws java.io.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:
java.io.IOException - If the record writer cannot be opened.
Method Detail

write

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

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

close

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

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


Matthew Hayes