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
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected classWrites the reducer output to an HBase table. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate org.apache.hadoop.conf.ConfigurationThe configuration.private static final org.slf4j.Loggerstatic final StringPrefix for configuration property overrides to apply insetConf(Configuration).static final StringJob parameter that specifies the output table.static final StringOptional job parameter to specify a peer cluster.static final StringOptional job parameter to specify peer cluster's ZK client portstatic final StringOptional specification of the rs class name of the peer clusterstatic final StringOptional specification of the rs impl name of the peer cluster -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcheckOutputSpecs(org.apache.hadoop.mapreduce.JobContext context) Checks if the output table exists and is enabled.org.apache.hadoop.conf.ConfigurationgetConf()org.apache.hadoop.mapreduce.OutputCommittergetOutputCommitter(org.apache.hadoop.mapreduce.TaskAttemptContext context) Returns the output committer.getRecordWriter(org.apache.hadoop.mapreduce.TaskAttemptContext context) Creates a new record writer.voidsetConf(org.apache.hadoop.conf.Configuration otherConf)
-
Field Details
-
LOG
-
OUTPUT_TABLE
Job parameter that specifies the output table.- See Also:
-
OUTPUT_CONF_PREFIX
Prefix for configuration property overrides to apply insetConf(Configuration). For keys matching this prefix, the prefix is stripped, and the value is set in the configuration with the resulting key, ie. the entry "hbase.mapred.output.key1 = value1" would be set in the configuration as "key1 = value1". Use this to set properties which should only be applied to theTableOutputFormatconfiguration and not the input configuration.- See Also:
-
QUORUM_ADDRESS
Optional job parameter to specify a peer cluster. Used specifying remote cluster when copying between hbase clusters (the source is picked up fromhbase-site.xml). -
QUORUM_PORT
Optional job parameter to specify peer cluster's ZK client port- See Also:
-
REGION_SERVER_CLASS
Optional specification of the rs class name of the peer cluster- See Also:
-
REGION_SERVER_IMPL
Optional specification of the rs impl name of the peer cluster- See Also:
-
conf
The configuration.
-
-
Constructor Details
-
TableOutputFormat
public TableOutputFormat()
-
-
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 singleRecordWriterper 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:
getRecordWriterin classorg.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:
checkOutputSpecsin classorg.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:
getOutputCommitterin classorg.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
- Specified by:
getConfin interfaceorg.apache.hadoop.conf.Configurable
-
setConf
- Specified by:
setConfin interfaceorg.apache.hadoop.conf.Configurable
-