spena commented on code in PR #25758:
URL: https://github.com/apache/flink/pull/25758#discussion_r1876496585


##########
flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/operations/MergeTableAsUtil.java:
##########
@@ -386,19 +387,24 @@ private void validateImplicitCastCompatibility(
                 int columnPos,
                 UnresolvedColumn sourceColumn,
                 UnresolvedColumn sinkColumn) {
-            if (!(sinkColumn instanceof UnresolvedPhysicalColumn)) {
+            LogicalType sinkColumnType;
+
+            if (sinkColumn instanceof UnresolvedPhysicalColumn) {
+                sinkColumnType = getLogicalType(((UnresolvedPhysicalColumn) 
sinkColumn));
+            } else if ((sinkColumn instanceof UnresolvedMetadataColumn)
+                    && !((UnresolvedMetadataColumn) sinkColumn).isVirtual()) {
+                sinkColumnType = getLogicalType(((UnresolvedMetadataColumn) 
sinkColumn));
+            } else {
                 throw new ValidationException(
                         String.format(
                                 "A column named '%s' already exists in the 
source schema. "
-                                        + "Computed and metadata columns 
cannot overwrite "
-                                        + "regular columns.",
+                                        + "Computed and virtual metadata 
columns cannot overwrite "

Review Comment:
   Yes. I updated the PR with new tests with different messages.



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

To unsubscribe, e-mail: issues-unsubscr...@flink.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to