public class HBaseRowInputFormat extends AbstractTableInputFormat<org.apache.flink.types.Row> implements org.apache.flink.api.java.typeutils.ResultTypeQueryable<org.apache.flink.types.Row>
InputFormat
subclass that wraps the access for HTables. Returns the result as Row
currentRow, endReached, resultScanner, scan, scannedRows, table
Constructor and Description |
---|
HBaseRowInputFormat(org.apache.hadoop.conf.Configuration conf,
String tableName,
HBaseTableSchema schema) |
Modifier and Type | Method and Description |
---|---|
void |
configure(org.apache.flink.configuration.Configuration parameters)
Creates a
Scan object and opens the HTable connection. |
org.apache.flink.api.common.typeinfo.TypeInformation<org.apache.flink.types.Row> |
getProducedType() |
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 org.apache.flink.types.Row |
mapResultToOutType(org.apache.hadoop.hbase.client.Result res)
HBase returns an instance of
Result . |
close, closeInputFormat, createInputSplits, getInputSplitAssigner, getStatistics, includeRegionInScan, nextRecord, open, reachedEnd
public HBaseRowInputFormat(org.apache.hadoop.conf.Configuration conf, String tableName, HBaseTableSchema schema)
public void configure(org.apache.flink.configuration.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 org.apache.flink.api.common.io.InputFormat<org.apache.flink.types.Row,TableInputSplit>
configure
in class AbstractTableInputFormat<org.apache.flink.types.Row>
parameters
- The configuration that is to be usedConfiguration
protected org.apache.hadoop.hbase.client.Scan getScanner()
AbstractTableInputFormat
getScanner
in class AbstractTableInputFormat<org.apache.flink.types.Row>
public String getTableName()
AbstractTableInputFormat
Per instance of a TableInputFormat derivative only a single table name is possible.
getTableName
in class AbstractTableInputFormat<org.apache.flink.types.Row>
protected org.apache.flink.types.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<org.apache.flink.types.Row>
res
- The Result instance from HBase that needs to be convertedT
that contains the data of Result.public org.apache.flink.api.common.typeinfo.TypeInformation<org.apache.flink.types.Row> getProducedType()
getProducedType
in interface org.apache.flink.api.java.typeutils.ResultTypeQueryable<org.apache.flink.types.Row>
Copyright © 2014–2018 The Apache Software Foundation. All rights reserved.