Class JdbcNumericBetweenParametersProvider
- java.lang.Object
-
- org.apache.flink.connector.jdbc.split.JdbcNumericBetweenParametersProvider
-
- All Implemented Interfaces:
JdbcParameterValuesProvider
@Experimental public class JdbcNumericBetweenParametersProvider extends Object implements JdbcParameterValuesProvider
This query parameters generator is an helper class to parameterize from/to queries on a numeric column. The generated array of from/to values will be equally sized to fetchSize (apart from the last one), ranging from minVal up to maxVal.For example, if there's a table
BOOKSwith a numeric PKid, using a query like:SELECT * FROM BOOKS WHERE id BETWEEN ? AND ?
You can take advantage of this class to automatically generate the parameters of the BETWEEN clause, based on the passed constructor parameters.
-
-
Constructor Summary
Constructors Constructor Description JdbcNumericBetweenParametersProvider(long minVal, long maxVal)NumericBetweenParametersProviderJdbc constructor.JdbcNumericBetweenParametersProvider(long fetchSize, long minVal, long maxVal)NumericBetweenParametersProviderJdbc constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Serializable[][]getParameterValues()Returns the necessary parameters array to use for query in parallel a table.JdbcNumericBetweenParametersProviderofBatchNum(int batchNum)JdbcNumericBetweenParametersProviderofBatchSize(long batchSize)
-
-
-
Constructor Detail
-
JdbcNumericBetweenParametersProvider
public JdbcNumericBetweenParametersProvider(long minVal, long maxVal)NumericBetweenParametersProviderJdbc constructor.- Parameters:
minVal- the lower bound of the produced "from" valuesmaxVal- the upper bound of the produced "to" values
-
JdbcNumericBetweenParametersProvider
public JdbcNumericBetweenParametersProvider(long fetchSize, long minVal, long maxVal)NumericBetweenParametersProviderJdbc constructor.- Parameters:
fetchSize- the max distance between the produced from/to pairsminVal- the lower bound of the produced "from" valuesmaxVal- the upper bound of the produced "to" values
-
-
Method Detail
-
ofBatchSize
public JdbcNumericBetweenParametersProvider ofBatchSize(long batchSize)
-
ofBatchNum
public JdbcNumericBetweenParametersProvider ofBatchNum(int batchNum)
-
getParameterValues
public Serializable[][] getParameterValues()
Description copied from interface:JdbcParameterValuesProviderReturns the necessary parameters array to use for query in parallel a table.- Specified by:
getParameterValuesin interfaceJdbcParameterValuesProvider
-
-