[GitHub] carbondata pull request #1011: [carbondata-1149] Fix issue of mismatch type ...
Github user chenerlu closed the pull request at: https://github.com/apache/carbondata/pull/1011 --- 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 infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] carbondata pull request #1011: [carbondata-1149] Fix issue of mismatch type ...
Github user kunal642 commented on a diff in the pull request: https://github.com/apache/carbondata/pull/1011#discussion_r121313645 --- 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") +//try { +// val errorMessage_list_6 = intercept[Exception] { +//sql( +// """ +//|CREATE TABLE test_list_6(col1 INT, col2 STRING) PARTITIONED BY (col3 DECIMAL) +//|STORED BY 'carbondata' TBLPROPERTIES('PARTITION_TYPE'='LIST', 'LIST_INFO'='abc,def') +// """.stripMargin) +// } +//
[GitHub] carbondata pull request #1011: [carbondata-1149] Fix issue of mismatch type ...
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 infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] carbondata pull request #1011: [carbondata-1149] Fix issue of mismatch type ...
Github user gvramana commented on a diff in the pull request: https://github.com/apache/carbondata/pull/1011#discussion_r121312645 --- 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") --- End diff -- One test for failure validation is sufficient. As all of them are covered in parse exception --- 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 infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] carbondata pull request #1011: [carbondata-1149] Fix issue of mismatch type ...
GitHub user chenerlu opened a pull request: https://github.com/apache/carbondata/pull/1011 [carbondata-1149] Fix issue of mismatch type of partition column when specify partition info Background: Create table should fail as data type mismatch in partition column type and partition info value. Solution: Add type convert check in validate partition column . You can merge this pull request into a Git repository by running: $ git pull https://github.com/chenerlu/incubator-carbondata carbondata-1149 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/carbondata/pull/1011.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #1011 commit 862ec023bff1279f7920cabf20af9451556d14c0 Author: chenerluDate: 2017-06-09T09:33:30Z fix issue of carbondata-1149 --- 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 infrastruct...@apache.org or file a JIRA ticket with INFRA. ---