carbondata-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kunal642 <...@git.apache.org>
Subject [GitHub] carbondata pull request #1011: [carbondata-1149] Fix issue of mismatch type ...
Date Mon, 12 Jun 2017 05:50:04 GMT
Github user kunal642 commented on a diff in the pull request:

    https://github.com/apache/carbondata/pull/1011#discussion_r121313629
  
    --- Diff: integration/spark-common-test/src/test/scala/org/apache/carbondata/spark/testsuite/partition/TestDDLForPartitionTable.scala
---
    @@ -122,6 +122,254 @@ class TestDDLForPartitionTable  extends QueryTest with BeforeAndAfterAll
{
         intercept[Exception] { sql("alter table test drop columns(c)") }
       }
     
    +  test("test exception if hash number is invalid") {
    +    sql("DROP TABLE IF EXISTS test_hash_1")
    +    try {
    +      sql(
    +        """
    +          | CREATE TABLE test_hash_1(col1 INT, col2 STRING)
    +          | PARTITIONED BY (col3 INT) STORED BY 'carbondata'
    +          | TBLPROPERTIES('PARTITION_TYPE'='HASH', 'NUM_PARTITIONS'='2.1')
    +        """.stripMargin
    +      )
    +    } catch {
    +      case e: Exception =>
    +        assert(e.getMessage.contains("Invalid partition definition"))
    +    }
    +
    +    sql("DROP TABLE IF EXISTS test_hash_2")
    +    try {
    +      sql(
    +        """
    +          | CREATE TABLE test_hash_2(col1 INT, col2 STRING)
    +          | PARTITIONED BY (col3 INT) STORED BY 'carbondata'
    +          | TBLPROPERTIES('PARTITION_TYPE'='HASH', 'NUM_PARTITIONS'='abc')
    +        """.stripMargin
    +      )
    +    } catch {
    +      case e: Exception =>
    +        assert(e.getMessage.contains("Invalid partition definition"))
    +    }
    +
    +    sql("DROP TABLE IF EXISTS test_hash_3")
    +    try {
    +      sql(
    +        """
    +          | CREATE TABLE test_hash_3(col1 INT, col2 STRING)
    +          | PARTITIONED BY (col3 INT) STORED BY 'carbondata'
    +          | TBLPROPERTIES('PARTITION_TYPE'='HASH', 'NUM_PARTITIONS'='-2.1')
    +        """.stripMargin
    +      )
    +    } catch {
    +      case e: Exception =>
    +        assert(e.getMessage.contains("Invalid partition definition"))
    +    }
    +  }
    +
    +  test("test exception when values in list_info can not match partition column type")
{
    +    sql("DROP TABLE IF EXISTS test_list_1")
    +    try {
    +      sql(
    +        """
    +          | CREATE TABLE test_list_1(col1 INT, col2 STRING)
    +          | PARTITIONED BY (col3 INT) STORED BY 'carbondata'
    +          | TBLPROPERTIES('PARTITION_TYPE'='LIST', 'LIST_INFO'='abc,def')
    +        """.stripMargin)
    +    } catch {
    +      case e: Exception =>
    +        assert(e.getMessage.contains("Invalid partition definition"))
    +    }
    +
    +    // scalastyle:off
    +    sql("DROP TABLE IF EXISTS test_list_2")
    +    try {
    +      sql("CREATE TABLE test_list_2(col1 INT, col2 STRING) PARTITIONED BY (col3 SHORT)
STORED BY 'carbondata' TBLPROPERTIES('PARTITION_TYPE'='LIST', 'LIST_INFO'='abc,def')")
    +    } catch {
    +      case e: Exception =>
    +        assert(e.getMessage.contains("Invalid partition definition"))
    +    }
    +
    +    // scalastyle:on
    +    sql("DROP TABLE IF EXISTS test_list_3")
    +    try {
    +      sql(
    +        """
    +          | CREATE TABLE test_list_3(col1 INT, col2 STRING)
    +          | PARTITIONED BY (col3 FLOAT) STORED BY 'carbondata'
    +          | TBLPROPERTIES('PARTITION_TYPE'='LIST', 'LIST_INFO'='abc,def')
    +        """.stripMargin)
    +    } catch {
    +      case e: Exception =>
    +        assert(e.getMessage.contains("Invalid partition definition"))
    +    }
    +
    +    sql("DROP TABLE IF EXISTS test_list_4")
    +    try {
    +      sql(
    +        """
    +          | CREATE TABLE test_list_4(col1 INT, col2 STRING)
    +          | PARTITIONED BY (col3 DOUBLE) STORED BY 'carbondata'
    +          | TBLPROPERTIES('PARTITION_TYPE'='LIST', 'LIST_INFO'='abc,def')
    +        """.stripMargin)
    +    } catch {
    +      case e: Exception =>
    +        assert(e.getMessage.contains("Invalid partition definition"))
    +    }
    +
    +    sql("DROP TABLE IF EXISTS test_list_5")
    +    try {
    +      sql(
    +        """
    +          | CREATE TABLE test_list_5(col1 INT, col2 STRING)
    +          | PARTITIONED BY (col3 LONG) STORED BY 'carbondata'
    +          | TBLPROPERTIES('PARTITION_TYPE'='LIST', 'LIST_INFO'='abc,def')
    +        """.stripMargin)
    +    } catch {
    +      case e:Exception =>
    +        assert(e.getMessage.contains("Invalid partition definition"))
    +    }
    +
    +    //    sql("DROP TABLE IF EXISTS test_list_6")
    --- End diff --
    
    remove the commented test cases


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message