@Internal
public class HBaseRowInputFormat
extends org.apache.flink.api.common.io.RichInputFormat<T,org.apache.flink.connector.hbase.source.TableInputSplit>
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| Modifier and Type | Field and Description |
|---|---|
protected byte[] |
currentRow |
protected boolean |
endReached |
protected org.apache.hadoop.hbase.client.ResultScanner |
resultScanner
HBase iterator wrapper.
|
protected org.apache.hadoop.hbase.client.Scan |
scan |
protected long |
scannedRows |
protected byte[] |
serializedConfig |
protected org.apache.hadoop.hbase.client.HTable |
table |
| Constructor and Description |
|---|
HBaseRowInputFormat(org.apache.hadoop.conf.Configuration conf,
String tableName,
HBaseTableSchema schema) |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
void |
closeInputFormat() |
void |
configure(org.apache.flink.configuration.Configuration parameters)
Creates a
Scan object and opens the HTable connection. |
org.apache.flink.connector.hbase.source.TableInputSplit[] |
createInputSplits(int minNumSplits) |
protected org.apache.hadoop.conf.Configuration |
getHadoopConfiguration() |
org.apache.flink.core.io.InputSplitAssigner |
getInputSplitAssigner(org.apache.flink.connector.hbase.source.TableInputSplit[] inputSplits) |
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.
|
org.apache.flink.api.common.io.statistics.BaseStatistics |
getStatistics(org.apache.flink.api.common.io.statistics.BaseStatistics cachedStatistics) |
String |
getTableName()
What table is to be read.
|
protected boolean |
includeRegionInScan(byte[] startKey,
byte[] endKey)
Test if the given region is to be included in the scan while splitting the regions of a
table.
|
protected org.apache.flink.types.Row |
mapResultToOutType(org.apache.hadoop.hbase.client.Result res)
HBase returns an instance of
Result. |
T |
nextRecord(T reuse) |
void |
open(org.apache.flink.connector.hbase.source.TableInputSplit split) |
boolean |
reachedEnd() |
protected boolean endReached
protected transient org.apache.hadoop.hbase.client.HTable table
protected transient org.apache.hadoop.hbase.client.Scan scan
protected org.apache.hadoop.hbase.client.ResultScanner resultScanner
protected byte[] currentRow
protected long scannedRows
protected byte[] serializedConfig
public HBaseRowInputFormat(org.apache.hadoop.conf.Configuration conf,
String tableName,
HBaseTableSchema schema)
public void configure(org.apache.flink.configuration.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.
The connection is opened in this method and closed in closeInputFormat().
configure in interface org.apache.flink.api.common.io.InputFormat<org.apache.flink.types.Row,org.apache.flink.connector.hbase.source.TableInputSplit>parameters - The configuration that is to be usedConfigurationprotected org.apache.hadoop.hbase.client.Scan getScanner()
public String getTableName()
Per instance of a TableInputFormat derivative only a single table name is possible.
protected org.apache.flink.types.Row mapResultToOutType(org.apache.hadoop.hbase.client.Result res)
Result.
This method maps the returned Result instance into the output type T.
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>protected org.apache.hadoop.conf.Configuration getHadoopConfiguration()
public void open(org.apache.flink.connector.hbase.source.TableInputSplit split)
throws IOException
IOExceptionpublic T nextRecord(T reuse)
throws IOException
IOExceptionpublic boolean reachedEnd()
throws IOException
IOExceptionpublic void close()
throws IOException
IOExceptionpublic void closeInputFormat()
throws IOException
closeInputFormat in class org.apache.flink.api.common.io.RichInputFormat<T,org.apache.flink.connector.hbase.source.TableInputSplit>IOExceptionpublic org.apache.flink.connector.hbase.source.TableInputSplit[] createInputSplits(int minNumSplits)
throws IOException
IOExceptionprotected boolean includeRegionInScan(byte[] startKey,
byte[] endKey)
startKey - Start key of the regionendKey - End key of the regionpublic org.apache.flink.core.io.InputSplitAssigner getInputSplitAssigner(org.apache.flink.connector.hbase.source.TableInputSplit[] inputSplits)
public org.apache.flink.api.common.io.statistics.BaseStatistics getStatistics(org.apache.flink.api.common.io.statistics.BaseStatistics cachedStatistics)
Copyright © 2014–2021 The Apache Software Foundation. All rights reserved.