hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anoopsamj...@apache.org
Subject git commit: HBASE-12304 CellCounter will throw AIOBE when output directory is not specified. (Ashish Singhi)
Date Tue, 28 Oct 2014 11:58:12 GMT
Repository: hbase
Updated Branches:
  refs/heads/master 7587d99b6 -> f2f21000f


HBASE-12304 CellCounter will throw AIOBE when output directory is not specified. (Ashish Singhi)


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

Branch: refs/heads/master
Commit: f2f21000fb7ec15afcff07223f0e5c9b46e636f3
Parents: 7587d99
Author: anoopsjohn <anoop.s.john@intel.com>
Authored: Tue Oct 28 17:27:47 2014 +0530
Committer: anoopsjohn <anoop.s.john@intel.com>
Committed: Tue Oct 28 17:27:47 2014 +0530

----------------------------------------------------------------------
 .../org/apache/hadoop/hbase/mapreduce/CellCounter.java   |  2 +-
 .../apache/hadoop/hbase/mapreduce/TestCellCounter.java   | 11 ++++++++++-
 2 files changed, 11 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/f2f21000/hbase-server/src/main/java/org/apache/hadoop/hbase/mapreduce/CellCounter.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/mapreduce/CellCounter.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/mapreduce/CellCounter.java
index 2790fe2..08018ab 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/mapreduce/CellCounter.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/mapreduce/CellCounter.java
@@ -242,7 +242,7 @@ public class CellCounter extends Configured implements Tool {
   @Override
   public int run(String[] args) throws Exception {
     String[] otherArgs = new GenericOptionsParser(getConf(), args).getRemainingArgs();
-    if (otherArgs.length < 1) {
+    if (otherArgs.length < 2) {
       System.err.println("ERROR: Wrong number of parameters: " + args.length);
       System.err.println("Usage: CellCounter <tablename> <outputDir> <reportSeparator>
" +
           "[^[regex pattern] or [Prefix] for row filter]] ");

http://git-wip-us.apache.org/repos/asf/hbase/blob/f2f21000/hbase-server/src/test/java/org/apache/hadoop/hbase/mapreduce/TestCellCounter.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/mapreduce/TestCellCounter.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/mapreduce/TestCellCounter.java
index dd0bece..1dab9dd 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/mapreduce/TestCellCounter.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/mapreduce/TestCellCounter.java
@@ -23,6 +23,7 @@ import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FileUtil;
 import org.apache.hadoop.fs.LocalFileSystem;
 import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.hbase.HBaseConfiguration;
 import org.apache.hadoop.hbase.HBaseTestingUtility;
 import org.apache.hadoop.hbase.client.Put;
 import org.apache.hadoop.hbase.client.Table;
@@ -32,6 +33,7 @@ import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.hadoop.hbase.util.LauncherSecurityManager;
 import org.apache.hadoop.mapreduce.Job;
 import org.apache.hadoop.util.GenericOptionsParser;
+import org.apache.hadoop.util.ToolRunner;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Test;
@@ -201,4 +203,11 @@ public class TestCellCounter {
       FileUtil.fullyDelete(new File(outputPath));
     }
   }
-}
+
+  @Test
+  public void TestCellCounterWithoutOutputDir() throws Exception {
+    String[] args = new String[] { "tableName" };
+    assertEquals("CellCounter should exit with -1 as output directory is not specified.",
-1,
+      ToolRunner.run(HBaseConfiguration.create(), new CellCounter(), args));
+  }
+}
\ No newline at end of file


Mime
View raw message