@InterfaceAudience.Public public class RowCounter extends AbstractHBaseTool
Modifier and Type | Class and Description |
---|---|
(package private) static class |
RowCounter.RowCounterCommandLineParser |
(package private) static class |
RowCounter.RowCounterMapper
Mapper that runs the count.
|
AbstractHBaseTool.OptionsOrderComparator
Modifier and Type | Field and Description |
---|---|
private List<String> |
columns |
private long |
endTime |
private static String |
EXPECTED_COUNT_KEY |
private long |
expectedCount |
private static String |
JOB_NAME_CONF_KEY |
private static org.slf4j.Logger |
LOG |
(package private) static String |
NAME
Name of this 'program'.
|
private static String |
OPT_END_TIME |
private static String |
OPT_EXPECTED_COUNT |
private static String |
OPT_RANGE |
private static String |
OPT_START_TIME |
private List<MultiRowRangeFilter.RowRange> |
rowRangeList |
private long |
startTime |
private String |
tableName |
cmdLineArgs, conf, EXIT_FAILURE, EXIT_SUCCESS, LONG_HELP_OPTION, options, SHORT_HELP_OPTION
Constructor and Description |
---|
RowCounter() |
Modifier and Type | Method and Description |
---|---|
protected void |
addOptions()
Override this to add command-line options using
AbstractHBaseTool.addOptWithArg(java.lang.String, java.lang.String) and similar methods. |
org.apache.hadoop.mapreduce.Job |
createSubmittableJob(org.apache.hadoop.conf.Configuration conf)
Sets up the actual job.
|
static org.apache.hadoop.mapreduce.Job |
createSubmittableJob(org.apache.hadoop.conf.Configuration conf,
String[] args)
Deprecated.
as of release 2.3.0. Will be removed on 4.0.0. Please use main method instead.
|
protected int |
doWork()
The "main function" of the tool
|
static void |
main(String[] args)
Main entry point.
|
protected org.apache.hbase.thirdparty.org.apache.commons.cli.CommandLineParser |
newParser()
Create the parser to use for parsing and validating the command line.
|
private static List<MultiRowRangeFilter.RowRange> |
parseRowRangeParameter(String arg) |
protected void |
printUsage() |
private static void |
printUsage(String errorMessage)
Prints usage without error message.
|
protected void |
printUsage(String usageStr,
String usageHeader,
String usageFooter) |
protected void |
processOldArgs(List<String> args)
For backward compatibility.
|
protected void |
processOptions(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 void |
setScanFilter(Scan scan,
List<MultiRowRangeFilter.RowRange> rowRangeList)
Sets filter
FilterBase to the Scan instance. |
addOption, addOptNoArg, addOptNoArg, addOptWithArg, addOptWithArg, addRequiredOption, addRequiredOptWithArg, addRequiredOptWithArg, doStaticMain, getConf, getOptionAsDouble, getOptionAsInt, getOptionAsInt, getOptionAsLong, getOptionAsLong, parseArgs, parseInt, parseLong, run, setConf
private static final org.slf4j.Logger LOG
static final String NAME
private static final String JOB_NAME_CONF_KEY
private static final String EXPECTED_COUNT_KEY
private static final String OPT_START_TIME
private static final String OPT_END_TIME
private static final String OPT_RANGE
private static final String OPT_EXPECTED_COUNT
private List<MultiRowRangeFilter.RowRange> rowRangeList
private long startTime
private long endTime
private long expectedCount
public RowCounter()
public org.apache.hadoop.mapreduce.Job createSubmittableJob(org.apache.hadoop.conf.Configuration conf) throws IOException
conf
- The current configuration.IOException
- When setting up the job fails.@Deprecated public static org.apache.hadoop.mapreduce.Job createSubmittableJob(org.apache.hadoop.conf.Configuration conf, String[] args) throws IOException
conf
- The current configuration.args
- The command line parameters.IOException
- When setting up the job fails.private static void printUsage(String errorMessage)
private static List<MultiRowRangeFilter.RowRange> parseRowRangeParameter(String arg)
private static void setScanFilter(Scan scan, List<MultiRowRangeFilter.RowRange> rowRangeList)
FilterBase
to the Scan
instance. If provided rowRangeList contains
more than one element, method sets filter which is instance of MultiRowRangeFilter
.
Otherwise, method sets filter which is instance of FirstKeyOnlyFilter
. If rowRangeList
contains exactly one element, startRow and stopRow are set to the scan. nnprotected void printUsage()
printUsage
in class AbstractHBaseTool
protected void printUsage(String usageStr, String usageHeader, String usageFooter)
printUsage
in class AbstractHBaseTool
protected void addOptions()
AbstractHBaseTool
AbstractHBaseTool.addOptWithArg(java.lang.String, java.lang.String)
and similar methods.addOptions
in class AbstractHBaseTool
protected void processOptions(org.apache.hbase.thirdparty.org.apache.commons.cli.CommandLine cmd) throws IllegalArgumentException
AbstractHBaseTool
processOptions
in class AbstractHBaseTool
IllegalArgumentException
protected void processOldArgs(List<String> args)
AbstractHBaseTool
Option
. (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 using Option
.
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 before AbstractHBaseTool.processOptions(CommandLine)
, which means new options' values will
override old ones'.processOldArgs
in class AbstractHBaseTool
protected int doWork() throws Exception
AbstractHBaseTool
doWork
in class AbstractHBaseTool
Exception
public static void main(String[] args) throws Exception
args
- The command line parameters.Exception
- When running the job fails.protected org.apache.hbase.thirdparty.org.apache.commons.cli.CommandLineParser newParser()
AbstractHBaseTool
newParser
in class AbstractHBaseTool
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.