public abstract class TableInputFormat<T extends Tuple> extends AbstractTableInputFormat<T>
InputFormat
subclass that wraps the access for HTables.currentRow, endReached, LOG, resultScanner, scan, scannedRows, table
Constructor and Description |
---|
TableInputFormat() |
Modifier and Type | Method and Description |
---|---|
void |
configure(Configuration parameters)
Creates a
Scan object and opens the HTable connection. |
protected abstract org.apache.hadoop.hbase.client.Scan |
getScanner()
Returns an instance of Scan that retrieves the required subset of records from the HBase table.
|
protected abstract String |
getTableName()
What table is to be read.
|
protected T |
mapResultToOutType(org.apache.hadoop.hbase.client.Result r)
HBase returns an instance of
Result . |
protected abstract T |
mapResultToTuple(org.apache.hadoop.hbase.client.Result r)
The output from HBase is always an instance of
Result . |
close, closeInputFormat, createInputSplits, getInputSplitAssigner, getStatistics, includeRegionInScan, nextRecord, open, reachedEnd
getRuntimeContext, openInputFormat, setRuntimeContext
protected abstract org.apache.hadoop.hbase.client.Scan getScanner()
getScanner
in class AbstractTableInputFormat<T extends Tuple>
protected abstract String getTableName()
getTableName
in class AbstractTableInputFormat<T extends Tuple>
protected abstract T mapResultToTuple(org.apache.hadoop.hbase.client.Result r)
Result
.
This method is to copy the data in the Result instance into the required Tuple
r
- The Result instance from HBase that needs to be convertedTuple
that contains the needed information.public void configure(Configuration parameters)
Scan
object and opens the HTable
connection.
These are opened here because they are needed in the createInputSplits
which is called before the openInputFormat method.
So the connection is opened in configure(Configuration)
and closed in AbstractTableInputFormat.closeInputFormat()
.configure
in interface InputFormat<T extends Tuple,TableInputSplit>
configure
in class AbstractTableInputFormat<T extends Tuple>
parameters
- The configuration that is to be usedConfiguration
protected T mapResultToOutType(org.apache.hadoop.hbase.client.Result r)
AbstractTableInputFormat
Result
.
This method maps the returned Result
instance into the output type T
.
mapResultToOutType
in class AbstractTableInputFormat<T extends Tuple>
r
- The Result instance from HBase that needs to be convertedT
that contains the data of Result.Copyright © 2014–2019 The Apache Software Foundation. All rights reserved.