seawinde commented on code in PR #64769:
URL: https://github.com/apache/doris/pull/64769#discussion_r3465025165


##########
fe/fe-core/src/main/java/org/apache/doris/alter/MaterializedViewHandler.java:
##########
@@ -202,10 +202,15 @@ public void 
processCreateMaterializedView(CreateMaterializedViewCommand createMv
             if (olapTable.existTempPartitions()) {
                 throw new DdlException("Can not alter table when there are 
temp partitions in table");
             }
-            // check no duplicate column name in full schema
+            // check no duplicate column name against the base index schema.
+            // we don't check the duplicate name of historic mv for backwards 
compatibility,
+            // so seed the set from the base index schema only (getBaseSchema) 
instead of
+            // getFullSchema(), which also contains historic mv/rollup 
columns. Otherwise two
+            // sync mv over the same column whose inferred column name 
collides (e.g. stddev
+            // and stddev_pop both produce '__stddev_1') would be wrongly 
rejected with
+            // ERR_DUP_FIELDNAME. Pass full=true so hidden base columns are 
still checked.
             Set<String> allColumnNames = new 
TreeSet<>(String.CASE_INSENSITIVE_ORDER);
-            for (Column column : olapTable.getFullSchema()) {
-                // we don't check the duplicate name of historic mv for 
backwards compatibility
+            for (Column column : olapTable.getBaseSchema(true)) {

Review Comment:
   之前要求同一个表上所有同步物化视图的列名都不能重复,现在改成了只和基表比较不能重复。



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

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to