amorynan commented on code in PR #47096:
URL: https://github.com/apache/doris/pull/47096#discussion_r1991090684


##########
fe/fe-core/src/main/java/org/apache/doris/catalog/ColumnType.java:
##########
@@ -208,12 +209,34 @@ public static void 
checkSupportSchemaChangeForComplexType(Type checkType, Type o
         if (checkType.isStructType() && other.isStructType()) {
             StructType thisStructType = (StructType) checkType;
             StructType otherStructType = (StructType) other;
-            if (thisStructType.getFields().size() != 
otherStructType.getFields().size()) {
-                throw new DdlException("Cannot change struct type with 
different field size");
+            // now we only support add new field for struct type
+            if (thisStructType.getFields().size() > 
otherStructType.getFields().size()) {
+                throw new DdlException("Cannot reduce struct fields from " + 
checkType.toSql() + " to "
+                        + other.toSql());
             }
-            for (int i = 0; i < thisStructType.getFields().size(); i++) {
+            int i = 0;
+            HashSet<String> thisStructNames = new HashSet<>();
+            for (; i < thisStructType.getFields().size(); i++) {
+                // do not support struct same position field name/type change
+                if 
(!thisStructType.getFields().get(i).equals(otherStructType.getFields().get(i))) 
{

Review Comment:
   done! please review again !!!



-- 
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: commits-unsubscr...@doris.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to