[fix](fe) Key column varchar length change should't light schema change (#28235)

This commit is contained in:
Lei Zhang
2023-12-12 21:08:38 +08:00
committed by GitHub
parent 13b9350aeb
commit 7f9cecb623
4 changed files with 61 additions and 3 deletions

View File

@ -588,7 +588,13 @@ public class SchemaChangeHandler extends AlterHandler {
if (columnPos == null && col.getDataType() == PrimitiveType.VARCHAR
&& modColumn.getDataType() == PrimitiveType.VARCHAR) {
col.checkSchemaChangeAllowed(modColumn);
lightSchemaChange = olapTable.getEnableLightSchemaChange();
// If col and modColumn is not key, it allow light schema change,
// of course, olapTable has been enable light schema change
if (modColumn.isKey() || col.isKey()) {
lightSchemaChange = false;
} else {
lightSchemaChange = olapTable.getEnableLightSchemaChange();
}
}
if (col.isClusterKey()) {
throw new DdlException("Can not modify cluster key column: " + col.getName());

View File

@ -1475,7 +1475,7 @@ public class InternalCatalog implements CatalogIf<Database> {
if (!hashDistributionInfo.sameDistributionColumns((HashDistributionInfo) defaultDistributionInfo)) {
throw new DdlException("Cannot assign hash distribution with different distribution cols. "
+ "new is: " + hashDistributionInfo.getDistributionColumns() + " default is: "
+ ((HashDistributionInfo) distributionInfo).getDistributionColumns());
+ ((HashDistributionInfo) defaultDistributionInfo).getDistributionColumns());
}
} else if (distributionInfo.getType() == DistributionInfoType.RANDOM) {
RandomDistributionInfo randomDistributionInfo = (RandomDistributionInfo) distributionInfo;