@Internal public class JdbcRowDataInputFormat extends RichInputFormat<RowData,InputSplit> implements ResultTypeQueryable<RowData>
JdbcDynamicTableSource
.Modifier and Type | Class and Description |
---|---|
static class |
JdbcRowDataInputFormat.Builder
Builder for
JdbcRowDataInputFormat . |
Modifier and Type | Method and Description |
---|---|
static JdbcRowDataInputFormat.Builder |
builder()
A builder used to set parameters to the output format's configuration in a fluent way.
|
void |
close()
Closes all resources used.
|
void |
closeInputFormat()
Closes this InputFormat instance.
|
void |
configure(Configuration parameters)
Configures this input format.
|
InputSplit[] |
createInputSplits(int minNumSplits)
Computes the input splits.
|
InputSplitAssigner |
getInputSplitAssigner(InputSplit[] inputSplits)
Returns the assigner for the input splits.
|
TypeInformation<RowData> |
getProducedType()
Gets the data type (as a
TypeInformation ) produced by this function or input format. |
BaseStatistics |
getStatistics(BaseStatistics cachedStatistics)
Gets the basic statistics from the input described by this format.
|
RowData |
nextRecord(RowData reuse)
Stores the next resultSet row in a tuple.
|
void |
open(InputSplit inputSplit)
Connects to the source database and executes the query in a parallel fashion if this
InputFormat is built using a parameterized query (i.e. |
void |
openInputFormat()
Opens this InputFormat instance.
|
boolean |
reachedEnd()
Checks whether all data has been read.
|
getRuntimeContext, setRuntimeContext
public void configure(Configuration parameters)
InputFormat
This method is always called first on a newly instantiated input format.
configure
in interface InputFormat<RowData,InputSplit>
parameters
- The configuration with all parameters (note: not the Flink config but the
TaskConfig).public void openInputFormat()
RichInputFormat
openInputFormat
in class RichInputFormat<RowData,InputSplit>
InputFormat
public void closeInputFormat()
RichInputFormat
RichInputFormat.openInputFormat()
should be closed in this method.closeInputFormat
in class RichInputFormat<RowData,InputSplit>
InputFormat
public void open(InputSplit inputSplit) throws IOException
InputFormat
is built using a parameterized query (i.e. using a PreparedStatement
) and a proper JdbcParameterValuesProvider
, in a non-parallel
fashion otherwise.open
in interface InputFormat<RowData,InputSplit>
inputSplit
- which is ignored if this InputFormat is executed as a non-parallel source,
a "hook" to the query parameters otherwise (using its splitNumber)IOException
- if there's an error during the execution of the querypublic void close() throws IOException
close
in interface InputFormat<RowData,InputSplit>
IOException
- Indicates that a resource could not be closed.public TypeInformation<RowData> getProducedType()
ResultTypeQueryable
TypeInformation
) produced by this function or input format.getProducedType
in interface ResultTypeQueryable<RowData>
public boolean reachedEnd() throws IOException
reachedEnd
in interface InputFormat<RowData,InputSplit>
IOException
public RowData nextRecord(RowData reuse) throws IOException
nextRecord
in interface InputFormat<RowData,InputSplit>
reuse
- row to be reused.RowData
IOException
public BaseStatistics getStatistics(BaseStatistics cachedStatistics) throws IOException
InputFormat
When this method is called, the input format is guaranteed to be configured.
getStatistics
in interface InputFormat<RowData,InputSplit>
cachedStatistics
- The statistics that were cached. May be null.IOException
public InputSplit[] createInputSplits(int minNumSplits) throws IOException
InputSplitSource
createInputSplits
in interface InputFormat<RowData,InputSplit>
createInputSplits
in interface InputSplitSource<InputSplit>
minNumSplits
- Number of minimal input splits, as a hint.IOException
public InputSplitAssigner getInputSplitAssigner(InputSplit[] inputSplits)
InputSplitSource
getInputSplitAssigner
in interface InputFormat<RowData,InputSplit>
getInputSplitAssigner
in interface InputSplitSource<InputSplit>
public static JdbcRowDataInputFormat.Builder builder()
Copyright © 2014–2021 The Apache Software Foundation. All rights reserved.