Github user akashrn5 commented on a diff in the pull request:

    https://github.com/apache/carbondata/pull/2390#discussion_r197019432
  
    --- Diff: 
integration/spark-common-test/src/test/scala/org/apache/carbondata/spark/testsuite/localdictionary/LocalDictionarySupportCreateTableTest.scala
 ---
    @@ -2096,6 +2093,175 @@ class LocalDictionarySupportCreateTableTest extends 
QueryTest with BeforeAndAfte
         }
       }
     
    +  test(
    +    "test local dictionary custom configurations when complex dataType 
columns are given in " +
    +    "local_dictionary_include _001")
    +  {
    +    sql("drop table if exists local1")
    +    val exception = intercept[MalformedCarbonCommandException] {
    +      sql(
    +        """
    +          | CREATE TABLE local1(id int, name string,city array<int>, st 
array<struct<i:int,s:int>>)
    +          | STORED BY 'org.apache.carbondata.format'
    +          | 
tblproperties('local_dictionary_enable'='true','local_dictionary_include'='name,st')
    +        """.stripMargin)
    +    }
    +    assert(exception.getMessage
    +      .contains(
    +        "No child column is string dataType column in 
local_dictionary_include."))
    +  }
    +
    +  test(
    +    "test local dictionary custom configurations when complex dataType 
columns are given in " +
    +    "local_dictionary_include _002")
    +  {
    +    sql("drop table if exists local1")
    +    val exception = intercept[MalformedCarbonCommandException] {
    +      sql(
    +        """
    +          | CREATE TABLE local1(id int, name string,city array<int>, st 
string)
    +          | STORED BY 'org.apache.carbondata.format'
    +          | 
tblproperties('local_dictionary_enable'='true','local_dictionary_include'='name,st,city')
    +        """.stripMargin)
    +    }
    +    assert(exception.getMessage
    +      .contains(
    +        "No child column is string dataType column in 
local_dictionary_include."))
    +  }
    +
    +  test(
    +    "test local dictionary custom configurations when complex dataType 
columns are given in " +
    +    "local_dictionary_include _003")
    +  {
    +    sql("drop table if exists local1")
    +    val exception = intercept[MalformedCarbonCommandException] {
    +      sql(
    +        """
    +          | CREATE TABLE local1(id int, name string,city array<int>, st 
struct<i:int,s:int>)
    +          | STORED BY 'org.apache.carbondata.format'
    +          | 
tblproperties('local_dictionary_enable'='true','local_dictionary_include'='name,st')
    +        """.stripMargin)
    +    }
    +    assert(exception.getMessage
    +      .contains(
    +        "No child column is string dataType column in 
local_dictionary_include."))
    +  }
    +
    +  test(
    +    "test local dictionary custom configurations when complex dataType 
columns are given in " +
    +    "local_dictionary_include _004")
    +  {
    +    sql("drop table if exists local1")
    +      sql(
    +        """
    +          | CREATE TABLE local1(id int, name string,city array<int>, st 
struct<i:int,s:string>)
    +          | STORED BY 'org.apache.carbondata.format'
    +          | 
tblproperties('local_dictionary_enable'='true','local_dictionary_include'='name,st')
    +        """.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("name,st"))
    +    }
    +  }
    +
    +  test(
    +    "test local dictionary custom configurations when complex dataType 
columns are given in " +
    +    "local_dictionary_include _005")
    +  {
    +    sql("drop table if exists local1")
    +    sql(
    +      """
    +        | CREATE TABLE local1(id int, name string,city array<string>, st 
struct<i:int,s:int>)
    +        | STORED BY 'org.apache.carbondata.format'
    +        | 
tblproperties('local_dictionary_enable'='true','local_dictionary_include'='name,city')
    +      """.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("name,city"))
    +    }
    +  }
    +
    +  test(
    +    "test local dictionary custom configurations when complex dataType 
columns are given in " +
    +    "local_dictionary_include _006")
    +  {
    +    sql("drop table if exists local1")
    +    sql(
    +      """
    +        | CREATE TABLE local1(id int, name string,city array<int>, st 
struct<i:int,s:array<string>>)
    +        | STORED BY 'org.apache.carbondata.format'
    +        | 
tblproperties('local_dictionary_enable'='true','local_dictionary_include'='name,st')
    +      """.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("name,st"))
    +    }
    +  }
    +
    +  test(
    +    "test local dictionary custom configurations when complex dataType 
columns are given in " +
    +    "local_dictionary_include _007")
    +  {
    +    sql("drop table if exists local1")
    +    sql(
    +      """
    +        | CREATE TABLE local1(id int, name string,city array<int>, st 
struct<i:int,s:struct<si:string>>)
    +        | STORED BY 'org.apache.carbondata.format'
    +        | 
tblproperties('local_dictionary_enable'='true','local_dictionary_include'='name,st')
    +      """.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("name,st"))
    +    }
    +  }
    +
    +  test(
    +    "test local dictionary custom configurations when complex dataType 
columns are given in " +
    +    "local_dictionary_include _008")
    +  {
    +    sql("drop table if exists local1")
    +    sql(
    +      """
    +        | CREATE TABLE local1(id int, name string,city array<int>, st 
array<struct<si:string>>)
    +        | STORED BY 'org.apache.carbondata.format'
    +        | 
tblproperties('local_dictionary_enable'='true','local_dictionary_include'='name,st')
    +      """.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("name,st"))
    +    }
    +  }
    +
    --- End diff --
    
    add one more test case, where two complex columns are there and one is only 
with int datatype child columns


---

Reply via email to