Class TestImportTsv
java.lang.Object
org.apache.hadoop.hbase.mapreduce.TestImportTsv
- All Implemented Interfaces:
org.apache.hadoop.conf.Configurable
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final HBaseClassTestRuleprotected static final Stringorg.junit.rules.ExpectedExceptionprivate final Stringprotected static final StringForce use of combiner in doMROnTableTest.private static final org.slf4j.Loggerprotected static final Stringprivate org.apache.hadoop.hbase.TableNameprotected static HBaseTestingUtil -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate org.apache.hadoop.util.TooldoMROnTableTest(String data, int valueMultiplier) protected static org.apache.hadoop.util.TooldoMROnTableTest(HBaseTestingUtil util, org.apache.hadoop.hbase.TableName table, String family, String data, Map<String, String> args) protected static org.apache.hadoop.util.TooldoMROnTableTest(HBaseTestingUtil util, org.apache.hadoop.hbase.TableName table, String family, String data, Map<String, String> args, int valueMultiplier, int expectedKVCount) Run an ImportTsv job and perform basic validation on the results.org.apache.hadoop.conf.ConfigurationgetConf()private static intgetKVCountFromHfile(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path p) Method returns the total KVs in given hfilestatic voidstatic voidvoidsetConf(org.apache.hadoop.conf.Configuration conf) voidsetup()voidvoidvoidvoidvoidvoidIf table is not present in bulk mode and create.table is not set to yes, import should fail with TableNotFoundException.voidvoidIf table is not present in non-bulk mode, dry run should fail just like normal mode.voidvoidvoidvoidvoidvoidvoidvoidvoidvoidIf there are invalid data rows as inputs, then only those rows should be ignored.voidprivate static voidvalidateHFiles(org.apache.hadoop.fs.FileSystem fs, String outputPath, String family, int expectedKVCount) Confirm ImportTsv via HFiles on fs.private static voidvalidateTable(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.hbase.TableName tableName, String family, int valueMultiplier, boolean isDryRun) Confirm ImportTsv via data in online table.
-
Field Details
-
CLASS_RULE
-
LOG
-
NAME
-
util
-
DELETE_AFTER_LOAD_CONF
-
FORCE_COMBINER_CONF
Force use of combiner in doMROnTableTest. Boolean. Default is true. -
FAMILY
- See Also:
-
tn
-
args
-
exception
-
-
Constructor Details
-
TestImportTsv
public TestImportTsv()
-
-
Method Details
-
getConf
- Specified by:
getConfin interfaceorg.apache.hadoop.conf.Configurable
-
setConf
- Specified by:
setConfin interfaceorg.apache.hadoop.conf.Configurable
-
provisionCluster
- Throws:
Exception
-
releaseCluster
- Throws:
Exception
-
setup
- Throws:
Exception
-
testMROnTable
- Throws:
Exception
-
testMROnTableWithTimestamp
- Throws:
Exception
-
testMROnTableWithCustomMapper
- Throws:
Exception
-
testBulkOutputWithoutAnExistingTable
- Throws:
Exception
-
testBulkOutputWithAnExistingTable
- Throws:
Exception
-
testBulkOutputWithAnExistingTableNoStrictTrue
- Throws:
Exception
-
testJobConfigurationsWithTsvImporterTextMapper
- Throws:
Exception
-
testBulkOutputWithTsvImporterTextMapper
- Throws:
Exception
-
testWithoutAnExistingTableAndCreateTableSetToNo
- Throws:
Exception
-
testMRNoMatchedColumnFamily
- Throws:
Exception
-
testMRWithoutAnExistingTable
- Throws:
Exception
-
testJobConfigurationsWithDryMode
- Throws:
Exception
-
testDryModeWithoutBulkOutputAndTableExists
- Throws:
Exception
-
testDryModeWithoutBulkOutputAndTableDoesNotExists
If table is not present in non-bulk mode, dry run should fail just like normal mode.- Throws:
Exception
-
testDryModeWithBulkOutputAndTableExists
- Throws:
Exception
-
testDryModeWithBulkOutputAndTableDoesNotExistsCreateTableSetToNo
If table is not present in bulk mode and create.table is not set to yes, import should fail with TableNotFoundException.- Throws:
Exception
-
testDryModeWithBulkModeAndTableDoesNotExistsCreateTableSetToYes
- Throws:
Exception
-
testTsvImporterTextMapperWithInvalidData
If there are invalid data rows as inputs, then only those rows should be ignored.- Throws:
Exception
-
testSkipEmptyColumns
- Throws:
Exception
-
doMROnTableTest
private org.apache.hadoop.util.Tool doMROnTableTest(String data, int valueMultiplier) throws Exception - Throws:
Exception
-
doMROnTableTest
protected static org.apache.hadoop.util.Tool doMROnTableTest(HBaseTestingUtil util, org.apache.hadoop.hbase.TableName table, String family, String data, Map<String, String> args) throws Exception- Throws:
Exception
-
doMROnTableTest
protected static org.apache.hadoop.util.Tool doMROnTableTest(HBaseTestingUtil util, org.apache.hadoop.hbase.TableName table, String family, String data, Map<String, String> args, int valueMultiplier, int expectedKVCount) throws ExceptionRun an ImportTsv job and perform basic validation on the results. Returns the ImportTsvToolinstance so that other tests can inspect it for further validation as necessary. This method is static to insure non-reliance on instance's util/conf facilities.- Parameters:
args- Any arguments to pass BEFORE inputFile path is appended.- Returns:
- The Tool instance used to run the test.
- Throws:
Exception
-
validateTable
private static void validateTable(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.hbase.TableName tableName, String family, int valueMultiplier, boolean isDryRun) throws IOException Confirm ImportTsv via data in online table.- Throws:
IOException
-
validateHFiles
private static void validateHFiles(org.apache.hadoop.fs.FileSystem fs, String outputPath, String family, int expectedKVCount) throws IOException Confirm ImportTsv via HFiles on fs.- Throws:
IOException
-
getKVCountFromHfile
private static int getKVCountFromHfile(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path p) throws IOException Method returns the total KVs in given hfile- Parameters:
fs- File Systemp- HFile path- Returns:
- KV count in the given hfile
- Throws:
IOException
-