[CARBONDATA-4344] Create MV fails with "LOCAL_DICTIONARY_INCLUDE/LOCAL _DICTIONARY_EX...
authorShreelekhyaG <shreelu_gampa@yahoo.com>
Wed, 22 Jun 2022 11:41:23 +0000 (17:11 +0530)
committerIndhumathi27 <indhumathim27@gmail.com>
Mon, 27 Jun 2022 10:44:57 +0000 (16:14 +0530)
commit858afc7eb60508de1f9d5fc8df06099e83df3c15
treea5e2366048bba92aacb5efabf7754cdb9fdb9350
parent93b0af25ef4ac75927f83ef78bb788120c25ac85
[CARBONDATA-4344] Create MV fails with "LOCAL_DICTIONARY_INCLUDE/LOCAL _DICTIONARY_EXCLUDE column: does not exist in table. Please check the DDL" error

Why is this PR needed?
Create MV fails with "LOCAL_DICTIONARY_INCLUDE/LOCAL _DICTIONARY_EXCLUDE column: does not exist in table.
Please check the DDL" error.
Error occurs only in this scenario: Create Table --> Load --> Alter Add Columns --> Drop table --> Refresh Table --> Create MV
and not in direct scenario like: Create Table --> Load --> Alter Add Columns --> Create MV

What changes were proposed in this PR?
1. After add column command, LOCAL_DICTIONARY_INCLUDE and LOCAL_DICTIONARY_EXCLUDE properties
   are added to the table even if the columns are empty. So, when MV is created next as
   LOCAL_DICTIONARY_EXCLUDE column is defined it tries to access its columns and fails.
   --> Added empty check before adding properties to the table to resolve this.
2. In a direct scenario after add column, the schema gets updated in catalog table but
   the table properties are not updated. Made changes to update table properties to catalog table.

Does this PR introduce any user interface change?
No

Is any new testcase added?
Yes

This closes #4282
index/secondary-index/src/test/scala/org/apache/carbondata/spark/testsuite/secondaryindex/TestRegisterIndexCarbonTable.scala
integration/spark/src/main/scala/org/apache/spark/sql/execution/command/carbonTableSchemaCommon.scala
integration/spark/src/main/scala/org/apache/spark/sql/hive/CarbonSessionUtil.scala
integration/spark/src/main/scala/org/apache/spark/sql/test/util/QueryTest.scala
integration/spark/src/test/scala/org/apache/carbondata/spark/testsuite/standardpartition/StandardPartitionTableLoadingTestCase.scala
integration/spark/src/test/scala/org/apache/carbondata/view/rewrite/MVCreateTestCase.scala
integration/spark/src/test/scala/org/apache/spark/carbondata/register/TestRegisterCarbonTable.scala