Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@ public List<Column> checkAndPrepareMaterializedView(AddRollupClause addRollupCla
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()) {
Expand Down Expand Up @@ -555,6 +555,12 @@ public List<Column> checkAndPrepareMaterializedView(AddRollupClause addRollupCla
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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,7 @@ private void addColumnInternal(OlapTable olapTable, Column newColumn, ColumnPosi

// 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)) {
Expand Down Expand Up @@ -1381,7 +1381,7 @@ public void process(List<AlterClause> alterClauses, String clusterName, Database

// 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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -514,9 +514,14 @@ public List<Long> getIndexIdListExceptBaseIndex() {

// 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;
}
Expand Down