morningman commented on a change in pull request #7217:
URL: https://github.com/apache/incubator-doris/pull/7217#discussion_r756667625



##########
File path: 
fe/fe-core/src/main/java/org/apache/doris/alter/MaterializedViewHandler.java
##########
@@ -498,13 +499,15 @@ private RollupJobV2 createMaterializedViewJob(String 
mvName, String baseIndexNam
 
     public List<Column> checkAndPrepareMaterializedView(AddRollupClause 
addRollupClause, OlapTable olapTable,
                                                         long baseIndexId, 
boolean changeStorageFormat)
-            throws DdlException{
+            throws DdlException {
         String rollupIndexName = addRollupClause.getRollupName();
         List<String> rollupColumnNames = addRollupClause.getColumnNames();
         if (changeStorageFormat) {
             String newStorageFormatIndexName = 
NEW_STORAGE_FORMAT_INDEX_NAME_PREFIX + olapTable.getName();
             rollupIndexName = newStorageFormatIndexName;
-            List<Column> columns = olapTable.getSchemaByIndexId(baseIndexId);
+            // Must get all columns including invisible columns.
+            // Because in alter process, all columns must be considered.
+            List<Column> columns = olapTable.getSchemaByIndexId(baseIndexId, 
true);

Review comment:
       This is where the bug is caused. Other modifications are related to 
formatting.

##########
File path: 
fe/fe-core/src/main/java/org/apache/doris/alter/SchemaChangeHandler.java
##########
@@ -1123,7 +1124,9 @@ private void createJob(long dbId, OlapTable olapTable, 
Map<Long, LinkedList<Colu
         Map<Long, Short> indexIdToShortKeyColumnCount = Maps.newHashMap();
         Map<Long, List<Column>> changedIndexIdToSchema = Maps.newHashMap();
         for (Long alterIndexId : indexSchemaMap.keySet()) {
-            List<Column> originSchema = 
olapTable.getSchemaByIndexId(alterIndexId);
+            // Must get all columns including invisible columns.
+            // Because in alter process, all columns must be considered.
+            List<Column> originSchema = 
olapTable.getSchemaByIndexId(alterIndexId, true);

Review comment:
       This is where the bug is caused. Other modifications are related to 
formatting.




-- 
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]

Reply via email to