HBASE-12264 ImportTsv should fail fast if output is not specified and table does not exist (Ashish)
This commit is contained in:
parent
487b58313c
commit
728fc543ea
|
@ -459,6 +459,11 @@ public class ImportTsv extends Configured implements Tool {
|
|||
}
|
||||
HFileOutputFormat.configureIncrementalLoad(job, table);
|
||||
} else {
|
||||
if (!admin.tableExists(tableName)) {
|
||||
String errorMsg = format("Table '%s' does not exist.", tableName);
|
||||
LOG.error(errorMsg);
|
||||
throw new TableNotFoundException(errorMsg);
|
||||
}
|
||||
if (mapperClass.equals(TsvImporterTextMapper.class)) {
|
||||
usage(TsvImporterTextMapper.class.toString()
|
||||
+ " should not be used for non bulkloading case. use "
|
||||
|
|
|
@ -244,6 +244,16 @@ public class TestImportTsv implements Configurable {
|
|||
ImportTsv.createSubmittableJob(conf, args);
|
||||
}
|
||||
|
||||
@Test(expected = TableNotFoundException.class)
|
||||
public void testMRWithoutAnExistingTable() throws Exception {
|
||||
String table = "test-" + UUID.randomUUID();
|
||||
String[] args =
|
||||
new String[] { table, "/inputFile" };
|
||||
|
||||
Configuration conf = new Configuration(util.getConfiguration());
|
||||
ImportTsv.createSubmittableJob(conf, args);
|
||||
}
|
||||
|
||||
protected static Tool doMROnTableTest(HBaseTestingUtility util, String family,
|
||||
String data, String[] args) throws Exception {
|
||||
return doMROnTableTest(util, family, data, args, 1);
|
||||
|
|
Loading…
Reference in New Issue