akashrn5 commented on a change in pull request #4087: URL: https://github.com/apache/carbondata/pull/4087#discussion_r576141512
########## File path: integration/spark/src/main/scala/org/apache/spark/sql/secondaryindex/command/SICreationCommand.scala ########## @@ -278,6 +303,31 @@ private[sql] case class CarbonCreateSecondaryIndexCommand( carbonTable, databaseName, tableName, indexTableName, absoluteTableIdentifier) } + if (isRegisterIndex && null != tableInfo.getFactTable.getSchemaEvolution && + null != carbonTable.getTableInfo.getFactTable.getSchemaEvolution) { + // check if SI table has undergone any alter schema operation before registering it + val schemaEvolutionEntryList = tableInfo + .getFactTable + .getSchemaEvolution + .getSchemaEvolutionEntryList + val mainTableSchemaEvolutionEntryList = carbonTable + .getTableInfo + .getFactTable + .getSchemaEvolution + .getSchemaEvolutionEntryList + if (mainTableSchemaEvolutionEntryList.size() != schemaEvolutionEntryList.size()) { + val index = mainTableSchemaEvolutionEntryList.size() + for (i <- index until schemaEvolutionEntryList.size()) { + val schemaEntry = schemaEvolutionEntryList.get(i) + val isRenamed = (schemaEntry.getAdded == null && schemaEntry.getRemoved == null) || Review comment: ```suggestion val isSITableRenamed = (schemaEntry.getAdded == null && schemaEntry.getRemoved == null) || ``` ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org