fsk119 commented on a change in pull request #13449:
URL: https://github.com/apache/flink/pull/13449#discussion_r518463371



##########
File path: 
flink-table/flink-table-planner-blink/src/main/java/org/apache/flink/table/planner/operations/MergeTableLikeUtil.java
##########
@@ -463,7 +466,19 @@ private void collectPhysicalFieldsTypes(List<SqlNode> 
derivedColumns) {
                                        boolean nullable = type.getNullable() 
== null ? true : type.getNullable();
                                        RelDataType relType = 
type.deriveType(sqlValidator, nullable);
                                        // add field name and field type to 
physical field list
-                                       physicalFieldNamesToTypes.put(name, 
relType);
+                                       nonComputedFieldNamesToTypes.put(name, 
relType);
+                               } else if (derivedColumn instanceof 
SqlMetadataColumn) {
+                                       SqlMetadataColumn metadataColumn = 
(SqlMetadataColumn) derivedColumn;
+                                       String name = 
metadataColumn.getName().getSimple();
+                                       if (columns.containsKey(name)) {
+                                               throw new 
ValidationException(String.format(
+                                                       "A column named '%s' 
already exists in the base table.",
+                                                       name));
+                                       }
+                                       RelDataType relType = 
metadataColumn.getType()
+                                                                               
        .deriveType(sqlValidator, metadataColumn.getType().getNullable());
+                                       // add field name and field type to 
physical field list
+                                       nonComputedFieldNamesToTypes.put(name, 
relType);

Review comment:
       Added now




----------------------------------------------------------------
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:
[email protected]


Reply via email to