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
Modifier and TypeClassDescriptionprotected class
Writes the reducer output to an HBase table. -
Field Summary
Modifier and TypeFieldDescriptionprivate org.apache.hadoop.conf.Configuration
The configuration.private static final org.slf4j.Logger
static final String
Prefix for configuration property overrides to apply insetConf(Configuration)
.static final String
Job parameter that specifies the output table.static final String
Optional job parameter to specify a peer cluster.static final String
Optional job parameter to specify peer cluster's ZK client portstatic final String
Optional specification of the rs class name of the peer clusterstatic final String
Optional specification of the rs impl name of the peer cluster -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
checkOutputSpecs
(org.apache.hadoop.mapreduce.JobContext context) Checks if the output table exists and is enabled.org.apache.hadoop.conf.Configuration
getConf()
org.apache.hadoop.mapreduce.OutputCommitter
getOutputCommitter
(org.apache.hadoop.mapreduce.TaskAttemptContext context) Returns the output committer.getRecordWriter
(org.apache.hadoop.mapreduce.TaskAttemptContext context) Creates a new record writer.void
setConf
(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 theTableOutputFormat
configuration 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 singleRecordWriter
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 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:
checkOutputSpecs
in 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:
getOutputCommitter
in 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:
getConf
in interfaceorg.apache.hadoop.conf.Configurable
-
setConf
- Specified by:
setConf
in interfaceorg.apache.hadoop.conf.Configurable
-