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/25 14:07:22 UTC

[GitHub] [flink] wuchong commented on a change in pull request #11214: [FLINK-16265][table][csv] CsvTableSourceFactoryBase should compare LogicalTypes instead of TableSchema

wuchong commented on a change in pull request #11214: [FLINK-16265][table][csv] CsvTableSourceFactoryBase should compare LogicalTypes instead of TableSchema
URL: https://github.com/apache/flink/pull/11214#discussion_r383899161
 
 

 ##########
 File path: flink-table/flink-table-api-java-bridge/src/main/java/org/apache/flink/table/sources/CsvTableSourceFactoryBase.java
 ##########
 @@ -123,7 +126,15 @@ protected CsvTableSource createTableSource(
 			TableSchema formatSchema = params.getTableSchema(FORMAT_FIELDS);
 			// the CsvTableSource needs some rework first
 			// for now the schema must be equal to the encoding
-			if (!formatSchema.equals(tableSchema)) {
+			// Ignore conversion classes in DataType
+			if (!Arrays
+					.stream(formatSchema.getFieldDataTypes())
+					.map(DataType::getLogicalType)
+					.collect(Collectors.toList())
+					.equals(Arrays
+							.stream(tableSchema.getFieldDataTypes())
+							.map(DataType::getLogicalType)
+							.collect(Collectors.toList()))) {
 
 Review comment:
   Maybe we can have a small utility in the class to get the `LogicalType` List from `TableSchema`? Then we don't need the long method chain.

----------------------------------------------------------------
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