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

    https://github.com/apache/carbondata/pull/1785#discussion_r161144939
  
    --- Diff: 
integration/spark-common-test/src/test/scala/org/apache/carbondata/integration/spark/testsuite/dataload/TestLoadDataGeneral.scala
 ---
    @@ -187,6 +187,75 @@ class TestLoadDataGeneral extends QueryTest with 
BeforeAndAfterAll {
         } catch {
           case _:Exception => assert(true)
         }
    +  }
    +
    +  test("test load / insert / update with data more than 32000 bytes - 
dictionary_exclude") {
    +    val testdata = s"$resourcesPath/unicodechar.csv"
    +    sql("drop table if exists load32000bytes")
    +    sql("create table load32000bytes(name string) stored by 'carbondata'")
    +    sql("insert into table load32000bytes select 'aaa'")
    +
    +    assert(intercept[Exception] {
    +      sql(s"load data local inpath '$testdata' into table load32000bytes 
OPTIONS ('FILEHEADER'='name')")
    +    }.getMessage.equals("DataLoad failure: Dataload failed, String size 
cannot exceed 32000 bytes"))
    +
    +    val source = scala.io.Source.fromFile(testdata)
    +    val data = source.mkString
    +
    +    try {
    +      sql(s"insert into load32000bytes values('$data')")
    +      assert(false)
    +    } catch {
    +      case _: Exception =>
    +        assert(true)
    +    }
    +
    +    try {
    +      sql(s"update load32000bytes set(name)= ('$data')").show()
    +      assert(false)
    +    } catch {
    +      case _: Exception =>
    +        assert(true)
    +    }
    +
    +    sql("drop table if exists load32000bytes")
    +
    +  }
    +
    +  test("test load / insert / update with data more than 32000 bytes - 
dictionary_include") {
    +    val testdata = s"$resourcesPath/unicodechar.csv"
    +    sql("drop table if exists load32000bytes")
    +    sql("create table load32000bytes(name string) stored by 'carbondata' 
TBLPROPERTIES('DICTIONARY_INCLUDE'='name')")
    +    sql("insert into table load32000bytes select 'aaa'")
    +
    +    val error = intercept[Exception] {
    +      sql(s"load data local inpath '$testdata' into table load32000bytes 
OPTIONS ('FILEHEADER'='name')")
    +    }.getMessage
    +
    +    assert(intercept[Exception] {
    +      sql(s"load data local inpath '$testdata' into table load32000bytes 
OPTIONS ('FILEHEADER'='name')")
    +    }.getMessage.contains("generate global dictionary failed, Dataload 
failed, String size cannot exceed 32000 bytes"))
    +
    +    val source = scala.io.Source.fromFile(testdata)
    +    val data = source.mkString
    +
    +    try {
    +      sql(s"insert into load32000bytes values('$data')")
    +      assert(false)
    +    } catch {
    +      case _: Exception =>
    +        assert(true)
    +    }
    +
    +    try {
    --- End diff --
    
    avoid using try catch at all the places in the modified code


---

Reply via email to