HBASE-3769 TableMapReduceUtil is inconsistent with other table-related classes that accept byte[] as a table name

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1091643 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Stack 2011-04-13 04:29:56 +00:00
parent 08cb49b04d
commit 40eb8bcc32
2 changed files with 51 additions and 0 deletions

View File

@ -151,6 +151,8 @@ Release 0.91.0 - Unreleased
HBASE-3764 Book.xml - adding 2 FAQs (SQL and arch question) HBASE-3764 Book.xml - adding 2 FAQs (SQL and arch question)
HBASE-3770 Make FilterList accept var arg Filters in its constructor HBASE-3770 Make FilterList accept var arg Filters in its constructor
as a convenience (Erik Onnen via Stack) as a convenience (Erik Onnen via Stack)
HBASE-3769 TableMapReduceUtil is inconsistent with other table-related
classes that accept byte[] as a table name (Erik Onnen via Stack)
TASKS TASKS
HBASE-3559 Move report of split to master OFF the heartbeat channel HBASE-3559 Move report of split to master OFF the heartbeat channel

View File

@ -41,6 +41,7 @@ import org.apache.hadoop.hbase.client.HTable;
import org.apache.hadoop.hbase.client.Scan; import org.apache.hadoop.hbase.client.Scan;
import org.apache.hadoop.hbase.io.ImmutableBytesWritable; import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
import org.apache.hadoop.hbase.util.Base64; import org.apache.hadoop.hbase.util.Base64;
import org.apache.hadoop.hbase.util.Bytes;
import org.apache.hadoop.hbase.zookeeper.ZKUtil; import org.apache.hadoop.hbase.zookeeper.ZKUtil;
import org.apache.hadoop.io.Writable; import org.apache.hadoop.io.Writable;
import org.apache.hadoop.io.WritableComparable; import org.apache.hadoop.io.WritableComparable;
@ -76,6 +77,29 @@ public class TableMapReduceUtil {
job, true); job, true);
} }
/**
* Use this before submitting a TableMap job. It will appropriately set up
* the job.
*
* @param table Binary representation of the table name to read from.
* @param scan The scan instance with the columns, time range etc.
* @param mapper The mapper class to use.
* @param outputKeyClass The class of the output key.
* @param outputValueClass The class of the output value.
* @param job The current job to adjust. Make sure the passed job is
* carrying all necessary HBase configuration.
* @throws IOException When setting up the details fails.
*/
public static void initTableMapperJob(byte[] table, Scan scan,
Class<? extends TableMapper> mapper,
Class<? extends WritableComparable> outputKeyClass,
Class<? extends Writable> outputValueClass, Job job)
throws IOException {
initTableMapperJob(Bytes.toString(table), scan, mapper, outputKeyClass, outputValueClass,
job, true);
}
/** /**
* Use this before submitting a TableMap job. It will appropriately set up * Use this before submitting a TableMap job. It will appropriately set up
* the job. * the job.
@ -110,6 +134,31 @@ public class TableMapReduceUtil {
} }
} }
/**
* Use this before submitting a TableMap job. It will appropriately set up
* the job.
*
* @param table Binary representation of the table name to read from.
* @param scan The scan instance with the columns, time range etc.
* @param mapper The mapper class to use.
* @param outputKeyClass The class of the output key.
* @param outputValueClass The class of the output value.
* @param job The current job to adjust. Make sure the passed job is
* carrying all necessary HBase configuration.
* @param addDependencyJars upload HBase jars and jars for any of the configured
* job classes via the distributed cache (tmpjars).
* @throws IOException When setting up the details fails.
*/
public static void initTableMapperJob(byte[] table, Scan scan,
Class<? extends TableMapper> mapper,
Class<? extends WritableComparable> outputKeyClass,
Class<? extends Writable> outputValueClass, Job job,
boolean addDependencyJars)
throws IOException {
initTableMapperJob(Bytes.toString(table), scan, mapper, outputKeyClass,
outputValueClass, job, addDependencyJars);
}
/** /**
* Writes the given scan into a Base64 encoded string. * Writes the given scan into a Base64 encoded string.
* *