org.apache.hadoop.hbase.mapreduce
Class TableOutputFormat<KEY>

java.lang.Object
  extended by org.apache.hadoop.mapreduce.OutputFormat<KEY,org.apache.hadoop.io.Writable>
      extended by org.apache.hadoop.hbase.mapreduce.TableOutputFormat<KEY>
Type Parameters:
KEY - The type of the key. Ignored in this class.

public class TableOutputFormat<KEY>
extends org.apache.hadoop.mapreduce.OutputFormat<KEY,org.apache.hadoop.io.Writable>

Convert Map/Reduce output and write it to an HBase table. The KEY is ignored while the output value must be either a Put or a Delete instance.


Nested Class Summary
protected static class TableOutputFormat.TableRecordWriter<KEY>
          Writes the reducer output to an HBase table.
 
Field Summary
static String OUTPUT_TABLE
          Job parameter that specifies the output table.
 
Constructor Summary
TableOutputFormat()
           
 
Method Summary
 void checkOutputSpecs(org.apache.hadoop.mapreduce.JobContext context)
          Checks if the output target exists.
 org.apache.hadoop.mapreduce.OutputCommitter getOutputCommitter(org.apache.hadoop.mapreduce.TaskAttemptContext context)
          Returns the output committer.
 org.apache.hadoop.mapreduce.RecordWriter<KEY,org.apache.hadoop.io.Writable> getRecordWriter(org.apache.hadoop.mapreduce.TaskAttemptContext context)
          Creates a new record writer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

OUTPUT_TABLE

public static final String OUTPUT_TABLE
Job parameter that specifies the output table.

See Also:
Constant Field Values
Constructor Detail

TableOutputFormat

public TableOutputFormat()
Method Detail

getRecordWriter

public org.apache.hadoop.mapreduce.RecordWriter<KEY,org.apache.hadoop.io.Writable> getRecordWriter(org.apache.hadoop.mapreduce.TaskAttemptContext context)
                                                                                            throws IOException,
                                                                                                   InterruptedException
Creates a new record writer.

Specified by:
getRecordWriter in class org.apache.hadoop.mapreduce.OutputFormat<KEY,org.apache.hadoop.io.Writable>
Parameters:
context - The current task context.
Returns:
The newly created writer instance.
Throws:
IOException - When creating the writer fails.
InterruptedException - When the jobs is cancelled.
See Also:
FileOutputFormat.getRecordWriter(org.apache.hadoop.mapreduce.TaskAttemptContext)

checkOutputSpecs

public void checkOutputSpecs(org.apache.hadoop.mapreduce.JobContext context)
                      throws IOException,
                             InterruptedException
Checks if the output target exists.

Specified by:
checkOutputSpecs in class org.apache.hadoop.mapreduce.OutputFormat<KEY,org.apache.hadoop.io.Writable>
Parameters:
context - The current context.
Throws:
IOException - When the check fails.
InterruptedException - When the job is aborted.
See Also:
OutputFormat.checkOutputSpecs(org.apache.hadoop.mapreduce.JobContext)

getOutputCommitter

public org.apache.hadoop.mapreduce.OutputCommitter getOutputCommitter(org.apache.hadoop.mapreduce.TaskAttemptContext context)
                                                               throws IOException,
                                                                      InterruptedException
Returns the output committer.

Specified by:
getOutputCommitter in class org.apache.hadoop.mapreduce.OutputFormat<KEY,org.apache.hadoop.io.Writable>
Parameters:
context - The current context.
Returns:
The committer.
Throws:
IOException - When creating the committer fails.
InterruptedException - When the job is aborted.
See Also:
OutputFormat.getOutputCommitter(org.apache.hadoop.mapreduce.TaskAttemptContext)


Copyright © 2009 The Apache Software Foundation