wuchong commented on a change in pull request #11538: [FLINK-16813][jdbc] JDBCInputFormat doesn't correctly map Short URL: https://github.com/apache/flink/pull/11538#discussion_r401439424
########## File path: flink-connectors/flink-jdbc/src/main/java/org/apache/flink/api/java/io/jdbc/JDBCTableSource.java ########## @@ -151,18 +152,19 @@ public static Builder builder() { } private JDBCInputFormat getInputFormat() { - final RowTypeInfo rowTypeInfo = (RowTypeInfo) fromDataTypeToLegacyInfo(producedDataType); + final RowType rowType = (RowType) producedDataType.getLogicalType(); JDBCInputFormat.JDBCInputFormatBuilder builder = JDBCInputFormat.buildJDBCInputFormat() .setDrivername(options.getDriverName()) .setDBUrl(options.getDbURL()) - .setRowTypeInfo(new RowTypeInfo(rowTypeInfo.getFieldTypes(), rowTypeInfo.getFieldNames())); + .setRowType(rowType); options.getUsername().ifPresent(builder::setUsername); options.getPassword().ifPresent(builder::setPassword); if (readOptions.getFetchSize() != 0) { builder.setFetchSize(readOptions.getFetchSize()); } + final RowTypeInfo rowTypeInfo = (RowTypeInfo) fromDataTypeToLegacyInfo(producedDataType); final JDBCDialect dialect = options.getDialect(); Review comment: My point is that we can get the `JdbcConverter` from dialect here, and pass to `JdbcInputFormat`. So that, `JdbcInputFormat` don't need a `RowType`. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services