[fix](nestedtype) support nested type for schema change reorder (#39392)
## Proposed changes backport: https://github.com/apache/doris/pull/39210 Issue Number: close #xxx <!--Describe your changes.-->
This commit is contained in:
@ -648,6 +648,11 @@ public class Column implements Writable, GsonPostProcessable {
|
||||
throw new DdlException("Dest column name is empty");
|
||||
}
|
||||
|
||||
// now nested type can only support change order
|
||||
if (type.isComplexType() && !type.equals(other.type)) {
|
||||
throw new DdlException("Can not change " + type + " to " + other);
|
||||
}
|
||||
|
||||
if (!ColumnType.isSchemaChangeAllowed(type, other.type)) {
|
||||
throw new DdlException("Can not change " + getDataType() + " to " + other.getDataType());
|
||||
}
|
||||
|
||||
@ -156,9 +156,9 @@ public abstract class ColumnType {
|
||||
schemaChangeMatrix[PrimitiveType.DATETIMEV2.ordinal()][PrimitiveType.DATETIMEV2.ordinal()] = true;
|
||||
|
||||
// Currently, we do not support schema change between complex types with subtypes.
|
||||
schemaChangeMatrix[PrimitiveType.ARRAY.ordinal()][PrimitiveType.ARRAY.ordinal()] = false;
|
||||
schemaChangeMatrix[PrimitiveType.STRUCT.ordinal()][PrimitiveType.STRUCT.ordinal()] = false;
|
||||
schemaChangeMatrix[PrimitiveType.MAP.ordinal()][PrimitiveType.MAP.ordinal()] = false;
|
||||
schemaChangeMatrix[PrimitiveType.ARRAY.ordinal()][PrimitiveType.ARRAY.ordinal()] = true;
|
||||
schemaChangeMatrix[PrimitiveType.STRUCT.ordinal()][PrimitiveType.STRUCT.ordinal()] = true;
|
||||
schemaChangeMatrix[PrimitiveType.MAP.ordinal()][PrimitiveType.MAP.ordinal()] = true;
|
||||
}
|
||||
|
||||
static boolean isSchemaChangeAllowed(Type lhs, Type rhs) {
|
||||
|
||||
Reference in New Issue
Block a user