You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by st...@apache.org on 2016/01/19 17:43:34 UTC

hbase git commit: HBASE-15118 Fix findbugs complaint in hbase-server; ADDENDUM TO FIX TestImportTsv

Repository: hbase
Updated Branches:
  refs/heads/branch-1.2 5ff65455c -> b9450687c


 HBASE-15118 Fix findbugs complaint in hbase-server; ADDENDUM TO FIX TestImportTsv


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/b9450687
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/b9450687
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/b9450687

Branch: refs/heads/branch-1.2
Commit: b9450687ce5a6ad524e7a9bca351bef43622f527
Parents: 5ff6545
Author: stack <st...@apache.org>
Authored: Tue Jan 19 08:43:22 2016 -0800
Committer: stack <st...@apache.org>
Committed: Tue Jan 19 08:43:22 2016 -0800

----------------------------------------------------------------------
 .../hadoop/hbase/mapreduce/ImportTsv.java       | 24 +++++++++-----------
 1 file changed, 11 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/b9450687/hbase-server/src/main/java/org/apache/hadoop/hbase/mapreduce/ImportTsv.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/mapreduce/ImportTsv.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/mapreduce/ImportTsv.java
index 9362bda..1bac4b5 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/mapreduce/ImportTsv.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/mapreduce/ImportTsv.java
@@ -501,12 +501,6 @@ public class ImportTsv extends Configured implements Tool {
                 LOG.error(errorMsg);
                 throw new TableNotFoundException(errorMsg);
               }
-            } else {
-              String errorMsg =
-                  format("Table '%s' does not exist and '%s' is set to no.", tableName,
-                      CREATE_TABLE_CONF_KEY);
-              LOG.error(errorMsg);
-              throw new TableNotFoundException(errorMsg);
             }
             try (Table table = connection.getTable(tableName);
                 RegionLocator regionLocator = connection.getRegionLocator(tableName)) {
@@ -546,18 +540,22 @@ public class ImportTsv extends Configured implements Tool {
               } else {
                 job.setMapOutputValueClass(Put.class);
                 job.setCombinerClass(PutCombiner.class);
-
               }
               HFileOutputFormat2.configureIncrementalLoad(job, table.getTableDescriptor(),
                   regionLocator);
             }
+          } 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)) {
-              job.setMapOutputValueClass(Text.class);
-              job.setReducerClass(TextSortReducer.class);
-            } else {
-              job.setMapOutputValueClass(Put.class);
-              job.setCombinerClass(PutCombiner.class);
-              job.setReducerClass(PutSortReducer.class);
+              usage(TsvImporterTextMapper.class.toString()
+                  + " should not be used for non bulkloading case. use "
+                  + TsvImporterMapper.class.toString()
+                  + " or custom mapper whose value type is Put.");
+              System.exit(-1);
             }
             // No reducers. Just write straight to table. Call initTableReducerJob
             // to set up the TableOutputFormat.