Class TableOutputFormat<KEY>

java.lang.Object
org.apache.hadoop.mapreduce.OutputFormat<KEY,Mutation>
org.apache.hadoop.hbase.mapreduce.TableOutputFormat<KEY>
All Implemented Interfaces:
org.apache.hadoop.conf.Configurable

@Public public class TableOutputFormat<KEY> extends org.apache.hadoop.mapreduce.OutputFormat<KEY,Mutation> implements org.apache.hadoop.conf.Configurable
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.
  • Field Details

  • Constructor Details

  • Method Details

    • getRecordWriter

      public org.apache.hadoop.mapreduce.RecordWriter<KEY,Mutation> getRecordWriter(org.apache.hadoop.mapreduce.TaskAttemptContext context) throws IOException, InterruptedException
      Creates a new record writer. Be aware that the baseline javadoc gives the impression that there is a single RecordWriter per job but in HBase, it is more natural if we give you a new RecordWriter per call of this method. You must close the returned RecordWriter when done. Failure to do so will drop writes.
      Specified by:
      getRecordWriter in class org.apache.hadoop.mapreduce.OutputFormat<KEY,Mutation>
      Parameters:
      context - The current task context.
      Returns:
      The newly created writer instance.
      Throws:
      IOException - When creating the writer fails.
      InterruptedException - When the job is cancelled.
    • checkOutputSpecs

      public void checkOutputSpecs(org.apache.hadoop.mapreduce.JobContext context) throws IOException, InterruptedException
      Checks if the output table exists and is enabled.
      Specified by:
      checkOutputSpecs in class org.apache.hadoop.mapreduce.OutputFormat<KEY,Mutation>
      Parameters:
      context - The current context.
      Throws:
      IOException - When the check fails.
      InterruptedException - When the job is aborted.
      See Also:
      • OutputFormat.checkOutputSpecs(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,Mutation>
      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(TaskAttemptContext)
    • getConf

      public org.apache.hadoop.conf.Configuration getConf()
      Specified by:
      getConf in interface org.apache.hadoop.conf.Configurable
    • setConf

      public void setConf(org.apache.hadoop.conf.Configuration otherConf)
      Specified by:
      setConf in interface org.apache.hadoop.conf.Configurable