Class RowCounter
java.lang.Object
org.apache.hadoop.hbase.util.AbstractHBaseTool
org.apache.hadoop.hbase.mapreduce.RowCounter
- All Implemented Interfaces:
org.apache.hadoop.conf.Configurable,org.apache.hadoop.util.Tool
A job with a just a map phase to count rows. Map outputs table rows IF the input row has columns
that have content.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static class(package private) static classMapper that runs the count.Nested classes/interfaces inherited from class org.apache.hadoop.hbase.util.AbstractHBaseTool
AbstractHBaseTool.OptionsOrderComparator -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanprivate longprivate static final Stringprivate longprivate org.apache.hadoop.mapreduce.Jobprivate static final Stringprivate static final org.slf4j.Logger(package private) static final StringName of this 'program'.private static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate List<MultiRowRangeFilter.RowRange>private longprivate StringFields inherited from class org.apache.hadoop.hbase.util.AbstractHBaseTool
cmdLineArgs, conf, EXIT_FAILURE, EXIT_SUCCESS, LONG_HELP_OPTION, options, SHORT_HELP_OPTION -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidOverride this to add command-line options usingAbstractHBaseTool.addOptWithArg(java.lang.String, java.lang.String)and similar methods.org.apache.hadoop.mapreduce.JobcreateSubmittableJob(org.apache.hadoop.conf.Configuration conf) Sets up the actual job.static org.apache.hadoop.mapreduce.JobcreateSubmittableJob(org.apache.hadoop.conf.Configuration conf, String[] args) Deprecated.as of release 2.3.0.protected intdoWork()The "main function" of the tool(package private) org.apache.hadoop.mapreduce.Jobstatic voidMain entry point.protected org.apache.hbase.thirdparty.org.apache.commons.cli.CommandLineParserCreate the parser to use for parsing and validating the command line.private static List<MultiRowRangeFilter.RowRange>protected voidprivate static voidprintUsage(String errorMessage) Prints usage without error message.protected voidprintUsage(String usageStr, String usageHeader, String usageFooter) protected voidprocessOldArgs(List<String> args) For backward compatibility.protected voidprocessOptions(org.apache.hbase.thirdparty.org.apache.commons.cli.CommandLine cmd) This method is called to process the options after they have been parsed.private static voidsetScanFilter(Scan scan, List<MultiRowRangeFilter.RowRange> rowRangeList, boolean countDeleteMarkers) Sets filterFilterBaseto theScaninstance.Methods inherited from class org.apache.hadoop.hbase.util.AbstractHBaseTool
addOption, addOptNoArg, addOptNoArg, addOptWithArg, addOptWithArg, addRequiredOption, addRequiredOptWithArg, addRequiredOptWithArg, doStaticMain, getConf, getOptionAsDouble, getOptionAsInt, getOptionAsInt, getOptionAsLong, getOptionAsLong, parseArgs, parseInt, parseLong, run, setConf
-
Field Details
-
LOG
-
NAME
Name of this 'program'.- See Also:
-
JOB_NAME_CONF_KEY
- See Also:
-
EXPECTED_COUNT_KEY
-
OPT_START_TIME
- See Also:
-
OPT_END_TIME
- See Also:
-
OPT_RANGE
- See Also:
-
OPT_EXPECTED_COUNT
- See Also:
-
OPT_COUNT_DELETE_MARKERS
- See Also:
-
tableName
-
rowRangeList
-
startTime
-
endTime
-
expectedCount
-
countDeleteMarkers
-
columns
-
job
-
-
Constructor Details
-
RowCounter
public RowCounter()
-
-
Method Details
-
createSubmittableJob
public org.apache.hadoop.mapreduce.Job createSubmittableJob(org.apache.hadoop.conf.Configuration conf) throws IOException Sets up the actual job.- Parameters:
conf- The current configuration.- Returns:
- The newly created job.
- Throws:
IOException- When setting up the job fails.
-
createSubmittableJob
@Deprecated public static org.apache.hadoop.mapreduce.Job createSubmittableJob(org.apache.hadoop.conf.Configuration conf, String[] args) throws IOException Deprecated.as of release 2.3.0. Will be removed on 4.0.0. Please use main method instead.Sets up the actual job.- Parameters:
conf- The current configuration.args- The command line parameters.- Returns:
- The newly created job.
- Throws:
IOException- When setting up the job fails.
-
printUsage
Prints usage without error message. Note that we don't document --expected-count, because it's intended for test. -
parseRowRangeParameter
-
setScanFilter
private static void setScanFilter(Scan scan, List<MultiRowRangeFilter.RowRange> rowRangeList, boolean countDeleteMarkers) Sets filterFilterBaseto theScaninstance. If provided rowRangeList contains more than one element, method sets filter which is instance ofMultiRowRangeFilter. If rowRangeList contains exactly one element, startRow and stopRow are set to the scan. Also, method may applyFirstKeyOnlyFilteranKeyOnlyFilterfor better performance. -
printUsage
- Overrides:
printUsagein classAbstractHBaseTool
-
printUsage
- Overrides:
printUsagein classAbstractHBaseTool
-
addOptions
Description copied from class:AbstractHBaseToolOverride this to add command-line options usingAbstractHBaseTool.addOptWithArg(java.lang.String, java.lang.String)and similar methods.- Specified by:
addOptionsin classAbstractHBaseTool
-
processOptions
protected void processOptions(org.apache.hbase.thirdparty.org.apache.commons.cli.CommandLine cmd) throws IllegalArgumentException Description copied from class:AbstractHBaseToolThis method is called to process the options after they have been parsed.- Specified by:
processOptionsin classAbstractHBaseTool- Throws:
IllegalArgumentException
-
processOldArgs
Description copied from class:AbstractHBaseToolFor backward compatibility. DO NOT use it for new tools. We have options in existing tools which can't be ported to Apache CLI'sOption. (because they don't pass validation, for e.g. "-copy-to". "-" means short name which doesn't allow '-' in name). This function is to allow tools to have, for time being, parameters which can't be parsed usingOption. Overrides should consume all valid legacy arguments. If the param 'args' is not empty on return, it means there were invalid options, in which case we'll exit from the tool. Note that it's called beforeAbstractHBaseTool.processOptions(CommandLine), which means new options' values will override old ones'.- Overrides:
processOldArgsin classAbstractHBaseTool
-
doWork
Description copied from class:AbstractHBaseToolThe "main function" of the tool- Specified by:
doWorkin classAbstractHBaseTool- Throws:
Exception
-
main
Main entry point.- Parameters:
args- The command line parameters.- Throws:
Exception- When running the job fails.
-
newParser
Description copied from class:AbstractHBaseToolCreate the parser to use for parsing and validating the command line. Since commons-cli lacks the capability to validate arbitrary combination of options, it may be helpful to bake custom logic into a specialized parser implementation. See LoadTestTool for examples.- Overrides:
newParserin classAbstractHBaseTool- Returns:
- a new parser specific to the current tool
-
getMapReduceJob
org.apache.hadoop.mapreduce.Job getMapReduceJob()
-