[CARBONDATA-2611] Added Test Cases for Local Dictionary Support for Create 
Table comand

What changes were proposed in this pull request?
In this PR, UTs and SDV test cases are added for local dictionary support for 
create table command and describe formatted command.

changed the error message for validation of local dictionary table properties 
and
fixed column name display without extra space in describe formatted command

This closes#2377


Project: http://git-wip-us.apache.org/repos/asf/carbondata/repo
Commit: http://git-wip-us.apache.org/repos/asf/carbondata/commit/c5a4ec07
Tree: http://git-wip-us.apache.org/repos/asf/carbondata/tree/c5a4ec07
Diff: http://git-wip-us.apache.org/repos/asf/carbondata/diff/c5a4ec07

Branch: refs/heads/carbonstore
Commit: c5a4ec07a8c03600741d6a2ae324a4fe4ab61659
Parents: be20fef
Author: praveenmeenakshi56 <praveenmeenaksh...@gmail.com>
Authored: Thu Jun 14 23:36:59 2018 +0530
Committer: kumarvishal09 <kumarvishal1...@gmail.com>
Committed: Wed Jun 20 12:13:09 2018 +0530

----------------------------------------------------------------------
 ...CreateTableWithLocalDictionaryTestCase.scala | 2102 ++++++++++++++++++
 .../cluster/sdv/suite/SDVSuites.scala           |    6 +-
 .../LocalDictionarySupportCreateTableTest.scala | 2102 ++++++++++++++++++
 .../spark/sql/catalyst/CarbonDDLSqlParser.scala |   31 +-
 .../table/CarbonDescribeFormattedCommand.scala  |    2 +-
 5 files changed, 4227 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/carbondata/blob/c5a4ec07/integration/spark-common-cluster-test/src/test/scala/org/apache/carbondata/cluster/sdv/generated/CreateTableWithLocalDictionaryTestCase.scala
----------------------------------------------------------------------
diff --git 
a/integration/spark-common-cluster-test/src/test/scala/org/apache/carbondata/cluster/sdv/generated/CreateTableWithLocalDictionaryTestCase.scala
 
b/integration/spark-common-cluster-test/src/test/scala/org/apache/carbondata/cluster/sdv/generated/CreateTableWithLocalDictionaryTestCase.scala
new file mode 100644
index 0000000..48a31b7
--- /dev/null
+++ 
b/integration/spark-common-cluster-test/src/test/scala/org/apache/carbondata/cluster/sdv/generated/CreateTableWithLocalDictionaryTestCase.scala
@@ -0,0 +1,2102 @@
+package org.apache.carbondata.cluster.sdv.generated
+
+import org.apache.spark.sql.test.util.QueryTest
+import org.scalatest.BeforeAndAfterAll
+
+import 
org.apache.carbondata.common.exceptions.sql.MalformedCarbonCommandException
+
+class CreateTableWithLocalDictionaryTestCase extends QueryTest with 
BeforeAndAfterAll {
+
+  override protected def beforeAll(): Unit = {
+    sql("DROP TABLE IF EXISTS LOCAL1")
+  }
+
+  test("test local dictionary default configuration") {
+    sql("drop table if exists local1")
+    sql(
+      """
+        | CREATE TABLE local1(id int, name string, city string, age int)
+        | STORED BY 'org.apache.carbondata.format'
+      """.stripMargin)
+
+    val desc_result = sql("describe formatted local1")
+
+    val descLoc = sql("describe formatted local1").collect
+    descLoc.find(_.get(0).toString.contains("Local Dictionary Enabled")) match 
{
+      case Some(row) => assert(row.get(1).toString.contains("true"))
+    }
+    descLoc.find(_.get(0).toString.contains("Local Dictionary Threshold")) 
match {
+      case Some(row) => assert(row.get(1).toString.contains("1000"))
+    }
+  }
+
+  test("test local dictionary custom configurations for local dict columns 
_001") {
+    sql("drop table if exists local1")
+    sql(
+      """
+        | CREATE TABLE local1(id int, name string, city string, age int)
+        | STORED BY 'org.apache.carbondata.format'
+        | tblproperties('local_dictionary_include'='name')
+      """.
+        stripMargin)
+    val descFormatted1 = sql("describe formatted local1").collect
+    descFormatted1.find(_.get(0).toString.contains("Local Dictionary 
Enabled")) match {
+      case Some(row) => assert(row.get(1).toString.contains("true"))
+    }
+    descFormatted1.find(_.get(0).toString.contains("Local Dictionary 
Include")) match {
+      case Some(row) => assert(row.get(1).toString.contains("name"))
+    }
+  }
+
+  test(
+    "test local dictionary custom configurations for local dict columns _002")
+  {
+    sql("drop table if exists local1")
+
+    intercept[MalformedCarbonCommandException] {
+      sql(
+        """
+          | CREATE TABLE local1(id int, name string, city string, age int)
+          | STORED BY 'org.apache.carbondata.format'
+          | tblproperties('local_dictionary_include'='name,name')
+        """.stripMargin)
+    }
+  }
+
+  test("test local dictionary custom configurations for local dict columns 
_003") {
+    sql("drop table if exists local1")
+    val exception = intercept[MalformedCarbonCommandException] {
+      sql(
+        """
+          | CREATE TABLE local1(id int, name string, city string, age int)
+          | STORED BY 'org.apache.carbondata.format'
+          | tblproperties('local_dictionary_include'='')
+        """.
+          stripMargin)
+    }
+    assert(exception.getMessage
+      .contains(
+        "LOCAL_DICTIONARY_INCLUDE/LOCAL_DICTIONARY_EXCLUDE column:  does not 
exist in table. Please check " +
+        "create table statement"))
+  }
+
+  test("test local dictionary custom configurations for local dict columns 
_004") {
+    sql("drop table if exists local1")
+    val exception1 = intercept[MalformedCarbonCommandException] {
+      sql(
+        """
+          | CREATE TABLE local1(id int, name string, city string, age int)
+          | STORED BY 'org.apache.carbondata.format'
+          | tblproperties('local_dictionary_include'='abc')
+        """.
+          stripMargin)
+    }
+    assert(exception1.getMessage
+      .contains(
+        "LOCAL_DICTIONARY_INCLUDE/LOCAL_DICTIONARY_EXCLUDE column: abc does 
not exist in table. Please check " +
+        "create table " +
+        "statement"))
+  }
+
+  test("test local dictionary custom configurations for local dict columns 
_005") {
+    sql("drop table if exists local1")
+    val exception = intercept[MalformedCarbonCommandException] {
+      sql(
+        """
+          | CREATE TABLE local1(id int, name string, city string, age int)
+          | STORED BY 'org.apache.carbondata.format'
+          | tblproperties('local_dictionary_include'='id')
+        """.
+          stripMargin)
+    }
+    assert(exception.getMessage
+      .contains(
+        "LOCAL_DICTIONARY_INCLUDE/LOCAL_DICTIONARY_EXCLUDE column: id is not a 
String/complex datatype column. " +
+        "LOCAL_DICTIONARY_COLUMN should " +
+        "be no dictionary string/complex datatype column"))
+  }
+
+  test("test local dictionary custom configurations for local dict columns 
_006") {
+    sql("drop table if exists local1")
+    intercept[MalformedCarbonCommandException] {
+      sql(
+        """
+          | CREATE TABLE local1(id int, name string, city string, age int)
+          | STORED BY 'org.apache.carbondata.format'
+          | 
tblproperties('dictionary_include'='name','local_dictionary_include'='name')
+        """.
+          stripMargin)
+    }
+  }
+
+  test("test local dictionary custom configurations for local dict threshold 
_001") {
+    sql("drop table if exists local1")
+    sql(
+      """
+        | CREATE TABLE local1(id int, name string, city string, age int)
+        | STORED BY 'org.apache.carbondata.format'
+        | tblproperties('local_dictionary_threshold'='10000')
+      """.stripMargin)
+
+    val descLoc = sql("describe formatted local1").collect
+    descLoc.find(_.get(0).toString.contains("Local Dictionary Enabled")) match 
{
+      case Some(row) => assert(row.get(1).toString.contains("true"))
+    }
+    descLoc.find(_.get(0).toString.contains("Local Dictionary Threshold")) 
match {
+      case Some(row) => assert(row.get(1).toString.contains("10000"))
+    }
+  }
+
+  test("test local dictionary custom configurations for local dict threshold 
_002")
+  {
+    sql("drop table if exists local1")
+    sql(
+      """
+        | CREATE TABLE local1(id int, name string, city string, age int)
+        | STORED BY 'org.apache.carbondata.format'
+        | tblproperties('local_dictionary_threshold'='-100')
+      """.stripMargin)
+
+    val descLoc = sql("describe formatted local1").collect
+    descLoc.find(_.get(0).toString.contains("Local Dictionary Threshold")) 
match {
+      case Some(row) => assert(row.get(1).toString.contains("1000"))
+    }
+  }
+
+  test("test local dictionary custom configurations for local dict threshold 
_003")
+  {
+    sql("drop table if exists local1")
+    sql(
+      """
+        | CREATE TABLE local1(id int, name string, city string, age int)
+        | STORED BY 'org.apache.carbondata.format'
+        | tblproperties('local_dictionary_threshold'='21474874811')
+      """.stripMargin)
+
+    val descLoc = sql("describe formatted local1").collect
+    descLoc.find(_.get(0).toString.contains("Local Dictionary Threshold")) 
match {
+      case Some(row) => assert(row.get(1).toString.contains("1000"))
+    }
+  }
+
+  test("test local dictionary custom configurations for local dict threshold 
_004")
+  {
+    sql("drop table if exists local1")
+    sql(
+      """
+        | CREATE TABLE local1(id int, name string, city string, age int)
+        | STORED BY 'org.apache.carbondata.format'
+        | tblproperties('local_dictionary_threshold'='')
+      """.stripMargin)
+
+    val descLoc = sql("describe formatted local1").collect
+    descLoc.find(_.get(0).toString.contains("Local Dictionary Threshold")) 
match {
+      case Some(row) => assert(row.get(1).toString.contains("1000"))
+    }
+  }
+
+  test("test local dictionary custom configurations for local dict threshold 
_005")
+  {
+    sql("drop table if exists local1")
+    sql(
+      """
+        | CREATE TABLE local1(id int, name string, city string, age int)
+        | STORED BY 'org.apache.carbondata.format'
+        | tblproperties('local_dictionary_threshold'='hello')
+      """.stripMargin)
+
+    val descLoc = sql("describe formatted local1").collect
+    descLoc.find(_.get(0).toString.contains("Local Dictionary Threshold")) 
match {
+      case Some(row) => assert(row.get(1).toString.contains("1000"))
+    }
+  }
+
+  test("test local dictionary custom configurations with both columns and 
threshold configured " +
+       "_001")
+  {
+    sql("drop table if exists local1")
+    sql(
+      """
+        | CREATE TABLE local1(id int, name string, city string, age int)
+        | STORED BY 'org.apache.carbondata.format'
+        | 
tblproperties('local_dictionary_threshold'='10000','local_dictionary_include'='name')
+      """.stripMargin)
+
+    val descLoc = sql("describe formatted local1").collect
+    descLoc.find(_.get(0).toString.contains("Local Dictionary Enabled")) match 
{
+      case Some(row) => assert(row.get(1).toString.contains("true"))
+    }
+    sql("desc formatted local1").show(truncate = false)
+    descLoc.find(_.get(0).toString.contains("Local Dictionary Threshold")) 
match {
+      case Some(row) => assert(row.get(1).toString.contains("10000"))
+    }
+    descLoc.find(_.get(0).toString.contains("Local Dictionary Include")) match 
{
+      case Some(row) => assert(row.get(1).toString.contains("name"))
+    }
+  }
+
+  test("test local dictionary custom configurations with both columns and 
threshold configured " +
+       "_002")
+  {
+    sql("drop table if exists local1")
+    sql(
+      """
+        | CREATE TABLE local1(id int, name string, city string, age int)
+        | STORED BY 'org.apache.carbondata.format'
+        | 
tblproperties('local_dictionary_threshold'='-100','local_dictionary_include'='name')
+      """.stripMargin)
+
+    val descLoc = sql("describe formatted local1").collect
+    descLoc.find(_.get(0).toString.contains("Local Dictionary Enabled")) match 
{
+      case Some(row) => assert(row.get(1).toString.contains("true"))
+    }
+    sql("desc formatted local1").show(truncate = false)
+    descLoc.find(_.get(0).toString.contains("Local Dictionary Threshold")) 
match {
+      case Some(row) => assert(row.get(1).toString.contains("1000"))
+    }
+    descLoc.find(_.get(0).toString.contains("Local Dictionary Include")) match 
{
+      case Some(row) => assert(row.get(1).toString.contains("name"))
+    }
+  }
+
+  test("test local dictionary custom configurations with both columns and 
threshold configured " +
+       "_003")
+  {
+    sql("drop table if exists local1")
+    sql(
+      """
+        | CREATE TABLE local1(id int, name string, city string, age int)
+        | STORED BY 'org.apache.carbondata.format'
+        | 
tblproperties('local_dictionary_threshold'='','local_dictionary_include'='name')
+      """.stripMargin)
+
+    val descLoc = sql("describe formatted local1").collect
+    descLoc.find(_.get(0).toString.contains("Local Dictionary Enabled")) match 
{
+      case Some(row) => assert(row.get(1).toString.contains("true"))
+    }
+    sql("desc formatted local1").show(truncate = false)
+    descLoc.find(_.get(0).toString.contains("Local Dictionary Threshold")) 
match {
+      case Some(row) => assert(row.get(1).toString.contains("1000"))
+    }
+    descLoc.find(_.get(0).toString.contains("Local Dictionary Include")) match 
{
+      case Some(row) => assert(row.get(1).toString.contains("name"))
+    }
+  }
+
+  test("test local dictionary custom configurations with both columns and 
threshold configured " +
+       "_004")
+  {
+    sql("drop table if exists local1")
+    sql(
+      """
+        | CREATE TABLE local1(id int, name string, city string, age int)
+        | STORED BY 'org.apache.carbondata.format'
+        | 
tblproperties('local_dictionary_threshold'='vdslv','local_dictionary_include'='name')
+      """.stripMargin)
+
+    val descLoc = sql("describe formatted local1").collect
+    descLoc.find(_.get(0).toString.contains("Local Dictionary Enabled")) match 
{
+      case Some(row) => assert(row.get(1).toString.contains("true"))
+    }
+    sql("desc formatted local1").show(truncate = false)
+    descLoc.find(_.get(0).toString.contains("Local Dictionary Threshold")) 
match {
+      case Some(row) => assert(row.get(1).toString.contains("1000"))
+    }
+    descLoc.find(_.get(0).toString.contains("Local Dictionary Include")) match 
{
+      case Some(row) => assert(row.get(1).toString.contains("name"))
+    }
+  }
+
+  test("test local dictionary custom configurations with both columns and 
threshold configured " +
+       "_005")
+  {
+    sql("drop table if exists local1")
+    intercept[MalformedCarbonCommandException] {
+      sql(
+        """
+          | CREATE TABLE local1(id int, name string, city string, age int)
+          | STORED BY 'org.apache.carbondata.format'
+          | 
tblproperties('local_dictionary_threshold'='10000','local_dictionary_include'='name,name')
+        """.stripMargin)
+    }
+  }
+
+  test("test local dictionary custom configurations with both columns and 
threshold configured " +
+       "_006")
+  {
+    sql("drop table if exists local1")
+    intercept[MalformedCarbonCommandException] {
+      sql(
+        """
+          | CREATE TABLE local1(id int, name string, city string, age int)
+          | STORED BY 'org.apache.carbondata.format'
+          | 
tblproperties('local_dictionary_threshold'='10000','local_dictionary_include'=' 
')
+        """.stripMargin)
+    }
+  }
+
+  test("test local dictionary custom configurations with both columns and 
threshold configured " +
+       "_007")
+  {
+    sql("drop table if exists local1")
+    intercept[MalformedCarbonCommandException] {
+      sql(
+        """
+          | CREATE TABLE local1(id int, name string, city string, age int)
+          | STORED BY 'org.apache.carbondata.format'
+          | 
tblproperties('local_dictionary_threshold'='10000','local_dictionary_include'='hello')
+        """.stripMargin)
+    }
+  }
+
+  test("test local dictionary custom configurations with both columns and 
threshold configured " +
+       "_008")
+  {
+    sql("drop table if exists local1")
+    intercept[MalformedCarbonCommandException] {
+      sql(
+        """
+          | CREATE TABLE local1(id int, name string, city string, age int)
+          | STORED BY 'org.apache.carbondata.format'
+          | 
tblproperties('local_dictionary_threshold'='10000','local_dictionary_include'='name',
+          | 'dictionary_include'='name')
+        """.stripMargin)
+    }
+  }
+
+  test("test local dictionary custom configurations with both columns and 
threshold configured " +
+       "_009")
+  {
+    sql("drop table if exists local1")
+    intercept[MalformedCarbonCommandException] {
+      sql(
+        """
+          | CREATE TABLE local1(id int, name string, city string, age int)
+          | STORED BY 'org.apache.carbondata.format'
+          | 
tblproperties('local_dictionary_threshold'='','local_dictionary_include'='name,name')
+        """.stripMargin)
+    }
+  }
+
+  test("test local dictionary custom configurations with both columns and 
threshold configured " +
+       "_010")
+  {
+    sql("drop table if exists local1")
+    intercept[MalformedCarbonCommandException] {
+      sql(
+        """
+          | CREATE TABLE local1(id int, name string, city string, age int)
+          | STORED BY 'org.apache.carbondata.format'
+          | 
tblproperties('local_dictionary_threshold'='-100','local_dictionary_include'='Hello')
+        """.stripMargin)
+    }
+  }
+
+  test("test local dictionary custom configurations with both columns and 
threshold configured " +
+       "_011")
+  {
+    sql("drop table if exists local1")
+    intercept[MalformedCarbonCommandException] {
+      sql(
+        """
+          | CREATE TABLE local1(id int, name string, city string, age int)
+          | STORED BY 'org.apache.carbondata.format'
+          | tblproperties('local_dictionary_threshold'='23213497321591234324',
+          | 'local_dictionary_include'='name','dictionary_include'='name')
+        """.stripMargin)
+    }
+  }
+
+  test("test local dictionary default configuration when enabled") {
+    sql("drop table if exists local1")
+    sql(
+      """
+        | CREATE TABLE local1(id int, name string, city string, age int)
+        | STORED BY 'org.apache.carbondata.format' 
tblproperties('local_dictionary_enable'='true')
+      """.stripMargin)
+
+    val desc_result = sql("describe formatted local1")
+
+    val descLoc = sql("describe formatted local1").collect
+    descLoc.find(_.get(0).toString.contains("Local Dictionary Enabled")) match 
{
+      case Some(row) => assert(row.get(1).toString.contains("true"))
+    }
+    descLoc.find(_.get(0).toString.contains("Local Dictionary Threshold")) 
match {
+      case Some(row) => assert(row.get(1).toString.contains("1000"))
+    }
+  }
+
+  test("test local dictionary custom configurations when enabled for local 
dict columns _001") {
+    sql("drop table if exists local1")
+    sql(
+      """
+        | CREATE TABLE local1(id int, name string, city string, age int)
+        | STORED BY 'org.apache.carbondata.format'
+        | 
tblproperties('local_dictionary_include'='name','local_dictionary_enable'='true')
+      """.
+        stripMargin)
+    val descFormatted1 = sql("describe formatted local1").collect
+    descFormatted1.find(_.get(0).toString.contains("Local Dictionary 
Enabled")) match {
+      case Some(row) => assert(row.get(1).toString.contains("true"))
+    }
+    descFormatted1.find(_.get(0).toString.contains("Local Dictionary 
Include")) match {
+      case Some(row) => assert(row.get(1).toString.contains("name"))
+    }
+  }
+
+  test("test local dictionary custom configurations when enabled for local 
dict columns _002")
+  {
+    sql("drop table if exists local1")
+
+    intercept[MalformedCarbonCommandException] {
+      sql(
+        """
+          | CREATE TABLE local1(id int, name string, city string, age int)
+          | STORED BY 'org.apache.carbondata.format'
+          | 
tblproperties('local_dictionary_enable'='true','local_dictionary_include'='name,name')
+        """.stripMargin)
+    }
+  }
+
+  test("test local dictionary custom configurations when enabled for local 
dict columns _003") {
+    sql("drop table if exists local1")
+    val exception = intercept[MalformedCarbonCommandException] {
+      sql(
+        """
+          | CREATE TABLE local1(id int, name string, city string, age int)
+          | STORED BY 'org.apache.carbondata.format'
+          | 
tblproperties('local_dictionary_enable'='true','local_dictionary_include'='')
+        """.
+          stripMargin)
+    }
+    assert(exception.getMessage
+      .contains(
+        "LOCAL_DICTIONARY_INCLUDE/LOCAL_DICTIONARY_EXCLUDE column:  does not 
exist in table. Please check " +
+        "create table statement"))
+
+  }
+
+  test("test local dictionary custom configurations when enabled for local 
dict columns _004") {
+    sql("drop table if exists local1")
+    val exception1 = intercept[MalformedCarbonCommandException] {
+      sql(
+        """
+          | CREATE TABLE local1(id int, name string, city string, age int)
+          | STORED BY 'org.apache.carbondata.format'
+          | 
tblproperties('local_dictionary_enable'='true','local_dictionary_include'='abc')
+        """.
+          stripMargin)
+    }
+    assert(exception1.getMessage
+      .contains(
+        "LOCAL_DICTIONARY_INCLUDE/LOCAL_DICTIONARY_EXCLUDE column: abc does 
not exist in table. Please check " +
+        "create table " +
+        "statement"))
+  }
+
+  test("test local dictionary custom configurations when enabled for local 
dict columns _005") {
+    sql("drop table if exists local1")
+    val exception = intercept[MalformedCarbonCommandException] {
+      sql(
+        """
+          | CREATE TABLE local1(id int, name string, city string, age int)
+          | STORED BY 'org.apache.carbondata.format'
+          | 
tblproperties('local_dictionary_enable'='true','local_dictionary_include'='id')
+        """.
+          stripMargin)
+    }
+    assert(exception.getMessage
+      .contains(
+        "LOCAL_DICTIONARY_INCLUDE/LOCAL_DICTIONARY_EXCLUDE column: id is not a 
String/complex datatype column. " +
+        "LOCAL_DICTIONARY_COLUMN should " +
+        "be no dictionary string/complex datatype column"))
+  }
+
+  test("test local dictionary custom configurations when enabled for local 
dict columns _006") {
+    sql("drop table if exists local1")
+    intercept[MalformedCarbonCommandException] {
+      sql(
+        """
+          | CREATE TABLE local1(id int, name string, city string, age int)
+          | STORED BY 'org.apache.carbondata.format'
+          | 
tblproperties('local_dictionary_enable'='true','dictionary_include'='name',
+          | 'local_dictionary_include'='name')
+        """.
+          stripMargin)
+    }
+  }
+
+  test("test local dictionary custom configurations when 
local_dictionary_exclude is configured _001") {
+    sql("drop table if exists local1")
+    sql(
+      """
+        | CREATE TABLE local1(id int, name string, city string, age int)
+        | STORED BY 'org.apache.carbondata.format'
+        | 
tblproperties('local_dictionary_exclude'='name','local_dictionary_enable'='true')
+      """.
+        stripMargin)
+    val descFormatted1 = sql("describe formatted local1").collect
+    descFormatted1.find(_.get(0).toString.contains("Local Dictionary 
Enabled")) match {
+      case Some(row) => assert(row.get(1).toString.contains("true"))
+    }
+    descFormatted1.find(_.get(0).toString.contains("Local Dictionary 
Exclude")) match {
+      case Some(row) => assert(row.get(1).toString.contains("name"))
+    }
+  }
+
+  test("test local dictionary custom configurations when 
local_dictionary_exclude is configured _002")
+  {
+    sql("drop table if exists local1")
+
+    intercept[MalformedCarbonCommandException] {
+      sql(
+        """
+          | CREATE TABLE local1(id int, name string, city string, age int)
+          | STORED BY 'org.apache.carbondata.format'
+          | 
tblproperties('local_dictionary_enable'='true','local_dictionary_exclude'='name,name')
+        """.stripMargin)
+    }
+  }
+
+  test("test local dictionary custom configurations when 
local_dictionary_exclude is configured _003") {
+    sql("drop table if exists local1")
+    val exception = intercept[MalformedCarbonCommandException] {
+      sql(
+        """
+          | CREATE TABLE local1(id int, name string, city string, age int)
+          | STORED BY 'org.apache.carbondata.format'
+          | 
tblproperties('local_dictionary_enable'='true','local_dictionary_exclude'='')
+        """.
+          stripMargin)
+    }
+    assert(exception.getMessage
+      .contains(
+        "LOCAL_DICTIONARY_INCLUDE/LOCAL_DICTIONARY_EXCLUDE column:  does not 
exist in table. Please check " +
+        "create table statement"))
+
+  }
+
+  test("test local dictionary custom configurations when 
local_dictionary_exclude is configured _004") {
+    sql("drop table if exists local1")
+    val exception1 = intercept[MalformedCarbonCommandException] {
+      sql(
+        """
+          | CREATE TABLE local1(id int, name string, city string, age int)
+          | STORED BY 'org.apache.carbondata.format'
+          | 
tblproperties('local_dictionary_enable'='true','local_dictionary_exclude'='abc')
+        """.
+          stripMargin)
+    }
+    assert(exception1.getMessage
+      .contains(
+        "LOCAL_DICTIONARY_INCLUDE/LOCAL_DICTIONARY_EXCLUDE column: abc does 
not exist in table. Please check " +
+        "create table " +
+        "statement"))
+  }
+
+  test("test local dictionary custom configurations when 
local_dictionary_exclude is configured _005") {
+    sql("drop table if exists local1")
+    val exception = intercept[MalformedCarbonCommandException] {
+      sql(
+        """
+          | CREATE TABLE local1(id int, name string, city string, age int)
+          | STORED BY 'org.apache.carbondata.format'
+          | 
tblproperties('local_dictionary_enable'='true','local_dictionary_exclude'='id')
+        """.
+          stripMargin)
+    }
+    assert(exception.getMessage
+      .contains(
+        "LOCAL_DICTIONARY_INCLUDE/LOCAL_DICTIONARY_EXCLUDE column: id is not a 
String/complex datatype column. " +
+        "LOCAL_DICTIONARY_COLUMN should " +
+        "be no dictionary string/complex datatype column"))
+  }
+
+  test("test local dictionary custom configurations when 
local_dictionary_exclude is configured _006") {
+    sql("drop table if exists local1")
+    intercept[MalformedCarbonCommandException] {
+      sql(
+        """
+          | CREATE TABLE local1(id int, name string, city string, age int)
+          | STORED BY 'org.apache.carbondata.format'
+          | 
tblproperties('local_dictionary_enable'='true','dictionary_include'='name',
+          | 'local_dictionary_exclude'='name')
+        """.
+          stripMargin)
+    }
+  }
+
+  test(
+    "test local dictionary custom configurations when local_dictionary_include 
and local_dictionary_exclude " +
+    "is configured _001")
+  {
+    sql("drop table if exists local1")
+    sql(
+      """
+        | CREATE TABLE local1(id int, name string, city string, age int)
+        | STORED BY 'org.apache.carbondata.format'
+        | 
tblproperties('local_dictionary_exclude'='name','local_dictionary_include'='city',
+        | 'local_dictionary_enable'='true')
+      """.
+        stripMargin)
+
+    val descFormatted1 = sql("describe formatted local1").collect
+
+    descFormatted1.find(_.get(0).toString.contains("Local Dictionary 
Enabled")) match {
+      case Some(row) => assert(row.get(1).toString.contains("true"))
+    }
+    descFormatted1.find(_.get(0).toString.contains("Local Dictionary 
Exclude")) match {
+      case Some(row) => assert(row.get(1).toString.contains("name"))
+    }
+    descFormatted1.find(_.get(0).toString.contains("Local Dictionary 
Include")) match {
+      case Some(row) => assert(row.get(1).toString.contains("city"))
+    }
+  }
+
+  test(
+    "test local dictionary custom configurations when local_dictionary_include 
and local_dictionary_exclude " +
+    "is configured _002") {
+    sql("drop table if exists local1")
+    sql(
+      """
+        | CREATE TABLE local1(id int, name string, city string, age int,add 
string)
+        | STORED BY 'org.apache.carbondata.format'
+        | 
tblproperties('local_dictionary_exclude'='name','local_dictionary_include'='city','sort_columns'='add',
+        | 'local_dictionary_enable'='true')
+      """.
+        stripMargin)
+
+    val descFormatted1 = sql("describe formatted local1").collect
+
+    descFormatted1.find(_.get(0).toString.contains("Local Dictionary 
Enabled")) match {
+      case Some(row) => assert(row.get(1).toString.contains("true"))
+    }
+    descFormatted1.find(_.get(0).toString.contains("Local Dictionary 
Exclude")) match {
+      case Some(row) => assert(row.get(1).toString.contains("name"))
+    }
+    descFormatted1.find(_.get(0).toString.contains("Local Dictionary 
Include")) match {
+      case Some(row) => assert(row.get(1).toString.contains("city"))
+    }
+  }
+
+  test(
+    "test local dictionary custom configurations when local_dictionary_include 
and local_dictionary_exclude " +
+    "is configured _003")
+  {
+    sql("drop table if exists local1")
+    sql(
+      """
+        | CREATE TABLE local1(id int, name string, city string, age int)
+        | STORED BY 'org.apache.carbondata.format'
+        | 
tblproperties('local_dictionary_exclude'='name','local_dictionary_include'='city',
+        | 'local_dictionary_enable'='false')
+      """.
+        stripMargin)
+    val descFormatted1 = sql("describe formatted local1").collect
+    descFormatted1.find(_.get(0).toString.contains("Local Dictionary 
Enabled")) match {
+      case Some(row) => assert(row.get(1).toString.contains("false"))
+    }
+
+    checkExistence(sql("describe formatted local1"), false, "Local Dictionary 
Include")
+    checkExistence(sql("describe formatted local1"), false, "Local Dictionary 
Exclude")
+  }
+
+  test(
+    "test local dictionary custom configurations when local_dictionary_include 
and local_dictionary_exclude " +
+    "is configured _004")
+  {
+    sql("drop table if exists local1")
+    intercept[MalformedCarbonCommandException] {
+      sql(
+        """
+          | CREATE TABLE local1(id int, name string, city string, age int)
+          | STORED BY 'org.apache.carbondata.format'
+          | 
tblproperties('local_dictionary_exclude'='name','local_dictionary_include'='city',
+          | 'local_dictionary_enable'='true','dictionary_include'='name,city')
+        """.
+          stripMargin)
+    }
+  }
+
+  test(
+    "test local dictionary custom configurations when local_dictionary_include 
and local_dictionary_exclude " +
+    "is configured _005")
+  {
+    sql("drop table if exists local1")
+    intercept[MalformedCarbonCommandException] {
+      sql(
+        """
+          | CREATE TABLE local1(id int, name string, city string, age int)
+          | STORED BY 'org.apache.carbondata.format'
+          | 
tblproperties('local_dictionary_enable'='true','local_dictionary_include'='name,city',
+          | 'local_dictionary_exclude'='name')
+        """.
+          stripMargin)
+    }
+  }
+
+  test(
+    "test local dictionary custom configurations when local_dictionary_include 
and local_dictionary_exclude " +
+    "is configured _006")
+  {
+    sql("drop table if exists local1")
+    sql(
+      """
+        | CREATE TABLE local1(id int, name string, city string, age int,st 
struct<s_id:int,
+        | s_name:string,s_city:array<string>>)
+        | STORED BY 'org.apache.carbondata.format'
+        | 
tblproperties('local_dictionary_exclude'='name','local_dictionary_include'='city,st',
+        | 'local_dictionary_enable'='true')
+      """.
+        stripMargin)
+    val descFormatted1 = sql("describe formatted local1").collect
+    descFormatted1.find(_.get(0).toString.contains("Local Dictionary 
Enabled")) match {
+      case Some(row) => assert(row.get(1).toString.contains("true"))
+    }
+    descFormatted1.find(_.get(0).toString.contains("Local Dictionary 
Include")) match {
+      case Some(row) => assert(row.get(1).toString.contains("city,st"))
+    }
+  }
+
+  test(
+    "test local dictionary custom configurations when local_dictionary_include 
and local_dictionary_exclude " +
+    "is configured _007")
+  {
+    sql("drop table if exists local1")
+    sql(
+      """
+        | CREATE TABLE local1(id int, name string, city string, age int,st 
array<struct<s_id:int,
+        | s_name:string>>)
+        | STORED BY 'org.apache.carbondata.format'
+        | 
tblproperties('local_dictionary_exclude'='name','local_dictionary_include'='city,st',
+        | 'local_dictionary_enable'='true')
+      """.
+        stripMargin)
+    val descFormatted1 = sql("describe formatted local1").collect
+    descFormatted1.find(_.get(0).toString.contains("Local Dictionary 
Enabled")) match {
+      case Some(row) => assert(row.get(1).toString.contains("true"))
+    }
+    descFormatted1.find(_.get(0).toString.contains("Local Dictionary 
Include")) match {
+      case Some(row) => assert(row.get(1).toString.contains("city,st"))
+    }
+  }
+
+  test("test local dictionary custom configurations when enabled for local 
dict threshold _001") {
+    sql("drop table if exists local1")
+    sql(
+      """
+        | CREATE TABLE local1(id int, name string, city string, age int)
+        | STORED BY 'org.apache.carbondata.format'
+        | 
tblproperties('local_dictionary_enable'='true','local_dictionary_threshold'='10000')
+      """.stripMargin)
+
+    val descLoc = sql("describe formatted local1").collect
+    descLoc.find(_.get(0).toString.contains("Local Dictionary Enabled")) match 
{
+      case Some(row) => assert(row.get(1).toString.contains("true"))
+    }
+    descLoc.find(_.get(0).toString.contains("Local Dictionary Threshold")) 
match {
+      case Some(row) => assert(row.get(1).toString.contains("10000"))
+    }
+  }
+
+  test("test local dictionary custom configurations when enabled for local 
dict threshold _002")
+  {
+    sql("drop table if exists local1")
+    sql(
+      """
+        | CREATE TABLE local1(id int, name string, city string, age int)
+        | STORED BY 'org.apache.carbondata.format'
+        | 
tblproperties('local_dictionary_enable'='true','local_dictionary_threshold'='-100')
+      """.stripMargin)
+
+    val descLoc = sql("describe formatted local1").collect
+    descLoc.find(_.get(0).toString.contains("Local Dictionary Threshold")) 
match {
+      case Some(row) => assert(row.get(1).toString.contains("1000"))
+    }
+  }
+
+  test("test local dictionary custom configurations when enabled for local 
dict threshold _003")
+  {
+    sql("drop table if exists local1")
+    sql(
+      """
+        | CREATE TABLE local1(id int, name string, city string, age int)
+        | STORED BY 'org.apache.carbondata.format'
+        | 
tblproperties('local_dictionary_enable'='true','local_dictionary_threshold'='21474874811')
+      """.stripMargin)
+
+    val descLoc = sql("describe formatted local1").collect
+    descLoc.find(_.get(0).toString.contains("Local Dictionary Threshold")) 
match {
+      case Some(row) => assert(row.get(1).toString.contains("1000"))
+    }
+  }
+
+  test("test local dictionary custom configurations when enabled for local 
dict threshold _004")
+  {
+    sql("drop table if exists local1")
+    sql(
+      """
+        | CREATE TABLE local1(id int, name string, city string, age int)
+        | STORED BY 'org.apache.carbondata.format'
+        | 
tblproperties('local_dictionary_enable'='true','local_dictionary_threshold'='')
+      """.stripMargin)
+
+    val descLoc = sql("describe formatted local1").collect
+    descLoc.find(_.get(0).toString.contains("Local Dictionary Threshold")) 
match {
+      case Some(row) => assert(row.get(1).toString.contains("1000"))
+    }
+  }
+
+  test("test local dictionary custom configurations when enabled for local 
dict threshold _005")
+  {
+    sql("drop table if exists local1")
+    sql(
+      """
+        | CREATE TABLE local1(id int, name string, city string, age int)
+        | STORED BY 'org.apache.carbondata.format'
+        | 
tblproperties('local_dictionary_enable'='true','local_dictionary_threshold'='hello')
+      """.stripMargin)
+
+    val descLoc = sql("describe formatted local1").collect
+    descLoc.find(_.get(0).toString.contains("Local Dictionary Threshold")) 
match {
+      case Some(row) => assert(row.get(1).toString.contains("1000"))
+    }
+  }
+
+  test(
+    "test local dictionary custom configurations when enabled with both 
columns and threshold " +
+    "configured _001")
+  {
+    sql("drop table if exists local1")
+    sql(
+      """
+        | CREATE TABLE local1(id int, name string, city string, age int)
+        | STORED BY 'org.apache.carbondata.format'
+        | 
tblproperties('local_dictionary_enable'='true','local_dictionary_threshold'='10000',
+        | 'local_dictionary_include'='name')
+      """.stripMargin)
+
+    val descLoc = sql("describe formatted local1").collect
+    descLoc.find(_.get(0).toString.contains("Local Dictionary Enabled")) match 
{
+      case Some(row) => assert(row.get(1).toString.contains("true"))
+    }
+    sql("desc formatted local1").show(truncate = false)
+    descLoc.find(_.get(0).toString.contains("Local Dictionary Threshold")) 
match {
+      case Some(row) => assert(row.get(1).toString.contains("10000"))
+    }
+    descLoc.find(_.get(0).toString.contains("Local Dictionary Include")) match 
{
+      case Some(row) => assert(row.get(1).toString.contains("name"))
+    }
+  }
+
+  test(
+    "test local dictionary custom configurations when enabled with both 
columns and threshold " +
+    "configured _002")
+  {
+    sql("drop table if exists local1")
+    sql(
+      """
+        | CREATE TABLE local1(id int, name string, city string, age int)
+        | STORED BY 'org.apache.carbondata.format'
+        | 
tblproperties('local_dictionary_enable'='true','local_dictionary_threshold'='-100',
+        | 'local_dictionary_include'='name')
+      """.stripMargin)
+
+    val descLoc = sql("describe formatted local1").collect
+    descLoc.find(_.get(0).toString.contains("Local Dictionary Enabled")) match 
{
+      case Some(row) => assert(row.get(1).toString.contains("true"))
+    }
+    sql("desc formatted local1").show(truncate = false)
+    descLoc.find(_.get(0).toString.contains("Local Dictionary Threshold")) 
match {
+      case Some(row) => assert(row.get(1).toString.contains("1000"))
+    }
+    descLoc.find(_.get(0).toString.contains("Local Dictionary Include")) match 
{
+      case Some(row) => assert(row.get(1).toString.contains("name"))
+    }
+  }
+
+  test(
+    "test local dictionary custom configurations when enabled with both 
columns and threshold " +
+    "configured _003")
+  {
+    sql("drop table if exists local1")
+    sql(
+      """
+        | CREATE TABLE local1(id int, name string, city string, age int)
+        | STORED BY 'org.apache.carbondata.format'
+        | 
tblproperties('local_dictionary_enable'='true','local_dictionary_threshold'='',
+        | 'local_dictionary_include'='name')
+      """.stripMargin)
+
+    val descLoc = sql("describe formatted local1").collect
+    descLoc.find(_.get(0).toString.contains("Local Dictionary Enabled")) match 
{
+      case Some(row) => assert(row.get(1).toString.contains("true"))
+    }
+    sql("desc formatted local1").show(truncate = false)
+    descLoc.find(_.get(0).toString.contains("Local Dictionary Threshold")) 
match {
+      case Some(row) => assert(row.get(1).toString.contains("1000"))
+    }
+    descLoc.find(_.get(0).toString.contains("Local Dictionary Include")) match 
{
+      case Some(row) => assert(row.get(1).toString.contains("name"))
+    }
+  }
+
+  test(
+    "test local dictionary custom configurations when enabled with both 
columns and threshold " +
+    "configured _004")
+  {
+    sql("drop table if exists local1")
+    sql(
+      """
+        | CREATE TABLE local1(id int, name string, city string, age int)
+        | STORED BY 'org.apache.carbondata.format'
+        | 
tblproperties('local_dictionary_enable'='true','local_dictionary_threshold'='vdslv',
+        | 'local_dictionary_include'='name')
+      """.stripMargin)
+
+    val descLoc = sql("describe formatted local1").collect
+    descLoc.find(_.get(0).toString.contains("Local Dictionary Enabled")) match 
{
+      case Some(row) => assert(row.get(1).toString.contains("true"))
+    }
+    sql("desc formatted local1").show(truncate = false)
+    descLoc.find(_.get(0).toString.contains("Local Dictionary Threshold")) 
match {
+      case Some(row) => assert(row.get(1).toString.contains("1000"))
+    }
+    descLoc.find(_.get(0).toString.contains("Local Dictionary Include")) match 
{
+      case Some(row) => assert(row.get(1).toString.contains("name"))
+    }
+  }
+
+  test(
+    "test local dictionary custom configurations when enabled with both 
columns and threshold " +
+    "configured _005")
+  {
+    sql("drop table if exists local1")
+    intercept[MalformedCarbonCommandException] {
+      sql(
+        """
+          | CREATE TABLE local1(id int, name string, city string, age int)
+          | STORED BY 'org.apache.carbondata.format'
+          | 
tblproperties('local_dictionary_enable'='true','local_dictionary_threshold'='10000',
+          | 'local_dictionary_include'='name,name')
+        """.stripMargin)
+    }
+  }
+
+  test(
+    "test local dictionary custom configurations when enabled with both 
columns and threshold " +
+    "configured _006")
+  {
+    sql("drop table if exists local1")
+    intercept[MalformedCarbonCommandException] {
+      sql(
+        """
+          | CREATE TABLE local1(id int, name string, city string, age int)
+          | STORED BY 'org.apache.carbondata.format'
+          | 
tblproperties('local_dictionary_enable'='true','local_dictionary_threshold'='10000',
+          | 'local_dictionary_include'=' ')
+        """.stripMargin)
+    }
+  }
+
+  test(
+    "test local dictionary custom configurations when enabled with both 
columns and threshold " +
+    "configured _007")
+  {
+    sql("drop table if exists local1")
+    intercept[MalformedCarbonCommandException] {
+      sql(
+        """
+          | CREATE TABLE local1(id int, name string, city string, age int)
+          | STORED BY 'org.apache.carbondata.format'
+          | 
tblproperties('local_dictionary_enable'='true','local_dictionary_threshold'='10000',
+          | 'local_dictionary_include'='hello')
+        """.stripMargin)
+    }
+  }
+
+  test(
+    "test local dictionary custom configurations when enabled with both 
columns and threshold " +
+    "configured _008")
+  {
+    sql("drop table if exists local1")
+    intercept[MalformedCarbonCommandException] {
+      sql(
+        """
+          | CREATE TABLE local1(id int, name string, city string, age int)
+          | STORED BY 'org.apache.carbondata.format'
+          | 
tblproperties('local_dictionary_enable'='true','local_dictionary_threshold'='10000',
+          | 'local_dictionary_include'='name','dictionary_include'='name')
+        """.stripMargin)
+    }
+  }
+
+  test(
+    "test local dictionary custom configurations when enabled with both 
columns and threshold " +
+    "configured _009")
+  {
+    sql("drop table if exists local1")
+    intercept[MalformedCarbonCommandException] {
+      sql(
+        """
+          | CREATE TABLE local1(id int, name string, city string, age int)
+          | STORED BY 'org.apache.carbondata.format'
+          | 
tblproperties('local_dictionary_enable'='true','local_dictionary_threshold'='',
+          | 'local_dictionary_include'='name,name')
+        """.stripMargin)
+    }
+  }
+
+  test(
+    "test local dictionary custom configurations when enabled with both 
columns and threshold " +
+    "configured _010")
+  {
+    sql("drop table if exists local1")
+    intercept[MalformedCarbonCommandException] {
+      sql(
+        """
+          | CREATE TABLE local1(id int, name string, city string, age int)
+          | STORED BY 'org.apache.carbondata.format'
+          | 
tblproperties('local_dictionary_enable'='true','local_dictionary_threshold'='-100',
+          | 'local_dictionary_include'='Hello')
+        """.stripMargin)
+    }
+  }
+
+  test(
+    "test local dictionary custom configurations when enabled with both 
columns and threshold " +
+    "configured _011")
+  {
+    sql("drop table if exists local1")
+    intercept[MalformedCarbonCommandException] {
+      sql(
+        """
+          | CREATE TABLE local1(id int, name string, city string, age int)
+          | STORED BY 'org.apache.carbondata.format'
+          | tblproperties('local_dictionary_enable'='true',
+          | 
'local_dictionary_threshold'='23213497321591234324','local_dictionary_include'='name',
+          | 'dictionary_include'='name')
+        """.stripMargin)
+    }
+  }
+
+  test("test local dictionary default configuration when disabled") {
+    sql("drop table if exists local1")
+    sql(
+      """
+        | CREATE TABLE local1(id int, name string, city string, age int)
+        | STORED BY 'org.apache.carbondata.format' 
tblproperties('local_dictionary_enable'='false')
+      """.stripMargin)
+
+    val desc_result = sql("describe formatted local1")
+
+    val descLoc = sql("describe formatted local1").collect
+    descLoc.find(_.get(0).toString.contains("Local Dictionary Enabled")) match 
{
+      case Some(row) => assert(row.get(1).toString.contains("false"))
+    }
+  }
+
+  test("test local dictionary custom configurations when disabled for local 
dict columns _001") {
+    sql("drop table if exists local1")
+    sql(
+      """
+        | CREATE TABLE local1(id int, name string, city string, age int)
+        | STORED BY 'org.apache.carbondata.format'
+        | 
tblproperties('local_dictionary_include'='name','local_dictionary_enable'='false')
+      """.
+        stripMargin)
+    val descFormatted1 = sql("describe formatted local1").collect
+    descFormatted1.find(_.get(0).toString.contains("Local Dictionary 
Enabled")) match {
+      case Some(row) => assert(row.get(1).toString.contains("false"))
+    }
+  }
+
+  test("test local dictionary custom configurations when disabled for local 
dict columns _002")
+  {
+    sql("drop table if exists local1")
+    sql(
+      """
+        | CREATE TABLE local1(id int, name string, city string, age int)
+        | STORED BY 'org.apache.carbondata.format'
+        | 
tblproperties('local_dictionary_enable'='false','local_dictionary_include'='name,name')
+      """.stripMargin)
+    val descFormatted1 = sql("describe formatted local1").collect
+    descFormatted1.find(_.get(0).toString.contains("Local Dictionary 
Enabled")) match {
+      case Some(row) => assert(row.get(1).toString.contains("false"))
+    }
+  }
+
+  test("test local dictionary custom configurations when disabled for local 
dict columns _003") {
+    sql("drop table if exists local1")
+    sql(
+      """
+        | CREATE TABLE local1(id int, name string, city string, age int)
+        | STORED BY 'org.apache.carbondata.format'
+        | 
tblproperties('local_dictionary_enable'='false','local_dictionary_include'='')
+      """.
+        stripMargin)
+    val descFormatted1 = sql("describe formatted local1").collect
+    descFormatted1.find(_.get(0).toString.contains("Local Dictionary 
Enabled")) match {
+      case Some(row) => assert(row.get(1).toString.contains("false"))
+    }
+  }
+
+  test("test local dictionary custom configurations when disabled for local 
dict columns _004") {
+    sql("drop table if exists local1")
+    sql(
+      """
+        | CREATE TABLE local1(id int, name string, city string, age int)
+        | STORED BY 'org.apache.carbondata.format'
+        | 
tblproperties('local_dictionary_enable'='false','local_dictionary_include'='abc')
+      """.
+        stripMargin)
+    val descFormatted1 = sql("describe formatted local1").collect
+    descFormatted1.find(_.get(0).toString.contains("Local Dictionary 
Enabled")) match {
+      case Some(row) => assert(row.get(1).toString.contains("false"))
+    }
+  }
+
+  test("test local dictionary custom configurations when disabled for local 
dict columns _005") {
+    sql("drop table if exists local1")
+    sql(
+      """
+        | CREATE TABLE local1(id int, name string, city string, age int)
+        | STORED BY 'org.apache.carbondata.format'
+        | 
tblproperties('local_dictionary_enable'='false','local_dictionary_include'='id')
+      """.
+        stripMargin)
+    val descFormatted1 = sql("describe formatted local1").collect
+    descFormatted1.find(_.get(0).toString.contains("Local Dictionary 
Enabled")) match {
+      case Some(row) => assert(row.get(1).toString.contains("false"))
+    }
+  }
+
+  test("test local dictionary custom configurations when disabled for local 
dict columns _006") {
+    sql("drop table if exists local1")
+    sql(
+      """
+        | CREATE TABLE local1(id int, name string, city string, age int)
+        | STORED BY 'org.apache.carbondata.format'
+        | 
tblproperties('local_dictionary_enable'='false','dictionary_include'='name',
+        | 'local_dictionary_include'='name')
+      """.
+        stripMargin)
+    val descFormatted1 = sql("describe formatted local1").collect
+    descFormatted1.find(_.get(0).toString.contains("Local Dictionary 
Enabled")) match {
+      case Some(row) => assert(row.get(1).toString.contains("false"))
+    }
+  }
+
+  test("test local dictionary custom configurations when disabled for local 
dict threshold _001") {
+    sql("drop table if exists local1")
+    sql(
+      """
+        | CREATE TABLE local1(id int, name string, city string, age int)
+        | STORED BY 'org.apache.carbondata.format'
+        | 
tblproperties('local_dictionary_enable'='false','local_dictionary_threshold'='10000')
+      """.stripMargin)
+
+    val descLoc = sql("describe formatted local1").collect
+    descLoc.find(_.get(0).toString.contains("Local Dictionary Enabled")) match 
{
+      case Some(row) => assert(row.get(1).toString.contains("false"))
+    }
+  }
+
+  test("test local dictionary custom configurations when disabled for local 
dict threshold _002")
+  {
+    sql("drop table if exists local1")
+    sql(
+      """
+        | CREATE TABLE local1(id int, name string, city string, age int)
+        | STORED BY 'org.apache.carbondata.format'
+        | 
tblproperties('local_dictionary_enable'='false','local_dictionary_threshold'='-100')
+      """.stripMargin)
+
+    val descLoc = sql("describe formatted local1").collect
+    descLoc.find(_.get(0).toString.contains("Local Dictionary Enabled")) match 
{
+      case Some(row) => assert(row.get(1).toString.contains("false"))
+    }
+  }
+
+  test("test local dictionary custom configurations when disabled for local 
dict threshold _003")
+  {
+    sql("drop table if exists local1")
+    sql(
+      """
+        | CREATE TABLE local1(id int, name string, city string, age int)
+        | STORED BY 'org.apache.carbondata.format'
+        | 
tblproperties('local_dictionary_enable'='false','local_dictionary_threshold'='21474874811')
+      """.stripMargin)
+
+    val descLoc = sql("describe formatted local1").collect
+    descLoc.find(_.get(0).toString.contains("Local Dictionary Enabled")) match 
{
+      case Some(row) => assert(row.get(1).toString.contains("false"))
+    }
+  }
+
+  test("test local dictionary custom configurations when disabled for local 
dict threshold _004")
+  {
+    sql("drop table if exists local1")
+    sql(
+      """
+        | CREATE TABLE local1(id int, name string, city string, age int)
+        | STORED BY 'org.apache.carbondata.format'
+        | 
tblproperties('local_dictionary_enable'='false','local_dictionary_threshold'='')
+      """.stripMargin)
+
+    val descLoc = sql("describe formatted local1").collect
+    descLoc.find(_.get(0).toString.contains("Local Dictionary Enabled")) match 
{
+      case Some(row) => assert(row.get(1).toString.contains("false"))
+    }
+  }
+
+  test("test local dictionary custom configurations when disabled for local 
dict threshold _005")
+  {
+    sql("drop table if exists local1")
+    sql(
+      """
+        | CREATE TABLE local1(id int, name string, city string, age int)
+        | STORED BY 'org.apache.carbondata.format'
+        | 
tblproperties('local_dictionary_enable'='false','local_dictionary_threshold'='hello')
+      """.stripMargin)
+
+    val descLoc = sql("describe formatted local1").collect
+    descLoc.find(_.get(0).toString.contains("Local Dictionary Enabled")) match 
{
+      case Some(row) => assert(row.get(1).toString.contains("false"))
+    }
+  }
+
+  test(
+    "test local dictionary custom configurations when disabled with both 
columns and threshold " +
+    "configured _001")
+  {
+    sql("drop table if exists local1")
+    sql(
+      """
+        | CREATE TABLE local1(id int, name string, city string, age int)
+        | STORED BY 'org.apache.carbondata.format'
+        | 
tblproperties('local_dictionary_enable'='false','local_dictionary_threshold'='10000',
+        | 'local_dictionary_include'='name')
+      """.stripMargin)
+
+    val descLoc = sql("describe formatted local1").collect
+    descLoc.find(_.get(0).toString.contains("Local Dictionary Enabled")) match 
{
+      case Some(row) => assert(row.get(1).toString.contains("false"))
+    }
+  }
+
+  test(
+    "test local dictionary custom configurations when disabled with both 
columns and threshold " +
+    "configured _002")
+  {
+    sql("drop table if exists local1")
+    sql(
+      """
+        | CREATE TABLE local1(id int, name string, city string, age int)
+        | STORED BY 'org.apache.carbondata.format'
+        | 
tblproperties('local_dictionary_enable'='false','local_dictionary_threshold'='-100',
+        | 'local_dictionary_include'='name')
+      """.stripMargin)
+
+    val descLoc = sql("describe formatted local1").collect
+    descLoc.find(_.get(0).toString.contains("Local Dictionary Enabled")) match 
{
+      case Some(row) => assert(row.get(1).toString.contains("false"))
+    }
+  }
+
+  test(
+    "test local dictionary custom configurations when disabled with both 
columns and threshold " +
+    "configured _003")
+  {
+    sql("drop table if exists local1")
+    sql(
+      """
+        | CREATE TABLE local1(id int, name string, city string, age int)
+        | STORED BY 'org.apache.carbondata.format'
+        | 
tblproperties('local_dictionary_enable'='false','local_dictionary_threshold'='',
+        | 'local_dictionary_include'='name')
+      """.stripMargin)
+
+    val descLoc = sql("describe formatted local1").collect
+    descLoc.find(_.get(0).toString.contains("Local Dictionary Enabled")) match 
{
+      case Some(row) => assert(row.get(1).toString.contains("false"))
+    }
+  }
+
+  test(
+    "test local dictionary custom configurations when disabled with both 
columns and threshold " +
+    "configured _004")
+  {
+    sql("drop table if exists local1")
+    sql(
+      """
+        | CREATE TABLE local1(id int, name string, city string, age int)
+        | STORED BY 'org.apache.carbondata.format'
+        | 
tblproperties('local_dictionary_enable'='false','local_dictionary_threshold'='vdslv',
+        | 'local_dictionary_include'='name')
+      """.stripMargin)
+
+    val descLoc = sql("describe formatted local1").collect
+    descLoc.find(_.get(0).toString.contains("Local Dictionary Enabled")) match 
{
+      case Some(row) => assert(row.get(1).toString.contains("false"))
+    }
+  }
+
+  test(
+    "test local dictionary custom configurations when disabled with both 
columns and threshold " +
+    "configured _005")
+  {
+    sql("drop table if exists local1")
+
+    sql(
+      """
+        | CREATE TABLE local1(id int, name string, city string, age int)
+        | STORED BY 'org.apache.carbondata.format'
+        | 
tblproperties('local_dictionary_enable'='false','local_dictionary_threshold'='10000',
+        | 'local_dictionary_include'='name,name')
+      """.stripMargin)
+    val descLoc = sql("describe formatted local1").collect
+    descLoc.find(_.get(0).toString.contains("Local Dictionary Enabled")) match 
{
+      case Some(row) => assert(row.get(1).toString.contains("false"))
+    }
+  }
+
+  test(
+    "test local dictionary custom configurations when disabled with both 
columns and threshold " +
+    "configured _006")
+  {
+    sql("drop table if exists local1")
+    sql(
+      """
+        | CREATE TABLE local1(id int, name string, city string, age int)
+        | STORED BY 'org.apache.carbondata.format'
+        | 
tblproperties('local_dictionary_enable'='false','local_dictionary_threshold'='10000',
+        | 'local_dictionary_include'=' ')
+      """.stripMargin)
+
+    val descLoc = sql("describe formatted local1").collect
+    descLoc.find(_.get(0).toString.contains("Local Dictionary Enabled")) match 
{
+      case Some(row) => assert(row.get(1).toString.contains("false"))
+    }
+  }
+
+  test(
+    "test local dictionary custom configurations when disabled with both 
columns and threshold " +
+    "configured _007")
+  {
+    sql("drop table if exists local1")
+    sql(
+      """
+        | CREATE TABLE local1(id int, name string, city string, age int)
+        | STORED BY 'org.apache.carbondata.format'
+        | 
tblproperties('local_dictionary_enable'='false','local_dictionary_threshold'='10000',
+        | 'local_dictionary_include'='hello')
+      """.stripMargin)
+
+    val descLoc = sql("describe formatted local1").collect
+    descLoc.find(_.get(0).toString.contains("Local Dictionary Enabled")) match 
{
+      case Some(row) => assert(row.get(1).toString.contains("false"))
+    }
+  }
+
+  test(
+    "test local dictionary custom configurations when disabled with both 
columns and threshold " +
+    "configured _008")
+  {
+    sql("drop table if exists local1")
+    sql(
+      """
+        | CREATE TABLE local1(id int, name string, city string, age int)
+        | STORED BY 'org.apache.carbondata.format'
+        | 
tblproperties('local_dictionary_enable'='false','local_dictionary_threshold'='10000',
+        | 'local_dictionary_include'='name','dictionary_include'='name')
+      """.stripMargin)
+
+    val descLoc = sql("describe formatted local1").collect
+    descLoc.find(_.get(0).toString.contains("Local Dictionary Enabled")) match 
{
+      case Some(row) => assert(row.get(1).toString.contains("false"))
+    }
+  }
+
+  test(
+    "test local dictionary custom configurations when disabled with both 
columns and threshold " +
+    "configured _009")
+  {
+    sql("drop table if exists local1")
+    sql(
+      """
+        | CREATE TABLE local1(id int, name string, city string, age int)
+        | STORED BY 'org.apache.carbondata.format'
+        | 
tblproperties('local_dictionary_enable'='false','local_dictionary_threshold'='',
+        | 'local_dictionary_include'='name,name')
+      """.stripMargin)
+
+    val descLoc = sql("describe formatted local1").collect
+    descLoc.find(_.get(0).toString.contains("Local Dictionary Enabled")) match 
{
+      case Some(row) => assert(row.get(1).toString.contains("false"))
+    }
+  }
+
+  test(
+    "test local dictionary custom configurations when disabled with both 
columns and threshold " +
+    "configured _010")
+  {
+    sql("drop table if exists local1")
+    sql(
+      """
+        | CREATE TABLE local1(id int, name string, city string, age int)
+        | STORED BY 'org.apache.carbondata.format'
+        | 
tblproperties('local_dictionary_enable'='false','local_dictionary_threshold'='-100',
+        | 'local_dictionary_include'='Hello')
+      """.stripMargin)
+
+    val descLoc = sql("describe formatted local1").collect
+    descLoc.find(_.get(0).toString.contains("Local Dictionary Enabled")) match 
{
+      case Some(row) => assert(row.get(1).toString.contains("false"))
+    }
+  }
+
+  test(
+    "test local dictionary custom configurations when disabled with both 
columns and threshold " +
+    "configured _011")
+  {
+    sql("drop table if exists local1")
+    sql(
+      """
+        | CREATE TABLE local1(id int, name string, city string, age int)
+        | STORED BY 'org.apache.carbondata.format'
+        | tblproperties('local_dictionary_enable'='false',
+        | 
'local_dictionary_threshold'='23213497321591234324','local_dictionary_include'='name',
+        | 'dictionary_include'='name')
+      """.stripMargin)
+
+    val descLoc = sql("describe formatted local1").collect
+
+    descLoc.find(_.get(0).toString.contains("Local Dictionary Enabled")) match 
{
+      case Some(row) => assert(row.get(1).toString.contains("false"))
+    }
+  }
+
+  test("test local dictionary custom configuration with other table properties 
_001") {
+    sql("drop table if exists local1")
+    sql(
+      """
+        | CREATE TABLE local1(id int, name string, city string, age int)
+        | STORED BY 'org.apache.carbondata.format'
+        | tblproperties('dictionary_include'='city','sort_scope'='global_sort',
+        | 'sort_columns'='city,name')
+      """.stripMargin)
+
+    val descLoc = sql("describe formatted local1").collect
+
+    descLoc.find(_.get(0).toString.contains("Local Dictionary Enabled")) match 
{
+      case Some(row) => assert(row.get(1).toString.contains("true"))
+    }
+    descLoc.find(_.get(0).toString.contains("SORT_SCOPE")) match {
+      case Some(row) => assert(row.get(1).toString.contains("global_sort"))
+    }
+  }
+
+  test("test local dictionary custom configuration with other table properties 
_002") {
+    sql("drop table if exists local1")
+    sql(
+      """
+        | CREATE TABLE local1(id int, name string, city string, age int)
+        | STORED BY 'org.apache.carbondata.format'
+        | tblproperties('dictionary_include'='city','sort_scope'='batch_sort',
+        | 'sort_columns'='city,name')
+      """.stripMargin)
+
+    val descLoc = sql("describe formatted local1").collect
+
+    descLoc.find(_.get(0).toString.contains("Local Dictionary Enabled")) match 
{
+      case Some(row) => assert(row.get(1).toString.contains("true"))
+    }
+    descLoc.find(_.get(0).toString.contains("SORT_SCOPE")) match {
+      case Some(row) => assert(row.get(1).toString.contains("batch_sort"))
+    }
+  }
+  test("test local dictionary custom configuration with other table properties 
_003") {
+    sql("drop table if exists local1")
+    sql(
+      """
+        | CREATE TABLE local1(id int, name string, city string, age int)
+        | STORED BY 'org.apache.carbondata.format'
+        | tblproperties('dictionary_include'='city','sort_scope'='no_sort',
+        | 'sort_columns'='city,name')
+      """.stripMargin)
+
+    val descLoc = sql("describe formatted local1").collect
+
+    descLoc.find(_.get(0).toString.contains("Local Dictionary Enabled")) match 
{
+      case Some(row) => assert(row.get(1).toString.contains("true"))
+    }
+    descLoc.find(_.get(0).toString.contains("SORT_SCOPE")) match {
+      case Some(row) => assert(row.get(1).toString.contains("no_sort"))
+    }
+  }
+  test("test local dictionary custom configuration with other table properties 
_004") {
+    sql("drop table if exists local1")
+    sql(
+      """
+        | CREATE TABLE local1(id int, name string, city string, age int)
+        | STORED BY 'org.apache.carbondata.format'
+        | tblproperties('dictionary_include'='city','sort_scope'='local_sort',
+        | 'sort_columns'='city,name')
+      """.stripMargin)
+
+    val descLoc = sql("describe formatted local1").collect
+
+    descLoc.find(_.get(0).toString.contains("Local Dictionary Enabled")) match 
{
+      case Some(row) => assert(row.get(1).toString.contains("true"))
+    }
+    descLoc.find(_.get(0).toString.contains("SORT_SCOPE")) match {
+      case Some(row) => assert(row.get(1).toString.contains("local_sort"))
+    }
+  }
+
+  test("test CTAS statements for local dictionary default configuration when 
enabled") {
+    sql("drop table if exists local")
+    sql("drop table if exists local1")
+    sql(
+      """
+        | CREATE TABLE local(id int, name string, city string, age int)
+        | STORED BY 'org.apache.carbondata.format' 
tblproperties('local_dictionary_enable'='false')
+      """.stripMargin)
+    sql(
+      """
+        | create table local1 stored by 'carbondata' 
tblproperties('local_dictionary_enable'='true') as
+        | select * from local
+      """.stripMargin)
+
+    val desc_result = sql("describe formatted local1")
+
+    val descLoc = sql("describe formatted local1").collect
+    descLoc.find(_.get(0).toString.contains("Local Dictionary Enabled")) match 
{
+      case Some(row) => assert(row.get(1).toString.contains("true"))
+    }
+    descLoc.find(_.get(0).toString.contains("Local Dictionary Threshold")) 
match {
+      case Some(row) => assert(row.get(1).toString.contains("1000"))
+    }
+  }
+
+  test("test CTAS statements for local dictionary custom configurations when 
enabled for local dict columns _001") {
+    sql("drop table if exists local")
+    sql("drop table if exists local1")
+    sql(
+      """
+        | CREATE TABLE local(id int, name string, city string, age int)
+        | STORED BY 'org.apache.carbondata.format' 
tblproperties('local_dictionary_enable'='false')
+      """.stripMargin)
+    sql(
+      """
+        | CREATE TABLE local1 STORED BY 'org.apache.carbondata.format'
+        | 
tblproperties('local_dictionary_include'='name','local_dictionary_enable'='true')
+        | as select * from local
+      """.
+        stripMargin)
+    val descFormatted1 = sql("describe formatted local1").collect
+    descFormatted1.find(_.get(0).toString.contains("Local Dictionary 
Enabled")) match {
+      case Some(row) => assert(row.get(1).toString.contains("true"))
+    }
+    descFormatted1.find(_.get(0).toString.contains("Local Dictionary 
Include")) match {
+      case Some(row) => assert(row.get(1).toString.contains("name"))
+    }
+  }
+
+  test("test CTAS statements for local dictionary custom configurations when 
enabled for local dict columns _002")
+  {
+    sql("drop table if exists local")
+    sql("drop table if exists local1")
+
+    sql(
+      """
+        | CREATE TABLE local(id int, name string, city string, age int)
+        | STORED BY 'org.apache.carbondata.format' 
tblproperties('local_dictionary_enable'='false')
+      """.stripMargin)
+    intercept[MalformedCarbonCommandException] {
+      sql(
+        """
+          | CREATE TABLE local1 STORED BY 'org.apache.carbondata.format'
+          | 
tblproperties('local_dictionary_enable'='true','local_dictionary_include'='name,name')
+          | as select * from local
+        """.stripMargin)
+    }
+  }
+
+  test("test CTAS statements for local dictionary custom configurations when 
enabled for local dict columns _003") {
+    sql("drop table if exists local")
+    sql("drop table if exists local1")
+
+    sql(
+      """
+        | CREATE TABLE local(id int, name string, city string, age int)
+        | STORED BY 'org.apache.carbondata.format' 
tblproperties('local_dictionary_enable'='false')
+      """.stripMargin)
+    val exception = intercept[MalformedCarbonCommandException] {
+      sql(
+        """
+          | CREATE TABLE local1 STORED BY 'org.apache.carbondata.format'
+          | 
tblproperties('local_dictionary_enable'='true','local_dictionary_include'='')
+          | as select * from local
+        """.
+          stripMargin)
+    }
+    assert(exception.getMessage
+      .contains(
+        "LOCAL_DICTIONARY_INCLUDE/LOCAL_DICTIONARY_EXCLUDE column:  does not 
exist in table. Please check " +
+        "create table statement"))
+
+  }
+
+  test("test CTAS statements for local dictionary custom configurations when 
enabled for local dict columns _004") {
+    sql("drop table if exists local")
+    sql("drop table if exists local1")
+    sql(
+      """
+        | CREATE TABLE local(id int, name string, city string, age int)
+        | STORED BY 'org.apache.carbondata.format' 
tblproperties('local_dictionary_enable'='false')
+      """.stripMargin)
+    val exception1 = intercept[MalformedCarbonCommandException] {
+      sql(
+        """
+          | CREATE TABLE local1 STORED BY 'org.apache.carbondata.format'
+          | 
tblproperties('local_dictionary_enable'='true','local_dictionary_include'='abc')
+          | as select * from local
+        """.
+          stripMargin)
+    }
+    assert(exception1.getMessage
+      .contains(
+        "LOCAL_DICTIONARY_INCLUDE/LOCAL_DICTIONARY_EXCLUDE column: abc does 
not exist in table. Please check " +
+        "create table " +
+        "statement"))
+  }
+
+  test("test CTAS statements for local dictionary custom configurations when 
enabled for local dict columns _005") {
+    sql("drop table if exists local")
+    sql("drop table if exists local1")
+    sql(
+      """
+        | CREATE TABLE local(id int, name string, city string, age int)
+        | STORED BY 'org.apache.carbondata.format' 
tblproperties('local_dictionary_enable'='false')
+      """.stripMargin)
+    val exception = intercept[MalformedCarbonCommandException] {
+      sql(
+        """
+          | CREATE TABLE local1 STORED BY 'org.apache.carbondata.format'
+          | 
tblproperties('local_dictionary_enable'='true','local_dictionary_include'='id')
+          | as select * from local
+        """.
+          stripMargin)
+    }
+    assert(exception.getMessage
+      .contains(
+        "LOCAL_DICTIONARY_INCLUDE/LOCAL_DICTIONARY_EXCLUDE column: id is not a 
String/complex datatype column. " +
+        "LOCAL_DICTIONARY_COLUMN should " +
+        "be no dictionary string/complex datatype column"))
+  }
+
+  test("test CTAS statements for local dictionary custom configurations when 
enabled for local dict columns _006") {
+    sql("drop table if exists local")
+    sql("drop table if exists local1")
+    sql(
+      """
+        | CREATE TABLE local(id int, name string, city string, age int)
+        | STORED BY 'org.apache.carbondata.format' 
tblproperties('local_dictionary_enable'='false')
+      """.stripMargin)
+    intercept[MalformedCarbonCommandException] {
+      sql(
+        """
+          | CREATE TABLE local1 STORED BY 'org.apache.carbondata.format'
+          | 
tblproperties('local_dictionary_enable'='true','dictionary_include'='name',
+          | 'local_dictionary_include'='name') as select * from local
+        """.
+          stripMargin)
+    }
+  }
+
+  test("test CTAS statements for local dictionary custom configurations when 
local_dictionary_exclude is configured _001") {
+    sql("drop table if exists local")
+    sql("drop table if exists local1")
+    sql(
+      """
+        | CREATE TABLE local(id int, name string, city string, age int)
+        | STORED BY 'org.apache.carbondata.format' 
tblproperties('local_dictionary_enable'='false')
+      """.stripMargin)
+    sql(
+      """
+        | CREATE TABLE local1 STORED BY 'org.apache.carbondata.format'
+        | 
tblproperties('local_dictionary_exclude'='name','local_dictionary_enable'='true')
+        | as select * from local
+      """.
+        stripMargin)
+    val descFormatted1 = sql("describe formatted local1").collect
+    descFormatted1.find(_.get(0).toString.contains("Local Dictionary 
Enabled")) match {
+      case Some(row) => assert(row.get(1).toString.contains("true"))
+    }
+    descFormatted1.find(_.get(0).toString.contains("Local Dictionary 
Exclude")) match {
+      case Some(row) => assert(row.get(1).toString.contains("name"))
+    }
+  }
+
+  test("test CTAS statements for local dictionary custom configurations when 
local_dictionary_exclude is configured _002")
+  {
+    sql("drop table if exists local1")
+    sql("drop table if exists local")
+    sql(
+      """
+        | CREATE TABLE local(id int, name string, city string, age int)
+        | STORED BY 'org.apache.carbondata.format' 
tblproperties('local_dictionary_enable'='false')
+      """.stripMargin)
+    intercept[MalformedCarbonCommandException] {
+      sql(
+        """
+          | CREATE TABLE local1 STORED BY 'org.apache.carbondata.format'
+          | 
tblproperties('local_dictionary_enable'='true','local_dictionary_exclude'='name,name')
+          | as select * from local
+        """.stripMargin)
+    }
+  }
+
+  test("test CTAS statements for local dictionary custom configurations when 
local_dictionary_exclude is configured _003") {
+    sql("drop table if exists local1")
+    sql("drop table if exists local")
+    sql(
+      """
+        | CREATE TABLE local(id int, name string, city string, age int)
+        | STORED BY 'org.apache.carbondata.format' 
tblproperties('local_dictionary_enable'='false')
+      """.stripMargin)
+    val exception = intercept[MalformedCarbonCommandException] {
+      sql(
+        """
+          | CREATE TABLE local1 STORED BY 'org.apache.carbondata.format'
+          | 
tblproperties('local_dictionary_enable'='true','local_dictionary_exclude'='')
+          | as select * from local
+        """.
+          stripMargin)
+    }
+    assert(exception.getMessage
+      .contains(
+        "LOCAL_DICTIONARY_INCLUDE/LOCAL_DICTIONARY_EXCLUDE column:  does not 
exist in table. Please check " +
+        "create table statement"))
+  }
+
+  test("test CTAS statements for local dictionary custom configurations when 
local_dictionary_exclude is configured _004") {
+    sql("drop table if exists local1")
+    sql("drop table if exists local")
+    sql(
+      """
+        | CREATE TABLE local(id int, name string, city string, age int)
+        | STORED BY 'org.apache.carbondata.format' 
tblproperties('local_dictionary_enable'='false')
+      """.stripMargin)
+    val exception1 = intercept[MalformedCarbonCommandException] {
+      sql(
+        """
+          | CREATE TABLE local1 STORED BY 'org.apache.carbondata.format'
+          | 
tblproperties('local_dictionary_enable'='true','local_dictionary_exclude'='abc')
+          | as select * from local
+        """.
+          stripMargin)
+    }
+    assert(exception1.getMessage
+      .contains(
+        "LOCAL_DICTIONARY_INCLUDE/LOCAL_DICTIONARY_EXCLUDE column: abc does 
not exist in table. Please check " +
+        "create table " +
+        "statement"))
+  }
+
+  test("test CTAS statements for local dictionary custom configurations when 
local_dictionary_exclude is configured _005") {
+    sql("drop table if exists local1")
+    sql("drop table if exists local")
+    sql(
+      """
+        | CREATE TABLE local(id int, name string, city string, age int)
+        | STORED BY 'org.apache.carbondata.format' 
tblproperties('local_dictionary_enable'='false')
+      """.stripMargin)
+    val exception = intercept[MalformedCarbonCommandException] {
+      sql(
+        """
+          | CREATE TABLE local1 STORED BY 'org.apache.carbondata.format'
+          | 
tblproperties('local_dictionary_enable'='true','local_dictionary_exclude'='id')
+          | as select * from local
+        """.
+          stripMargin)
+    }
+    assert(exception.getMessage
+      .contains(
+        "LOCAL_DICTIONARY_INCLUDE/LOCAL_DICTIONARY_EXCLUDE column: id is not a 
String/complex datatype column. " +
+        "LOCAL_DICTIONARY_COLUMN should " +
+        "be no dictionary string/complex datatype column"))
+  }
+
+  test("test CTAS statements for local dictionary custom configurations when 
local_dictionary_exclude is configured _006") {
+    sql("drop table if exists local1")
+    sql("drop table if exists local")
+    sql(
+      """
+        | CREATE TABLE local(id int, name string, city string, age int)
+        | STORED BY 'org.apache.carbondata.format' 
tblproperties('local_dictionary_enable'='false')
+      """.stripMargin)
+    intercept[MalformedCarbonCommandException] {
+      sql(
+        """
+          | CREATE TABLE local1 STORED BY 'org.apache.carbondata.format'
+          | 
tblproperties('local_dictionary_enable'='true','dictionary_include'='name',
+          | 'local_dictionary_exclude'='name') as select * from local
+        """.
+          stripMargin)
+    }
+  }
+
+  test(
+    "test CTAS statements for local dictionary custom configurations when 
local_dictionary_include and local_dictionary_exclude " +
+    "is configured _001")
+  {
+    sql("drop table if exists local1")
+    sql("drop table if exists local")
+    sql(
+      """
+        | CREATE TABLE local(id int, name string, city string, age int)
+        | STORED BY 'org.apache.carbondata.format' 
tblproperties('local_dictionary_enable'='false')
+      """.stripMargin)
+    sql(
+      """
+        | CREATE TABLE local1 STORED BY 'org.apache.carbondata.format'
+        | 
tblproperties('local_dictionary_exclude'='name','local_dictionary_include'='city',
+        | 'local_dictionary_enable'='true') as select * from local
+      """.
+        stripMargin)
+
+    val descFormatted1 = sql("describe formatted local1").collect
+
+    descFormatted1.find(_.get(0).toString.contains("Local Dictionary 
Enabled")) match {
+      case Some(row) => assert(row.get(1).toString.contains("true"))
+    }
+    descFormatted1.find(_.get(0).toString.contains("Local Dictionary 
Exclude")) match {
+      case Some(row) => assert(row.get(1).toString.contains("name"))
+    }
+    descFormatted1.find(_.get(0).toString.contains("Local Dictionary 
Include")) match {
+      case Some(row) => assert(row.get(1).toString.contains("city"))
+    }
+  }
+
+  test(
+    "test CTAS statements for local dictionary custom configurations when 
local_dictionary_include and local_dictionary_exclude " +
+    "is configured _002")
+  {
+    sql("drop table if exists local1")
+    sql("drop table if exists local")
+    sql(
+      """
+        | CREATE TABLE local(id int, name string, city string, age int)
+        | STORED BY 'org.apache.carbondata.format' 
tblproperties('local_dictionary_enable'='false')
+      """.stripMargin)
+    sql(
+      """
+        | CREATE TABLE local1 STORED BY 'org.apache.carbondata.format'
+        | 
tblproperties('local_dictionary_exclude'='name','local_dictionary_include'='city',
+        | 'local_dictionary_enable'='false') as select * from local
+      """.
+        stripMargin)
+    val descFormatted1 = sql("describe formatted local1").collect
+    descFormatted1.find(_.get(0).toString.contains("Local Dictionary 
Enabled")) match {
+      case Some(row) => assert(row.get(1).toString.contains("false"))
+    }
+
+    checkExistence(sql("describe formatted local1"), false, "Local Dictionary 
Include")
+    checkExistence(sql("describe formatted local1"), false, "Local Dictionary 
Exclude")
+  }
+
+  test(
+    "test CTAS statements for local dictionary custom configurations when 
local_dictionary_include and local_dictionary_exclude " +
+    "is configured _003")
+  {
+    sql("drop table if exists local1")
+    sql("drop table if exists local")
+    sql(
+      """
+        | CREATE TABLE local(id int, name string, city string, age int)
+        | STORED BY 'org.apache.carbondata.format' 
tblproperties('local_dictionary_enable'='false')
+      """.stripMargin)
+    intercept[MalformedCarbonCommandException] {
+      sql(
+        """
+          | CREATE TABLE local1 STORED BY 'org.apache.carbondata.format'
+          | 
tblproperties('local_dictionary_exclude'='name','local_dictionary_include'='city',
+          | 'local_dictionary_enable'='true','dictionary_include'='name,city') 
as select * from local
+        """.
+          stripMargin)
+    }
+  }
+
+  test(
+    "test CTAS statements for local dictionary custom configurations when 
local_dictionary_include and local_dictionary_exclude " +
+    "is configured _004")
+  {
+    sql("drop table if exists local1")
+    sql("drop table if exists local")
+    sql(
+      """
+        | CREATE TABLE local(id int, name string, city string, age int)
+        | STORED BY 'org.apache.carbondata.format' 
tblproperties('local_dictionary_enable'='false')
+      """.stripMargin)
+    intercept[MalformedCarbonCommandException] {
+      sql(
+        """
+          | CREATE TABLE local1 STORED BY 'org.apache.carbondata.format'
+          | 
tblproperties('local_dictionary_enable'='true','local_dictionary_include'='name,city',
+          | 'local_dictionary_exclude'='name') as select * from local
+        """.
+          stripMargin)
+    }
+  }
+
+  test(
+    "test CTAS statements for local dictionary custom configurations when 
local_dictionary_include and local_dictionary_exclude " +
+    "is configured _005")
+  {
+    sql("drop table if exists local1")
+    sql("drop table if exists local")
+    sql(
+      """
+        | CREATE TABLE local(id int, name string, city string, age int,st 
struct<s_id:int,
+        | s_name:string,s_city:array<string>>)
+        | STORED BY 'org.apache.carbondata.format' 
tblproperties('local_dictionary_enable'='true')
+      """.stripMargin)
+    sql(
+      """
+        | CREATE TABLE local1 STORED BY 'org.apache.carbondata.format'
+        | 
tblproperties('local_dictionary_exclude'='name','local_dictionary_include'='city,st',
+        | 'local_dictionary_enable'='false') as select * from local
+      """.
+        stripMargin)
+    val descFormatted1 = sql("describe formatted local1").collect
+    descFormatted1.find(_.get(0).toString.contains("Local Dictionary 
Enabled")) match {
+      case Some(row) => assert(row.get(1).toString.contains("false"))
+    }
+  }
+
+  test("test CTAS statements for local dictionary custom configurations when 
enabled for local dict threshold _001") {
+    sql("drop table if exists local1")
+    sql("drop table if exists local")
+    sql(
+      """
+        | CREATE TABLE local(id int, name string, city string, age int)
+        | STORED BY 'org.apache.carbondata.format' 
tblproperties('local_dictionary_enable'='false')
+      """.stripMargin)
+    sql(
+      """
+        | CREATE TABLE local1 STORED BY 'org.apache.carbondata.format'
+        | 
tblproperties('local_dictionary_enable'='true','local_dictionary_threshold'='10000')
+        | as select * from local
+      """.stripMargin)
+
+    val descLoc = sql("describe formatted local1").collect
+    descLoc.find(_.get(0).toString.contains("Local Dictionary Enabled")) match 
{
+      case Some(row) => assert(row.get(1).toString.contains("true"))
+    }
+    descLoc.find(_.get(0).toString.contains("Local Dictionary Threshold")) 
match {
+      case Some(row) => assert(row.get(1).toString.contains("10000"))
+    }
+  }
+
+  test("test CTAS statements for local dictionary custom configurations when 
enabled for local dict threshold _002")
+  {
+    sql("drop table if exists local1")
+    sql("drop table if exists local")
+    sql(
+      """
+        | CREATE TABLE local(id int, name string, city string, age int)
+        | STORED BY 'org.apache.carbondata.format' 
tblproperties('local_dictionary_enable'='false')
+      """.stripMargin)
+    sql(
+      """
+        | CREATE TABLE local1 STORED BY 'org.apache.carbondata.format'
+        | 
tblproperties('local_dictionary_enable'='true','local_dictionary_threshold'='-100')
+        | as select * from local
+      """.stripMargin)
+
+    val descLoc = sql("describe formatted local1").collect
+    descLoc.find(_.get(0).toString.contains("Local Dictionary Threshold")) 
match {
+      case Some(row) => assert(row.get(1).toString.contains("1000"))
+    }
+  }
+
+  test("test CTAS statements for local dictionary custom configurations when 
enabled for local dict threshold _003")
+  {
+    sql("drop table if exists local1")
+    sql("drop table if exists local")
+    sql(
+      """
+        | CREATE TABLE local(id int, name string, city string, age int)
+        | STORED BY 'org.apache.carbondata.format' 
tblproperties('local_dictionary_enable'='false')
+      """.stripMargin)
+    sql(
+      """
+        | CREATE TABLE local1 STORED BY 'org.apache.carbondata.format'
+        | 
tblproperties('local_dictionary_enable'='true','local_dictionary_threshold'='23589714365172595')
+        | as select * from local
+      """.stripMargin)
+
+    val descLoc = sql("describe formatted local1").collect
+    descLoc.find(_.get(0).toString.contains("Local Dictionary Threshold")) 
match {
+      case Some(row) => assert(row.get(1).toString.contains("1000"))
+    }
+  }
+
+  test("test CTAS statements for local dictionary custom configurations when 
first table is hive table")
+  {
+    sql("drop table if exists local1")
+    sql("drop table if exists local")
+    sql(
+      """
+        | CREATE TABLE local(id int, name string, city string, age int)
+        |  tblproperties('local_dictionary_enable'='false')
+      """.stripMargin)
+    sql(
+      """
+        | CREATE TABLE local1 STORED BY 'org.apache.carbondata.format'
+        | 
tblproperties('local_dictionary_enable'='true','local_dictionary_threshold'='10000','local_dictionary_include'='city')
+        | as select * from local
+      """.stripMargin)
+
+    val descLoc = sql("describe formatted local1").collect
+    descLoc.find(_.get(0).toString.contains("Local Dictionary Threshold")) 
match {
+      case Some(row) => assert(row.get(1).toString.contains("1000"))
+    }
+    descLoc.find(_.get(0).toString.contains("Local Dictionary Enabled")) match 
{
+      case Some(row) => assert(row.get(1).toString.contains("true"))
+    }
+    descLoc.find(_.get(0).toString.contains("Local Dictionary Include")) match 
{
+      case Some(row) => assert(row.get(1).toString.contains("city"))
+    }
+  }
+
+  test("test no inverted index for local dictionary custom configurations when 
first table is hive table")
+  {
+    sql("drop table if exists local1")
+
+    sql(
+      """
+        | CREATE TABLE local1(id int, name string, city string, age int)
+        | STORED BY 'org.apache.carbondata.format' 
tblproperties('local_dictionary_enable'='true',
+        | 
'local_dictionary_threshold'='10000','local_dictionary_include'='city','no_inverted_index'='name')
+      """.stripMargin)
+
+    val descLoc = sql("describe formatted local1").collect
+    descLoc.find(_.get(0).toString.contains("Local Dictionary Threshold")) 
match {
+      case Some(row) => assert(row.get(1).toString.contains("1000"))
+    }
+    descLoc.find(_.get(0).toString.contains("Local Dictionary Enabled")) match 
{
+      case Some(row) => assert(row.get(1).toString.contains("true"))
+    }
+    descLoc.find(_.get(0).toString.contains("Local Dictionary Include")) match 
{
+      case Some(row) => assert(row.get(1).toString.contains("city"))
+    }
+  }
+
+  override protected def afterAll(): Unit = {
+    sql("DROP TABLE IF EXISTS LOCAL1")
+  }
+}

http://git-wip-us.apache.org/repos/asf/carbondata/blob/c5a4ec07/integration/spark-common-cluster-test/src/test/scala/org/apache/carbondata/cluster/sdv/suite/SDVSuites.scala
----------------------------------------------------------------------
diff --git 
a/integration/spark-common-cluster-test/src/test/scala/org/apache/carbondata/cluster/sdv/suite/SDVSuites.scala
 
b/integration/spark-common-cluster-test/src/test/scala/org/apache/carbondata/cluster/sdv/suite/SDVSuites.scala
index c5aceaa..6756468 100644
--- 
a/integration/spark-common-cluster-test/src/test/scala/org/apache/carbondata/cluster/sdv/suite/SDVSuites.scala
+++ 
b/integration/spark-common-cluster-test/src/test/scala/org/apache/carbondata/cluster/sdv/suite/SDVSuites.scala
@@ -62,7 +62,8 @@ class SDVSuites extends Suites with BeforeAndAfterAll {
                               new PreAggregateTestCase ::
                               new TimeSeriesPreAggregateTestCase ::
                               new TestPartitionWithGlobalSort ::
-                              new PartitionWithPreAggregateTestCase :: Nil
+                              new PartitionWithPreAggregateTestCase ::
+                              new CreateTableWithLocalDictionaryTestCase :: Nil
 
   override val nestedSuites = suites.toIndexedSeq
 
@@ -152,7 +153,8 @@ class SDVSuites3 extends Suites with BeforeAndAfterAll {
                     new TestPartitionWithGlobalSort ::
                     new SDKwriterTestCase ::
                     new SetParameterTestCase ::
-                    new PartitionWithPreAggregateTestCase :: Nil
+                    new PartitionWithPreAggregateTestCase ::
+                    new CreateTableWithLocalDictionaryTestCase :: Nil
 
   override val nestedSuites = suites.toIndexedSeq
 

Reply via email to