You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2020/02/07 04:09:59 UTC

[GitHub] [flink] wuchong commented on a change in pull request #10745: [FLINK-15445][connectors/jdbc] JDBC Table Source didn't work for Type…

wuchong commented on a change in pull request #10745: [FLINK-15445][connectors/jdbc] JDBC Table Source didn't work for Type…
URL: https://github.com/apache/flink/pull/10745#discussion_r376195245
 
 

 ##########
 File path: flink-connectors/flink-jdbc/src/main/java/org/apache/flink/api/java/io/jdbc/JDBCTableSource.java
 ##########
 @@ -73,17 +75,23 @@ private JDBCTableSource(
 		this.selectFields = selectFields;
 
 		final TypeInformation<?>[] schemaTypeInfos = schema.getFieldTypes();
+		final DataType[] schemaDataTypes = schema.getFieldDataTypes();
 		final String[] schemaFieldNames = schema.getFieldNames();
 		if (selectFields != null) {
 			TypeInformation<?>[] typeInfos = new TypeInformation[selectFields.length];
-			String[] typeNames = new String[selectFields.length];
+			DataType[] dataTypes = new DataType[selectFields.length];
+			String[] fieldNames = new String[selectFields.length];
 			for (int i = 0; i < selectFields.length; i++) {
 				typeInfos[i] = schemaTypeInfos[selectFields[i]];
-				typeNames[i] = schemaFieldNames[selectFields[i]];
+				dataTypes[i] = schemaDataTypes[selectFields[i]];
+				fieldNames[i] = schemaFieldNames[selectFields[i]];
 			}
-			this.returnType = new RowTypeInfo(typeInfos, typeNames);
+			this.returnType = new RowTypeInfo(typeInfos, fieldNames);
 
 Review comment:
   Can we remove the `returnType` member field?
   It's error-prone to maintain two objects. The returnType is only used in `getDataStream` and can be derived via `TypeConversions.fromDataTypeToLegacyInfo(producedDataType)`.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services