@Experimental public abstract class HBaseInputFormat<T extends Tuple> extends AbstractTableInputFormat<T>
InputFormat
subclass that wraps the access for HTables.connection, currentRow, endReached, LOG, resultScanner, scan, scannedRows, serializedConfig, table
Constructor and Description |
---|
HBaseInputFormat(Configuration hConf)
Constructs a
InputFormat with hbase configuration to read data from hbase. |
Modifier and Type | Method and Description |
---|---|
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 void |
initTable()
Creates a
Scan object and opens the HTable connection to initialize the HBase
table. |
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, closeTable, configure, createInputSplits, getConnection, getHadoopConfiguration, getInputSplitAssigner, getStatistics, includeRegionInScan, nextRecord, open, reachedEnd
closeInputFormat, getRuntimeContext, openInputFormat, setRuntimeContext
public HBaseInputFormat(Configuration hConf)
InputFormat
with hbase configuration to read data from hbase.hConf
- The configuration that connect to hbase. At least hbase.zookeeper.quorum and
zookeeper.znode.parent need to be set.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.protected void initTable()
AbstractTableInputFormat
Scan
object and opens the HTable
connection to initialize the HBase
table.initTable
in class AbstractTableInputFormat<T extends Tuple>
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–2021 The Apache Software Foundation. All rights reserved.