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 2019/12/30 10:16:58 UTC

[GitHub] [flink] wuchong commented on a change in pull request #10693: [FLINK-15334][table sql / api] Fix physical schema mapping in TableFormatFactoryBase to support define orderless computed column

wuchong commented on a change in pull request #10693: [FLINK-15334][table sql / api] Fix physical schema mapping in TableFormatFactoryBase to support define orderless computed column
URL: https://github.com/apache/flink/pull/10693#discussion_r361945201
 
 

 ##########
 File path: flink-table/flink-table-common/src/main/java/org/apache/flink/table/factories/TableFormatFactoryBase.java
 ##########
 @@ -154,31 +156,37 @@ public static TableSchema deriveSchema(Map<String, String> properties) {
 
 		final TableSchema.Builder builder = TableSchema.builder();
 
-		final TableSchema baseSchema = TableSchemaUtils.getPhysicalSchema(
-			descriptorProperties.getTableSchema(SCHEMA));
-		for (int i = 0; i < baseSchema.getFieldCount(); i++) {
-			final String fieldName = baseSchema.getFieldNames()[i];
-			final DataType fieldType = baseSchema.getFieldDataTypes()[i];
+		final TableSchema tableSchema = descriptorProperties.getTableSchema(SCHEMA);
+		final TableSchema physicalSchema = TableSchemaUtils.getPhysicalSchema(tableSchema);
+
+		final Map<Integer, Integer> physicalIndices2Indices = Arrays.stream(physicalSchema.getFieldNames())
 
 Review comment:
   A simper way to fix is add the field only when it is not generated. We already have `isGeneratedColumn `. So we don't need the complex mapping. 

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