From ee3c65fb58c1a19212f35172e45c1a491a97361f Mon Sep 17 00:00:00 2001 From: Michael Stack Date: Tue, 30 Mar 2010 06:18:37 +0000 Subject: [PATCH] HBASE-2374 TableInputFormat - Configurable parameter to add column families git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@929006 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES.txt | 2 ++ .../hadoop/hbase/mapreduce/TableInputFormat.java | 11 ++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/CHANGES.txt b/CHANGES.txt index 5463e58cb30..708f0baac06 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -467,6 +467,8 @@ Release 0.21.0 - Unreleased HBASE-2389 HTable - delete / put unnecessary sync (Kay Kay via Stack) HBASE-2385 Debug Message "Received report from unknown server" should be INFO or WARN + HBASE-2374 TableInputFormat - Configurable parameter to add column families + (Kay Kay via Stack) NEW FEATURES HBASE-1961 HBase EC2 scripts diff --git a/core/src/main/java/org/apache/hadoop/hbase/mapreduce/TableInputFormat.java b/core/src/main/java/org/apache/hadoop/hbase/mapreduce/TableInputFormat.java index 7dba46cc028..5d26324c1a5 100644 --- a/core/src/main/java/org/apache/hadoop/hbase/mapreduce/TableInputFormat.java +++ b/core/src/main/java/org/apache/hadoop/hbase/mapreduce/TableInputFormat.java @@ -28,6 +28,7 @@ import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hbase.HBaseConfiguration; import org.apache.hadoop.hbase.client.HTable; import org.apache.hadoop.hbase.client.Scan; +import org.apache.hadoop.hbase.util.Bytes; import org.apache.hadoop.util.StringUtils; /** @@ -40,8 +41,12 @@ implements Configurable { /** Job parameter that specifies the input table. */ public static final String INPUT_TABLE = "hbase.mapreduce.inputtable"; - /** Base-64 encoded scanner. All other SCAN_ confs are ignored if this is specified. */ + /** Base-64 encoded scanner. All other SCAN_ confs are ignored if this is specified. + * See {@link TableMapReduceUtil#convertScanToString(Scan)} for more details. + */ public static final String SCAN = "hbase.mapreduce.scan"; + /** Column Family to Scan */ + public static final String SCAN_COLUMN_FAMILY = "hbase.mapreduce.scan.column.family"; /** Space delimited list of columns to scan. */ public static final String SCAN_COLUMNS = "hbase.mapreduce.scan.columns"; /** The timestamp used to filter columns with a specific timestamp. */ @@ -105,6 +110,10 @@ implements Configurable { scan.addColumns(conf.get(SCAN_COLUMNS)); } + if (conf.get(SCAN_COLUMN_FAMILY) != null) { + scan.addFamily(Bytes.toBytes(conf.get(SCAN_COLUMN_FAMILY))); + } + if (conf.get(SCAN_TIMESTAMP) != null) { scan.setTimeStamp(Long.parseLong(conf.get(SCAN_TIMESTAMP))); }