HBASE-20517 Fix PerformanceEvaluation 'column' parameter
Project: http://git-wip-us.apache.org/repos/asf/hbase/repo Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/a275e863 Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/a275e863 Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/a275e863 Branch: refs/heads/branch-1.2 Commit: a275e863124e979745bea493c578c1f9deb400be Parents: 1519dc0 Author: Andrew Purtell <apurt...@apache.org> Authored: Thu May 3 16:27:23 2018 -0700 Committer: Andrew Purtell <apurt...@apache.org> Committed: Fri May 4 17:24:49 2018 -0700 ---------------------------------------------------------------------- .../hadoop/hbase/PerformanceEvaluation.java | 31 +++++++++++++++----- 1 file changed, 24 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hbase/blob/a275e863/hbase-server/src/test/java/org/apache/hadoop/hbase/PerformanceEvaluation.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/PerformanceEvaluation.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/PerformanceEvaluation.java index 0f12cc7..eea5257 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/PerformanceEvaluation.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/PerformanceEvaluation.java @@ -133,7 +133,6 @@ public class PerformanceEvaluation extends Configured implements Tool { public static final String TABLE_NAME = "TestTable"; public static final byte[] FAMILY_NAME = Bytes.toBytes("info"); public static final byte [] COLUMN_ZERO = Bytes.toBytes("" + 0); - public static final byte [] QUALIFIER_NAME = COLUMN_ZERO; public static final int DEFAULT_VALUE_LENGTH = 1000; public static final int ROW_LENGTH = 26; @@ -1203,7 +1202,10 @@ public class PerformanceEvaluation extends Configured implements Tool { scan.setCaching(opts.caching); FilterList list = new FilterList(); if (opts.addColumns) { - scan.addColumn(FAMILY_NAME, QUALIFIER_NAME); + for (int column = 0; column < opts.columns; column++) { + byte [] qualifier = column == 0? COLUMN_ZERO: Bytes.toBytes("" + column); + scan.addColumn(FAMILY_NAME, qualifier); + } } else { scan.addFamily(FAMILY_NAME); } @@ -1241,7 +1243,10 @@ public class PerformanceEvaluation extends Configured implements Tool { scan.setFilter(new FilterAllFilter()); } if (opts.addColumns) { - scan.addColumn(FAMILY_NAME, QUALIFIER_NAME); + for (int column = 0; column < opts.columns; column++) { + byte [] qualifier = column == 0? COLUMN_ZERO: Bytes.toBytes("" + column); + scan.addColumn(FAMILY_NAME, qualifier); + } } else { scan.addFamily(FAMILY_NAME); } @@ -1341,7 +1346,10 @@ public class PerformanceEvaluation extends Configured implements Tool { } Get get = new Get(getRandomRow(this.rand, opts.totalRows)); if (opts.addColumns) { - get.addColumn(FAMILY_NAME, QUALIFIER_NAME); + for (int column = 0; column < opts.columns; column++) { + byte [] qualifier = column == 0? COLUMN_ZERO: Bytes.toBytes("" + column); + get.addColumn(FAMILY_NAME, qualifier); + } } else { get.addFamily(FAMILY_NAME); } @@ -1436,7 +1444,10 @@ public class PerformanceEvaluation extends Configured implements Tool { Scan scan = new Scan(format(opts.startRow)); scan.setCaching(opts.caching); if (opts.addColumns) { - scan.addColumn(FAMILY_NAME, QUALIFIER_NAME); + for (int column = 0; column < opts.columns; column++) { + byte [] qualifier = column == 0? COLUMN_ZERO: Bytes.toBytes("" + column); + scan.addColumn(FAMILY_NAME, qualifier); + } } else { scan.addFamily(FAMILY_NAME); } @@ -1569,7 +1580,10 @@ public class PerformanceEvaluation extends Configured implements Tool { void testRow(final int i) throws IOException { Get get = new Get(format(i)); if (opts.addColumns) { - get.addColumn(FAMILY_NAME, QUALIFIER_NAME); + for (int column = 0; column < opts.columns; column++) { + byte [] qualifier = column == 0? COLUMN_ZERO: Bytes.toBytes("" + column); + get.addColumn(FAMILY_NAME, qualifier); + } } if (opts.filterAll) { get.setFilter(new FilterAllFilter()); @@ -1649,7 +1663,10 @@ public class PerformanceEvaluation extends Configured implements Tool { Scan scan = new Scan(); scan.setCaching(opts.caching); if (opts.addColumns) { - scan.addColumn(FAMILY_NAME, QUALIFIER_NAME); + for (int column = 0; column < opts.columns; column++) { + byte [] qualifier = column == 0? COLUMN_ZERO: Bytes.toBytes("" + column); + scan.addColumn(FAMILY_NAME, qualifier); + } } else { scan.addFamily(FAMILY_NAME); }