Class JdbcRowDataInputFormat
- java.lang.Object
-
- org.apache.flink.api.common.io.RichInputFormat<org.apache.flink.table.data.RowData,org.apache.flink.core.io.InputSplit>
-
- org.apache.flink.connector.jdbc.table.JdbcRowDataInputFormat
-
- All Implemented Interfaces:
Serializable,org.apache.flink.api.common.io.InputFormat<org.apache.flink.table.data.RowData,org.apache.flink.core.io.InputSplit>,org.apache.flink.api.java.typeutils.ResultTypeQueryable<org.apache.flink.table.data.RowData>,org.apache.flink.core.io.InputSplitSource<org.apache.flink.core.io.InputSplit>
@Internal public class JdbcRowDataInputFormat extends org.apache.flink.api.common.io.RichInputFormat<org.apache.flink.table.data.RowData,org.apache.flink.core.io.InputSplit> implements org.apache.flink.api.java.typeutils.ResultTypeQueryable<org.apache.flink.table.data.RowData>InputFormat forJdbcDynamicTableSource.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classJdbcRowDataInputFormat.BuilderBuilder forJdbcRowDataInputFormat.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static JdbcRowDataInputFormat.Builderbuilder()A builder used to set parameters to the output format's configuration in a fluent way.voidclose()Closes all resources used.voidcloseInputFormat()voidconfigure(org.apache.flink.configuration.Configuration parameters)org.apache.flink.core.io.InputSplit[]createInputSplits(int minNumSplits)org.apache.flink.core.io.InputSplitAssignergetInputSplitAssigner(org.apache.flink.core.io.InputSplit[] inputSplits)org.apache.flink.api.common.typeinfo.TypeInformation<org.apache.flink.table.data.RowData>getProducedType()org.apache.flink.api.common.io.statistics.BaseStatisticsgetStatistics(org.apache.flink.api.common.io.statistics.BaseStatistics cachedStatistics)org.apache.flink.table.data.RowDatanextRecord(org.apache.flink.table.data.RowData reuse)Stores the next resultSet row in a tuple.voidopen(org.apache.flink.core.io.InputSplit inputSplit)Connects to the source database and executes the query in a parallel fashion if thisInputFormatis built using a parameterized query (i.e.voidopenInputFormat()booleanreachedEnd()Checks whether all data has been read.
-
-
-
Method Detail
-
configure
public void configure(org.apache.flink.configuration.Configuration parameters)
- Specified by:
configurein interfaceorg.apache.flink.api.common.io.InputFormat<org.apache.flink.table.data.RowData,org.apache.flink.core.io.InputSplit>
-
openInputFormat
public void openInputFormat()
- Overrides:
openInputFormatin classorg.apache.flink.api.common.io.RichInputFormat<org.apache.flink.table.data.RowData,org.apache.flink.core.io.InputSplit>
-
closeInputFormat
public void closeInputFormat()
- Overrides:
closeInputFormatin classorg.apache.flink.api.common.io.RichInputFormat<org.apache.flink.table.data.RowData,org.apache.flink.core.io.InputSplit>
-
open
public void open(org.apache.flink.core.io.InputSplit inputSplit) throws IOExceptionConnects to the source database and executes the query in a parallel fashion if thisInputFormatis built using a parameterized query (i.e. using aPreparedStatement) and a properJdbcParameterValuesProvider, in a non-parallel fashion otherwise.- Specified by:
openin interfaceorg.apache.flink.api.common.io.InputFormat<org.apache.flink.table.data.RowData,org.apache.flink.core.io.InputSplit>- Parameters:
inputSplit- which is ignored if this InputFormat is executed as a non-parallel source, a "hook" to the query parameters otherwise (using its splitNumber)- Throws:
IOException- if there's an error during the execution of the query
-
close
public void close() throws IOExceptionCloses all resources used.- Specified by:
closein interfaceorg.apache.flink.api.common.io.InputFormat<org.apache.flink.table.data.RowData,org.apache.flink.core.io.InputSplit>- Throws:
IOException- Indicates that a resource could not be closed.
-
getProducedType
public org.apache.flink.api.common.typeinfo.TypeInformation<org.apache.flink.table.data.RowData> getProducedType()
- Specified by:
getProducedTypein interfaceorg.apache.flink.api.java.typeutils.ResultTypeQueryable<org.apache.flink.table.data.RowData>
-
reachedEnd
public boolean reachedEnd() throws IOExceptionChecks whether all data has been read.- Specified by:
reachedEndin interfaceorg.apache.flink.api.common.io.InputFormat<org.apache.flink.table.data.RowData,org.apache.flink.core.io.InputSplit>- Returns:
- boolean value indication whether all data has been read.
- Throws:
IOException
-
nextRecord
public org.apache.flink.table.data.RowData nextRecord(org.apache.flink.table.data.RowData reuse) throws IOExceptionStores the next resultSet row in a tuple.- Specified by:
nextRecordin interfaceorg.apache.flink.api.common.io.InputFormat<org.apache.flink.table.data.RowData,org.apache.flink.core.io.InputSplit>- Parameters:
reuse- row to be reused.- Returns:
- row containing next
RowData - Throws:
IOException
-
getStatistics
public org.apache.flink.api.common.io.statistics.BaseStatistics getStatistics(org.apache.flink.api.common.io.statistics.BaseStatistics cachedStatistics) throws IOException- Specified by:
getStatisticsin interfaceorg.apache.flink.api.common.io.InputFormat<org.apache.flink.table.data.RowData,org.apache.flink.core.io.InputSplit>- Throws:
IOException
-
createInputSplits
public org.apache.flink.core.io.InputSplit[] createInputSplits(int minNumSplits) throws IOException- Specified by:
createInputSplitsin interfaceorg.apache.flink.api.common.io.InputFormat<org.apache.flink.table.data.RowData,org.apache.flink.core.io.InputSplit>- Specified by:
createInputSplitsin interfaceorg.apache.flink.core.io.InputSplitSource<org.apache.flink.core.io.InputSplit>- Throws:
IOException
-
getInputSplitAssigner
public org.apache.flink.core.io.InputSplitAssigner getInputSplitAssigner(org.apache.flink.core.io.InputSplit[] inputSplits)
- Specified by:
getInputSplitAssignerin interfaceorg.apache.flink.api.common.io.InputFormat<org.apache.flink.table.data.RowData,org.apache.flink.core.io.InputSplit>- Specified by:
getInputSplitAssignerin interfaceorg.apache.flink.core.io.InputSplitSource<org.apache.flink.core.io.InputSplit>
-
builder
public static JdbcRowDataInputFormat.Builder builder()
A builder used to set parameters to the output format's configuration in a fluent way.- Returns:
- builder
-
-