|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.hadoop.hbase.mapred.TableInputFormatBase
public abstract class TableInputFormatBase
A Base for TableInputFormat
s. Receives a HTable
, a
Text
[] of input columns and optionally a RowFilterInterface
.
Subclasses may use other TableRecordReader implementations.
An example of a subclass:
class ExampleTIF extends TableInputFormatBase implements JobConfigurable {
public void configure(JobConf job) {
HTable exampleTable = new HTable(new HBaseConfiguration(job),
Bytes.toBytes("exampleTable"));
// mandatory
setHTable(exampleTable);
Text[] inputColumns = new byte [][] { Bytes.toBytes("columnA"),
Bytes.toBytes("columnB") };
// mandatory
setInputColums(inputColumns);
RowFilterInterface exampleFilter = new RegExpRowFilter("keyPrefix.*");
// optional
setRowFilter(exampleFilter);
}
public void validateInput(JobConf job) throws IOException {
}
}
Nested Class Summary | |
---|---|
protected class |
TableInputFormatBase.TableRecordReader
Iterate over an HBase table data, return (Text, RowResult) pairs |
Constructor Summary | |
---|---|
TableInputFormatBase()
|
Method Summary | |
---|---|
org.apache.hadoop.mapred.RecordReader<ImmutableBytesWritable,RowResult> |
getRecordReader(org.apache.hadoop.mapred.InputSplit split,
org.apache.hadoop.mapred.JobConf job,
org.apache.hadoop.mapred.Reporter reporter)
Builds a TableRecordReader. |
org.apache.hadoop.mapred.InputSplit[] |
getSplits(org.apache.hadoop.mapred.JobConf job,
int numSplits)
Calculates the splits that will serve as input for the map tasks. |
protected void |
setHTable(HTable table)
Allows subclasses to set the HTable . |
protected void |
setInputColums(byte[][] inputColumns)
|
protected void |
setRowFilter(RowFilterInterface rowFilter)
Allows subclasses to set the RowFilterInterface to be used. |
protected void |
setTableRecordReader(TableInputFormatBase.TableRecordReader tableRecordReader)
Allows subclasses to set the TableInputFormatBase.TableRecordReader . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.apache.hadoop.mapred.InputFormat |
---|
validateInput |
Constructor Detail |
---|
public TableInputFormatBase()
Method Detail |
---|
public org.apache.hadoop.mapred.RecordReader<ImmutableBytesWritable,RowResult> getRecordReader(org.apache.hadoop.mapred.InputSplit split, org.apache.hadoop.mapred.JobConf job, org.apache.hadoop.mapred.Reporter reporter) throws IOException
getRecordReader
in interface org.apache.hadoop.mapred.InputFormat<ImmutableBytesWritable,RowResult>
IOException
InputFormat.getRecordReader(InputSplit,
JobConf, Reporter)
public org.apache.hadoop.mapred.InputSplit[] getSplits(org.apache.hadoop.mapred.JobConf job, int numSplits) throws IOException
HRegion
s in the table. If the number of splits is
smaller than the number of HRegion
s then splits are spanned across
multiple HRegion
s and are grouped the most evenly possible. In the
case splits are uneven the bigger splits are placed first in the
InputSplit
array.
getSplits
in interface org.apache.hadoop.mapred.InputFormat<ImmutableBytesWritable,RowResult>
job
- the map task JobConf
numSplits
- a hint to calculate the number of splits
IOException
InputFormat.getSplits(org.apache.hadoop.mapred.JobConf, int)
protected void setInputColums(byte[][] inputColumns)
inputColumns
- to be passed in RowResult
to the map task.protected void setHTable(HTable table)
HTable
.
table
- to get the data fromprotected void setTableRecordReader(TableInputFormatBase.TableRecordReader tableRecordReader)
TableInputFormatBase.TableRecordReader
.
tableRecordReader
- to provide other TableInputFormatBase.TableRecordReader
implementations.protected void setRowFilter(RowFilterInterface rowFilter)
RowFilterInterface
to be used.
rowFilter
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |