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


##########
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:
   struct<s1: struct<a:int>> -> struct<s1: struct<a:int, b:double>> will throw 
excetion, fix add test case



##########
be/src/olap/rowset/segment_v2/segment.h:
##########
@@ -79,6 +79,28 @@ using SegmentSharedPtr = std::shared_ptr<Segment>;
 // change finished, client should disable all cached Segment for old 
TabletSchema.
 class Segment : public std::enable_shared_from_this<Segment>, public 
MetadataAdder<Segment> {
 public:
+    static Status new_default_iterator(const TabletColumn& tablet_column,

Review Comment:
   keep implementation in cpp file



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