public abstract class TableInputFormat<T extends org.apache.flink.api.java.tuple.Tuple> extends AbstractTableInputFormat<T>
InputFormat
subclass that wraps the access for HTables.currentRow, endReached, LOG, resultScanner, scan, scannedRows, table
Constructor and Description |
---|
TableInputFormat() |
Modifier and Type | Method and Description |
---|---|
void |
configure(org.apache.flink.configuration.Configuration parameters)
Creates a
Scan object and opens the HTable connection. |
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 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, closeInputFormat, createInputSplits, getInputSplitAssigner, getStatistics, includeRegionInScan, nextRecord, open, reachedEnd
protected abstract org.apache.hadoop.hbase.client.Scan getScanner()
getScanner
in class AbstractTableInputFormat<T extends org.apache.flink.api.java.tuple.Tuple>
protected abstract String getTableName()
getTableName
in class AbstractTableInputFormat<T extends org.apache.flink.api.java.tuple.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.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.
So the connection is opened in configure(Configuration)
and closed in AbstractTableInputFormat.closeInputFormat()
.configure
in interface org.apache.flink.api.common.io.InputFormat<T extends org.apache.flink.api.java.tuple.Tuple,TableInputSplit>
configure
in class AbstractTableInputFormat<T extends org.apache.flink.api.java.tuple.Tuple>
parameters
- The configuration that is to be usedConfiguration
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 org.apache.flink.api.java.tuple.Tuple>
r
- The Result instance from HBase that needs to be convertedT
that contains the data of Result.Copyright © 2014–2017 The Apache Software Foundation. All rights reserved.