public class HBaseRowInputFormat extends AbstractTableInputFormat<Row> implements ResultTypeQueryable<Row>
InputFormat
subclass that wraps the access for HTables. Returns the result as Row
currentRow, endReached, resultScanner, scan, scannedRows, table
Constructor and Description |
---|
HBaseRowInputFormat(Configuration conf,
String tableName,
HBaseTableSchema schema) |
Modifier and Type | Method and Description |
---|---|
void |
configure(Configuration parameters)
Creates a
Scan object and opens the HTable connection. |
TypeInformation<Row> |
getProducedType()
Gets the data type (as a
TypeInformation ) produced by this function or input format. |
protected org.apache.hadoop.hbase.client.Scan |
getScanner()
Returns an instance of Scan that retrieves the required subset of records from the HBase table.
|
String |
getTableName()
What table is to be read.
|
protected Row |
mapResultToOutType(org.apache.hadoop.hbase.client.Result res)
HBase returns an instance of
Result . |
close, closeInputFormat, createInputSplits, getInputSplitAssigner, getStatistics, includeRegionInScan, nextRecord, open, reachedEnd
getRuntimeContext, openInputFormat, setRuntimeContext
public HBaseRowInputFormat(Configuration conf, String tableName, HBaseTableSchema schema)
public void configure(Configuration parameters)
AbstractTableInputFormat
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.
The connection is opened in this method and closed in AbstractTableInputFormat.closeInputFormat()
.
configure
in interface InputFormat<Row,TableInputSplit>
configure
in class AbstractTableInputFormat<Row>
parameters
- The configuration that is to be usedConfiguration
protected org.apache.hadoop.hbase.client.Scan getScanner()
AbstractTableInputFormat
getScanner
in class AbstractTableInputFormat<Row>
public String getTableName()
AbstractTableInputFormat
Per instance of a TableInputFormat derivative only a single table name is possible.
getTableName
in class AbstractTableInputFormat<Row>
protected Row mapResultToOutType(org.apache.hadoop.hbase.client.Result res)
AbstractTableInputFormat
Result
.
This method maps the returned Result
instance into the output type T
.
mapResultToOutType
in class AbstractTableInputFormat<Row>
res
- The Result instance from HBase that needs to be convertedT
that contains the data of Result.public TypeInformation<Row> getProducedType()
ResultTypeQueryable
TypeInformation
) produced by this function or input format.getProducedType
in interface ResultTypeQueryable<Row>
Copyright © 2014–2019 The Apache Software Foundation. All rights reserved.