@Internal
public abstract class AbstractTableInputFormat<T>
extends org.apache.flink.api.common.io.RichInputFormat<T,org.apache.flink.connector.hbase.source.TableInputSplit>
InputFormat to read data from HBase tables.| 限定符和类型 | 字段和说明 |
|---|---|
protected org.apache.hadoop.hbase.client.Connection |
connection |
protected byte[] |
currentRow |
protected boolean |
endReached |
protected static org.slf4j.Logger |
LOG |
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 |
| 构造器和说明 |
|---|
AbstractTableInputFormat(org.apache.hadoop.conf.Configuration hConf) |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
close() |
void |
closeTable() |
void |
configure(org.apache.flink.configuration.Configuration parameters) |
org.apache.flink.connector.hbase.source.TableInputSplit[] |
createInputSplits(int minNumSplits) |
org.apache.hadoop.hbase.client.Connection |
getConnection() |
protected org.apache.hadoop.conf.Configuration |
getHadoopConfiguration() |
org.apache.flink.core.io.InputSplitAssigner |
getInputSplitAssigner(org.apache.flink.connector.hbase.source.TableInputSplit[] inputSplits) |
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.
|
org.apache.flink.api.common.io.statistics.BaseStatistics |
getStatistics(org.apache.flink.api.common.io.statistics.BaseStatistics cachedStatistics) |
protected abstract 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 abstract void |
initTable()
Creates a
Scan object and opens the HTable connection to initialize the HBase
table. |
protected abstract T |
mapResultToOutType(org.apache.hadoop.hbase.client.Result r)
HBase returns an instance of
Result. |
T |
nextRecord(T reuse) |
void |
open(org.apache.flink.connector.hbase.source.TableInputSplit split)
Creates a
Scan object and opens the HTable connection. |
boolean |
reachedEnd() |
protected static final org.slf4j.Logger LOG
protected boolean endReached
protected transient org.apache.hadoop.hbase.client.Connection connection
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 AbstractTableInputFormat(org.apache.hadoop.conf.Configuration hConf)
protected abstract void initTable()
throws IOException
Scan object and opens the HTable connection to initialize the HBase
table.IOException - Thrown, if the connection could not be opened due to an I/O problem.protected abstract org.apache.hadoop.hbase.client.Scan getScanner()
protected abstract String getTableName()
Per instance of a TableInputFormat derivative only a single table name is possible.
protected abstract T mapResultToOutType(org.apache.hadoop.hbase.client.Result r)
Result.
This method maps the returned Result instance into the output type T.
r - The Result instance from HBase that needs to be convertedT that contains the data of Result.public void configure(org.apache.flink.configuration.Configuration parameters)
protected org.apache.hadoop.conf.Configuration getHadoopConfiguration()
public void open(org.apache.flink.connector.hbase.source.TableInputSplit split)
throws IOException
Scan object and opens the HTable connection. The connection is
opened in this method and closed in close().split - The split to be opened.IOException - Thrown, if the spit could not be opened due to an I/O problem.public T nextRecord(T reuse) throws IOException
IOExceptionpublic boolean reachedEnd()
throws IOException
IOExceptionpublic void close()
throws IOException
IOExceptionpublic void closeTable()
public 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)
@VisibleForTesting public org.apache.hadoop.hbase.client.Connection getConnection()
Copyright © 2014–2023 The Apache Software Foundation. All rights reserved.