Source:
<code>public ScanRuntimeProvider getScanRuntimeProvider(ScanContext runtimeProviderContext) { final JdbcRowDataInputFormat.Builder builder = JdbcRowDataInputFormat.builder() .setDrivername(options.getDriverName()) .setDBUrl(options.getDbURL()) .setUsername(options.getUsername().orElse(null)) .setPassword(options.getPassword().orElse(null)) .setAutoCommit(readOptions.getAutoCommit()); <START> if (readOptions.getFetchSize() != 0 || this.limit >= 0) { int fetchsize = readOptions.getFetchSize(); if (fetchsize == 0) { fetchsize = limit; } else if (limit != -1) { fetchsize = Integer.min(fetchsize, limit); } builder.setFetchSize(fetchsize); <END> } final JdbcDialect dialect = options.getDialect(); String query = dialect.getSelectFromStatement( options.getTableName(), physicalSchema.getFieldNames(), new String[0]); if (readOptions.getPartitionColumnName().isPresent()) { long lowerBound = readOptions.getPartitionLowerBound().get(); long upperBound = readOptions.getPartitionUpperBound().get(); int numPartitions = readOptions.getNumPartitions().get(); builder.setParametersProvider( new JdbcNumericBetweenParametersProvider(lowerBound, upperBound).ofBatchNum(numPartitions)); query += " WHERE " + dialect.quoteIdentifier(readOptions.getPartitionColumnName().get()) + " BETWEEN ? AND ?"; } builder.setQuery(query); final RowType rowType = (RowType) physicalSchema.toRowDataType().getLogicalType(); builder.setRowConverter(dialect.getRowConverter(rowType)); builder.setRowDataTypeInfo( runtimeProviderContext.createTypeInformation(physicalSchema.toRowDataType())); return InputFormatProvider.of(builder.build()); }</code><technical_language>need adapt fetch size, is a effort read size</technical_language>

Target:
public ScanRuntimeProvider getScanRuntimeProvider(ScanContext runtimeProviderContext) { final JdbcRowDataInputFormat.Builder builder = JdbcRowDataInputFormat.builder() .setDrivername(options.getDriverName()) .setDBUrl(options.getDbURL()) .setUsername(options.getUsername().orElse(null)) .setPassword(options.getPassword().orElse(null)) .setAutoCommit(readOptions.getAutoCommit()); if (readOptions.getFetchSize() != 0) { builder.setFetchSize(readOptions.getFetchSize()); } final JdbcDialect dialect = options.getDialect(); String query = dialect.getSelectFromStatement( options.getTableName(), physicalSchema.getFieldNames(), new String[0]); if (readOptions.getPartitionColumnName().isPresent()) { long lowerBound = readOptions.getPartitionLowerBound().get(); long upperBound = readOptions.getPartitionUpperBound().get(); int numPartitions = readOptions.getNumPartitions().get(); builder.setParametersProvider( new JdbcNumericBetweenParametersProvider(lowerBound, upperBound).ofBatchNum(numPartitions)); query += " WHERE " + dialect.quoteIdentifier(readOptions.getPartitionColumnName().get()) + " BETWEEN ? AND ?"; } if (limit >= 0) { query = String.format("%s %s", query, dialect.getLimitClause(limit)); } builder.setQuery(query); final RowType rowType = (RowType) physicalSchema.toRowDataType().getLogicalType(); builder.setRowConverter(dialect.getRowConverter(rowType)); builder.setRowDataTypeInfo( runtimeProviderContext.createTypeInformation(physicalSchema.toRowDataType())); return InputFormatProvider.of(builder.build()); }