Github user zentol commented on a diff in the pull request:
https://github.com/apache/flink/pull/4036#discussion_r119465263
--- Diff:
flink-connectors/flink-jdbc/src/test/java/org/apache/flink/api/java/io/jdbc/JDBCInputFormatTest.java
---
@@ -101,6 +105,33 @@ public void testIncompleteConfiguration() throws
IOException {
}
@Test
+ public void defaultFetchSizeIsUsedIfNotConfiguredOtherwise() throws
SQLException {
+ jdbcInputFormat = JDBCInputFormat.buildJDBCInputFormat()
+ .setDrivername(DRIVER_CLASS)
+ .setDBUrl(DB_URL)
+ .setQuery(SELECT_ALL_BOOKS)
+ .setRowTypeInfo(ROW_TYPE_INFO)
+ .finish();
+ jdbcInputFormat.openInputFormat();
+ assertThat(jdbcInputFormat.getStatement().getFetchSize(),
equalTo(1));
+
+ }
+
+ @Test
+ public void fetchSizeCanBeConfigured() throws SQLException {
+ final int desiredFetchSize = 10_000;
+ jdbcInputFormat = JDBCInputFormat.buildJDBCInputFormat()
+ .setDrivername(DRIVER_CLASS)
+ .setDBUrl(DB_URL)
+ .setQuery(SELECT_ALL_BOOKS)
+ .setRowTypeInfo(ROW_TYPE_INFO)
+ .setFetchSize(desiredFetchSize)
+ .finish();
+ jdbcInputFormat.openInputFormat();
+ assertThat(jdbcInputFormat.getStatement().getFetchSize(),
equalTo(desiredFetchSize));
--- End diff --
Would be good to replace these with junit assertEquals, to be consistent
with the remaining tests in flink.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---