Login  Register

[GitHub] [carbondata] akashrn5 commented on a change in pull request #4087: [CARBONDATA-4125] SI compatability issue fix

Posted by GitBox on Feb 15, 2021; 10:40am
URL: http://apache-carbondata-dev-mailing-list-archive.168.s1.nabble.com/GitHub-carbondata-Indhumathi27-opened-a-new-pull-request-4087-WIP-SI-compatability-issue-fix-tp105998p106198.html


akashrn5 commented on a change in pull request #4087:
URL: https://github.com/apache/carbondata/pull/4087#discussion_r576096839



##########
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()) {

Review comment:
       use foreach




----------------------------------------------------------------
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:
[hidden email]