@ -517,7 +517,7 @@ public class MaterializedViewHandler extends AlterHandler {
|
||||
boolean meetReplaceValue = false;
|
||||
KeysType keysType = olapTable.getKeysType();
|
||||
Map<String, Column> baseColumnNameToColumn = Maps.newHashMap();
|
||||
for (Column column : olapTable.getSchemaByIndexId(baseIndexId)) {
|
||||
for (Column column : olapTable.getSchemaByIndexId(baseIndexId, true)) {
|
||||
baseColumnNameToColumn.put(column.getName(), column);
|
||||
}
|
||||
if (keysType.isAggregationFamily()) {
|
||||
@ -555,6 +555,12 @@ public class MaterializedViewHandler extends AlterHandler {
|
||||
throw new DdlException("Rollup should contains all keys if there is a REPLACE value");
|
||||
}
|
||||
}
|
||||
if (KeysType.UNIQUE_KEYS == olapTable.getKeysType() && olapTable.hasDeleteSign()) {
|
||||
rollupSchema.add(new Column(olapTable.getDeleteSignColumn()));
|
||||
}
|
||||
if (KeysType.UNIQUE_KEYS == olapTable.getKeysType() && olapTable.hasSequenceCol()) {
|
||||
rollupSchema.add(new Column(olapTable.getSequenceCol()));
|
||||
}
|
||||
}
|
||||
} else if (KeysType.DUP_KEYS == keysType) {
|
||||
// supplement the duplicate key
|
||||
|
||||
@ -582,7 +582,7 @@ public class SchemaChangeHandler extends AlterHandler {
|
||||
|
||||
// check if the new column already exist in base schema.
|
||||
// do not support adding new column which already exist in base schema.
|
||||
List<Column> baseSchema = olapTable.getBaseSchema();
|
||||
List<Column> baseSchema = olapTable.getBaseSchema(true);
|
||||
boolean found = false;
|
||||
for (Column column : baseSchema) {
|
||||
if (column.getName().equalsIgnoreCase(newColName)) {
|
||||
@ -1381,7 +1381,7 @@ public class SchemaChangeHandler extends AlterHandler {
|
||||
|
||||
// index id -> index schema
|
||||
Map<Long, LinkedList<Column>> indexSchemaMap = new HashMap<>();
|
||||
for (Map.Entry<Long, List<Column>> entry : olapTable.getIndexIdToSchema().entrySet()) {
|
||||
for (Map.Entry<Long, List<Column>> entry : olapTable.getIndexIdToSchema(true).entrySet()) {
|
||||
indexSchemaMap.put(entry.getKey(), new LinkedList<>(entry.getValue()));
|
||||
}
|
||||
List<Index> newIndexes = olapTable.getCopiedIndexes();
|
||||
|
||||
@ -514,9 +514,14 @@ public class OlapTable extends Table {
|
||||
|
||||
// schema
|
||||
public Map<Long, List<Column>> getIndexIdToSchema() {
|
||||
return getIndexIdToSchema(Util.showHiddenColumns());
|
||||
}
|
||||
|
||||
// schema
|
||||
public Map<Long, List<Column>> getIndexIdToSchema(boolean full) {
|
||||
Map<Long, List<Column>> result = Maps.newHashMap();
|
||||
for (Map.Entry<Long, MaterializedIndexMeta> entry : indexIdToMeta.entrySet()) {
|
||||
result.put(entry.getKey(), entry.getValue().getSchema(Util.showHiddenColumns()));
|
||||
result.put(entry.getKey(), entry.getValue().getSchema(full));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user