You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2022/08/04 03:07:58 UTC
[GitHub] [doris] SWJTU-ZhangLei opened a new pull request, #11494: [feature](schema change) Light schema change support rollup/mv
SWJTU-ZhangLei opened a new pull request, #11494:
URL: https://github.com/apache/doris/pull/11494
# Proposed changes
1. move maxColUniqueId from OlapTable.java to MaterializedIndexMeta
2. for rollup and MaterializedIndex support light schema change
Issue Number: close #xxx
## Problem summary
Describe your changes.
## Checklist(Required)
1. Does it affect the original behavior:
- [ ] Yes
- [ ] No
- [ ] I don't know
3. Has unit tests been added:
- [ ] Yes
- [ ] No
- [ ] No Need
4. Has document been added or modified:
- [ ] Yes
- [ ] No
- [ ] No Need
5. Does it need to update dependencies:
- [ ] Yes
- [ ] No
6. Are there any changes that cannot be rolled back:
- [ ] Yes (If Yes, please explain WHY)
- [ ] No
## Further comments
If this is a relatively large or complex change, kick off the discussion at [dev@doris.apache.org](mailto:dev@doris.apache.org) by explaining why you chose the solution you did and what alternatives you considered, etc...
--
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: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [doris] SWJTU-ZhangLei commented on a diff in pull request #11494: [feature](schema change) Light schema change support rollup/mv
Posted by GitBox <gi...@apache.org>.
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: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [doris] gavinchou commented on pull request #11494: [feature](schema change) Light schema change support rollup/mv
Posted by GitBox <gi...@apache.org>.
gavinchou commented on PR #11494:
URL: https://github.com/apache/doris/pull/11494#issuecomment-1206005507
LGTM
--
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: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [doris] gavinchou commented on a diff in pull request #11494: [feature](schema change) Light schema change support rollup/mv
Posted by GitBox <gi...@apache.org>.
gavinchou commented on code in PR #11494:
URL: https://github.com/apache/doris/pull/11494#discussion_r937331773
##########
fe/fe-core/src/main/java/org/apache/doris/catalog/OlapTable.java:
##########
@@ -1851,4 +1840,8 @@ public void checkReplicaAllocation() throws UserException {
}
}
}
+
+ public Boolean getUseLightSchemaChange() {
Review Comment:
Isn't it a property of OlapTable?
Also, naming it as `lightSchemaChangeEanbled()` seems better.
##########
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);
Review Comment:
Remove duplicated code, we don't have to check `olapTable.getUseLight()` every time we generate a new `columnUniqueId` in a single code block.
##########
fe/fe-core/src/main/java/org/apache/doris/datasource/InternalDataSource.java:
##########
@@ -1703,11 +1703,6 @@ private void createOlapTable(Database db, CreateTableStmt stmt) throws UserExcep
OlapTable olapTable = new OlapTable(tableId, tableName, baseSchema, keysType, partitionInfo,
defaultDistributionInfo, indexes);
- for (Column column : baseSchema) {
Review Comment:
We need to ensure that this change won't break the original behavior of base table.
##########
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:
Remove duplicated code, try this:
```
IntSupplier idSupplier = colUniqueIdSupplierMap.get(targetIndexId == -1 ? baseIndexId : targetIndexId);
Int newId = olapTable.getUseLightSchemaChange() ? Column.COLUMN_UNIQUE_ID_INIT_VALUE : idSupplier.getAsInt();
...
if target == -1
checkAndAddColumn(... newId)
else
checkAndAddColumn(... newId)
```
--
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: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [doris] morningman merged pull request #11494: [feature](schema change) Light schema change support rollup/mv
Posted by GitBox <gi...@apache.org>.
morningman merged PR #11494:
URL: https://github.com/apache/doris/pull/11494
--
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: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [doris] github-actions[bot] commented on pull request #11494: [feature](schema change) Light schema change support rollup/mv
Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #11494:
URL: https://github.com/apache/doris/pull/11494#issuecomment-1214265111
PR approved by anyone and no changes requested.
--
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: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [doris] gavinchou commented on pull request #11494: [feature](schema change) Light schema change support rollup/mv
Posted by GitBox <gi...@apache.org>.
gavinchou commented on PR #11494:
URL: https://github.com/apache/doris/pull/11494#issuecomment-1212154360
LGTM again
--
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: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [doris] github-actions[bot] commented on pull request #11494: [feature](schema change) Light schema change support rollup/mv
Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #11494:
URL: https://github.com/apache/doris/pull/11494#issuecomment-1214265109
PR approved by at least one committer and no changes requested.
--
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: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org