SWJTU-ZhangLei commented on code in PR #11494:
URL: https://github.com/apache/doris/pull/11494#discussion_r937381491
##########
fe/fe-core/src/main/java/org/apache/doris/alter/SchemaChangeHandler.java:
##########
@@ -957,62 +937,97 @@ private boolean addColumnInternal(OlapTable olapTable,
Column newColumn, ColumnP
for (Map.Entry<Long, LinkedList<Column>> entry :
indexSchemaMap.entrySet()) {
modIndexSchema = entry.getValue();
boolean isBaseIdex = entry.getKey() == baseIndexId;
- checkAndAddColumn(modIndexSchema, newColumn, columnPos,
newColNameSet, isBaseIdex);
+ IntSupplier colUniqueIdSupplier =
colUniqueIdSupplierMap.get(entry.getKey());
+ int newColumnUniqueId = olapTable.getUseLightSchemaChange()
+ ? Column.COLUMN_UNIQUE_ID_INIT_VALUE :
colUniqueIdSupplier.getAsInt();
+ checkAndAddColumn(modIndexSchema, newColumn, columnPos,
newColNameSet,
+ isBaseIdex, newColumnUniqueId);
}
} else {
// 1. add to base table
modIndexSchema = indexSchemaMap.get(baseIndexId);
- checkAndAddColumn(modIndexSchema, newColumn, columnPos,
newColNameSet, true);
+ IntSupplier baseIndexColUniqueIdSupplier =
colUniqueIdSupplierMap.get(baseIndexId);
+ int baseIndexNewColumnUniqueId =
olapTable.getUseLightSchemaChange()
+ ? Column.COLUMN_UNIQUE_ID_INIT_VALUE
+ : baseIndexColUniqueIdSupplier.getAsInt();
+ checkAndAddColumn(modIndexSchema, newColumn, columnPos,
newColNameSet,
+ true, baseIndexNewColumnUniqueId);
if (targetIndexId == -1L) {
- return ligthSchemaChange;
+ return lightSchemaChange;
}
// 2. add to rollup
- ligthSchemaChange = false;
+ lightSchemaChange = false;
modIndexSchema = indexSchemaMap.get(targetIndexId);
- checkAndAddColumn(modIndexSchema, newColumn, columnPos,
newColNameSet, false);
+ IntSupplier targetIndexColUniqueIdSupplier =
colUniqueIdSupplierMap.get(targetIndexId);
+ int rollUpNewColumnUniqueId =
olapTable.getUseLightSchemaChange()
+ ? Column.COLUMN_UNIQUE_ID_INIT_VALUE
+ : targetIndexColUniqueIdSupplier.getAsInt();
+ checkAndAddColumn(modIndexSchema, newColumn, columnPos,
newColNameSet,
+ false, rollUpNewColumnUniqueId);
}
} else if (KeysType.DUP_KEYS == olapTable.getKeysType()) {
if (targetIndexId == -1L) {
Review Comment:
we cannot do like this, some situation we need both update base index and
rollup index.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]