hbase git commit: HBASE-13028 Cleanup MapReduce InputFormats
Repository: hbase Updated Branches: refs/heads/branch-1.0 581770780 -> ecc7fb8ed HBASE-13028 Cleanup MapReduce InputFormats Conflicts: hbase-server/src/main/java/org/apache/hadoop/hbase/mapred/TableInputFormat.java hbase-server/src/main/java/org/apache/hadoop/hbase/mapred/TableInputFormatBase.java hbase-server/src/main/java/org/apache/hadoop/hbase/mapreduce/TableInputFormatBase.java Project: http://git-wip-us.apache.org/repos/asf/hbase/repo Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/ecc7fb8e Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/ecc7fb8e Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/ecc7fb8e Branch: refs/heads/branch-1.0 Commit: ecc7fb8ed13d8c6b68235f75a97a5e2ad24d9755 Parents: 5817707 Author: Sean Busbey Authored: Fri Feb 13 15:47:11 2015 -0600 Committer: Sean Busbey Committed: Sat Feb 14 14:32:26 2015 -0600 -- .../hadoop/hbase/mapred/TableInputFormat.java | 20 +- .../hbase/mapred/TableInputFormatBase.java | 187 --- .../hbase/mapreduce/TableInputFormat.java | 4 +- .../hbase/mapreduce/TableInputFormatBase.java | 129 - .../hbase/mapred/TestTableInputFormat.java | 72 ++- .../hbase/mapreduce/TestTableInputFormat.java | 63 +-- 6 files changed, 376 insertions(+), 99 deletions(-) -- http://git-wip-us.apache.org/repos/asf/hbase/blob/ecc7fb8e/hbase-server/src/main/java/org/apache/hadoop/hbase/mapred/TableInputFormat.java -- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/mapred/TableInputFormat.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/mapred/TableInputFormat.java index e1220fb..a7d23d4 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/mapred/TableInputFormat.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/mapred/TableInputFormat.java @@ -27,7 +27,8 @@ import org.apache.hadoop.hbase.classification.InterfaceStability; import org.apache.hadoop.fs.Path; import org.apache.hadoop.hbase.HBaseConfiguration; import org.apache.hadoop.hbase.TableName; -import org.apache.hadoop.hbase.client.HTable; +import org.apache.hadoop.hbase.client.Connection; +import org.apache.hadoop.hbase.client.ConnectionFactory; import org.apache.hadoop.hbase.util.Bytes; import org.apache.hadoop.mapred.FileInputFormat; import org.apache.hadoop.mapred.JobConf; @@ -49,6 +50,15 @@ public class TableInputFormat extends TableInputFormatBase implements public static final String COLUMN_LIST = "hbase.mapred.tablecolumns"; public void configure(JobConf job) { +try { + initialize(job); +} catch (Exception e) { + LOG.error(StringUtils.stringifyException(e)); +} + } + + @Override + protected void initialize(JobConf job) throws IOException { Path[] tableNames = FileInputFormat.getInputPaths(job); String colArg = job.get(COLUMN_LIST); String[] colNames = colArg.split(" "); @@ -57,12 +67,8 @@ public class TableInputFormat extends TableInputFormatBase implements m_cols[i] = Bytes.toBytes(colNames[i]); } setInputColumns(m_cols); -try { - setHTable( - new HTable(HBaseConfiguration.create(job), TableName.valueOf(tableNames[0].getName(; -} catch (Exception e) { - LOG.error(StringUtils.stringifyException(e)); -} +Connection connection = ConnectionFactory.createConnection(job); +initializeTable(connection, TableName.valueOf(tableNames[0].getName())); } public void validateInput(JobConf job) throws IOException { http://git-wip-us.apache.org/repos/asf/hbase/blob/ecc7fb8e/hbase-server/src/main/java/org/apache/hadoop/hbase/mapred/TableInputFormatBase.java -- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/mapred/TableInputFormatBase.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/mapred/TableInputFormatBase.java index b181dac..da457cf 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/mapred/TableInputFormatBase.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/mapred/TableInputFormatBase.java @@ -18,6 +18,7 @@ */ package org.apache.hadoop.hbase.mapred; +import java.io.Closeable; import java.io.IOException; import org.apache.commons.logging.Log; @@ -25,8 +26,11 @@ import org.apache.commons.logging.LogFactory; import org.apache.hadoop.hbase.classification.InterfaceAudience; import org.apache.hadoop.hbase.classification.InterfaceStability; import org.apache.hadoop.hbase.HConstants; +import org.apache.hadoop.hbase.TableName; +import org.apache.hadoop.hbase.client.Connection; import org.apache.hadoop.hbase.client.HTable; import org.apache.hadoop.hbase.client.Result; +import org.apache.hadoop.hbase.cli
hbase git commit: HBASE-13028 Cleanup MapReduce InputFormats
Repository: hbase Updated Branches: refs/heads/branch-1 05e0b46d5 -> 4d0de57a7 HBASE-13028 Cleanup MapReduce InputFormats Conflicts: hbase-server/src/main/java/org/apache/hadoop/hbase/mapred/TableInputFormat.java hbase-server/src/main/java/org/apache/hadoop/hbase/mapred/TableInputFormatBase.java hbase-server/src/main/java/org/apache/hadoop/hbase/mapreduce/TableInputFormatBase.java Project: http://git-wip-us.apache.org/repos/asf/hbase/repo Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/4d0de57a Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/4d0de57a Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/4d0de57a Branch: refs/heads/branch-1 Commit: 4d0de57a77e3270b8d84f9121af7cc2b65533a33 Parents: 05e0b46 Author: Sean Busbey Authored: Fri Feb 13 15:47:11 2015 -0600 Committer: Sean Busbey Committed: Sat Feb 14 14:17:46 2015 -0600 -- .../hadoop/hbase/mapred/TableInputFormat.java | 20 +- .../hbase/mapred/TableInputFormatBase.java | 187 --- .../hbase/mapreduce/TableInputFormat.java | 4 +- .../hbase/mapreduce/TableInputFormatBase.java | 129 - .../hbase/mapred/TestTableInputFormat.java | 72 ++- .../hbase/mapreduce/TestTableInputFormat.java | 63 +-- 6 files changed, 376 insertions(+), 99 deletions(-) -- http://git-wip-us.apache.org/repos/asf/hbase/blob/4d0de57a/hbase-server/src/main/java/org/apache/hadoop/hbase/mapred/TableInputFormat.java -- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/mapred/TableInputFormat.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/mapred/TableInputFormat.java index e1220fb..a7d23d4 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/mapred/TableInputFormat.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/mapred/TableInputFormat.java @@ -27,7 +27,8 @@ import org.apache.hadoop.hbase.classification.InterfaceStability; import org.apache.hadoop.fs.Path; import org.apache.hadoop.hbase.HBaseConfiguration; import org.apache.hadoop.hbase.TableName; -import org.apache.hadoop.hbase.client.HTable; +import org.apache.hadoop.hbase.client.Connection; +import org.apache.hadoop.hbase.client.ConnectionFactory; import org.apache.hadoop.hbase.util.Bytes; import org.apache.hadoop.mapred.FileInputFormat; import org.apache.hadoop.mapred.JobConf; @@ -49,6 +50,15 @@ public class TableInputFormat extends TableInputFormatBase implements public static final String COLUMN_LIST = "hbase.mapred.tablecolumns"; public void configure(JobConf job) { +try { + initialize(job); +} catch (Exception e) { + LOG.error(StringUtils.stringifyException(e)); +} + } + + @Override + protected void initialize(JobConf job) throws IOException { Path[] tableNames = FileInputFormat.getInputPaths(job); String colArg = job.get(COLUMN_LIST); String[] colNames = colArg.split(" "); @@ -57,12 +67,8 @@ public class TableInputFormat extends TableInputFormatBase implements m_cols[i] = Bytes.toBytes(colNames[i]); } setInputColumns(m_cols); -try { - setHTable( - new HTable(HBaseConfiguration.create(job), TableName.valueOf(tableNames[0].getName(; -} catch (Exception e) { - LOG.error(StringUtils.stringifyException(e)); -} +Connection connection = ConnectionFactory.createConnection(job); +initializeTable(connection, TableName.valueOf(tableNames[0].getName())); } public void validateInput(JobConf job) throws IOException { http://git-wip-us.apache.org/repos/asf/hbase/blob/4d0de57a/hbase-server/src/main/java/org/apache/hadoop/hbase/mapred/TableInputFormatBase.java -- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/mapred/TableInputFormatBase.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/mapred/TableInputFormatBase.java index b181dac..da457cf 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/mapred/TableInputFormatBase.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/mapred/TableInputFormatBase.java @@ -18,6 +18,7 @@ */ package org.apache.hadoop.hbase.mapred; +import java.io.Closeable; import java.io.IOException; import org.apache.commons.logging.Log; @@ -25,8 +26,11 @@ import org.apache.commons.logging.LogFactory; import org.apache.hadoop.hbase.classification.InterfaceAudience; import org.apache.hadoop.hbase.classification.InterfaceStability; import org.apache.hadoop.hbase.HConstants; +import org.apache.hadoop.hbase.TableName; +import org.apache.hadoop.hbase.client.Connection; import org.apache.hadoop.hbase.client.HTable; import org.apache.hadoop.hbase.client.Result; +import org.apache.hadoop.hbase.client.
hbase git commit: HBASE-13028 Cleanup MapReduce InputFormats
Repository: hbase Updated Branches: refs/heads/master 6f904fe4c -> 332515ed3 HBASE-13028 Cleanup MapReduce InputFormats Project: http://git-wip-us.apache.org/repos/asf/hbase/repo Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/332515ed Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/332515ed Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/332515ed Branch: refs/heads/master Commit: 332515ed346e1ffc104ce3bac986bb7030747a03 Parents: 6f904fe Author: Sean Busbey Authored: Fri Feb 13 15:47:11 2015 -0600 Committer: Sean Busbey Committed: Sat Feb 14 14:13:36 2015 -0600 -- .../hadoop/hbase/mapred/TableInputFormat.java | 18 +- .../hbase/mapred/TableInputFormatBase.java | 186 --- .../hbase/mapreduce/TableInputFormat.java | 4 +- .../hbase/mapreduce/TableInputFormatBase.java | 119 +++- .../hbase/mapred/TestTableInputFormat.java | 72 ++- .../hbase/mapreduce/TestTableInputFormat.java | 63 +-- 6 files changed, 364 insertions(+), 98 deletions(-) -- http://git-wip-us.apache.org/repos/asf/hbase/blob/332515ed/hbase-server/src/main/java/org/apache/hadoop/hbase/mapred/TableInputFormat.java -- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/mapred/TableInputFormat.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/mapred/TableInputFormat.java index 368510f..814daea 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/mapred/TableInputFormat.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/mapred/TableInputFormat.java @@ -28,7 +28,6 @@ import org.apache.hadoop.fs.Path; import org.apache.hadoop.hbase.TableName; import org.apache.hadoop.hbase.client.Connection; import org.apache.hadoop.hbase.client.ConnectionFactory; -import org.apache.hadoop.hbase.client.HTable; import org.apache.hadoop.hbase.util.Bytes; import org.apache.hadoop.mapred.FileInputFormat; import org.apache.hadoop.mapred.JobConf; @@ -50,6 +49,15 @@ public class TableInputFormat extends TableInputFormatBase implements public static final String COLUMN_LIST = "hbase.mapred.tablecolumns"; public void configure(JobConf job) { +try { + initialize(job); +} catch (Exception e) { + LOG.error(StringUtils.stringifyException(e)); +} + } + + @Override + protected void initialize(JobConf job) throws IOException { Path[] tableNames = FileInputFormat.getInputPaths(job); String colArg = job.get(COLUMN_LIST); String[] colNames = colArg.split(" "); @@ -58,12 +66,8 @@ public class TableInputFormat extends TableInputFormatBase implements m_cols[i] = Bytes.toBytes(colNames[i]); } setInputColumns(m_cols); -try { - Connection connection = ConnectionFactory.createConnection(job); - setHTable((HTable) connection.getTable(TableName.valueOf(tableNames[0].getName(; -} catch (Exception e) { - LOG.error(StringUtils.stringifyException(e)); -} +Connection connection = ConnectionFactory.createConnection(job); +initializeTable(connection, TableName.valueOf(tableNames[0].getName())); } public void validateInput(JobConf job) throws IOException { http://git-wip-us.apache.org/repos/asf/hbase/blob/332515ed/hbase-server/src/main/java/org/apache/hadoop/hbase/mapred/TableInputFormatBase.java -- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/mapred/TableInputFormatBase.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/mapred/TableInputFormatBase.java index d98b5f4..b5b79d2 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/mapred/TableInputFormatBase.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/mapred/TableInputFormatBase.java @@ -18,6 +18,7 @@ */ package org.apache.hadoop.hbase.mapred; +import java.io.Closeable; import java.io.IOException; import org.apache.commons.logging.Log; @@ -25,6 +26,8 @@ import org.apache.commons.logging.LogFactory; import org.apache.hadoop.hbase.classification.InterfaceAudience; import org.apache.hadoop.hbase.classification.InterfaceStability; import org.apache.hadoop.hbase.HConstants; +import org.apache.hadoop.hbase.TableName; +import org.apache.hadoop.hbase.client.Connection; import org.apache.hadoop.hbase.client.HTable; import org.apache.hadoop.hbase.client.Result; import org.apache.hadoop.hbase.client.Table; @@ -40,28 +43,35 @@ import org.apache.hadoop.mapred.Reporter; * A Base for {@link TableInputFormat}s. Receives a {@link HTable}, a * byte[] of input columns and optionally a {@link Filter}. * Subclasses may use other TableRecordReader implementations. + * + * Subclasses MUST ensure initializeTable(Connection, TableName) is called for an instance to + * f