You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@carbondata.apache.org by ja...@apache.org on 2018/03/13 16:53:15 UTC

carbondata git commit: [CARBONDATA-2288] [Test] Exception is Masked Inside StandardPartitionTableQueryTestCase

Repository: carbondata
Updated Branches:
  refs/heads/master 94707f2da -> c5b21ff67


[CARBONDATA-2288] [Test] Exception is Masked Inside StandardPartitionTableQueryTestCase

This closes #2034


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

Branch: refs/heads/master
Commit: c5b21ff678d8115ea2c8b14aa804fc36f05cc303
Parents: 94707f2
Author: anubhav100 <an...@knoldus.in>
Authored: Tue Mar 6 12:08:48 2018 +0530
Committer: Jacky Li <ja...@qq.com>
Committed: Wed Mar 14 00:52:59 2018 +0800

----------------------------------------------------------------------
 .../StandardPartitionTableQueryTestCase.scala   | 23 +++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/carbondata/blob/c5b21ff6/integration/spark-common-test/src/test/scala/org/apache/carbondata/spark/testsuite/standardpartition/StandardPartitionTableQueryTestCase.scala
----------------------------------------------------------------------
diff --git a/integration/spark-common-test/src/test/scala/org/apache/carbondata/spark/testsuite/standardpartition/StandardPartitionTableQueryTestCase.scala b/integration/spark-common-test/src/test/scala/org/apache/carbondata/spark/testsuite/standardpartition/StandardPartitionTableQueryTestCase.scala
index 163e662..4cce7d5 100644
--- a/integration/spark-common-test/src/test/scala/org/apache/carbondata/spark/testsuite/standardpartition/StandardPartitionTableQueryTestCase.scala
+++ b/integration/spark-common-test/src/test/scala/org/apache/carbondata/spark/testsuite/standardpartition/StandardPartitionTableQueryTestCase.scala
@@ -17,6 +17,7 @@
 package org.apache.carbondata.spark.testsuite.standardpartition
 
 import org.apache.spark.sql.execution.BatchedDataSourceScanExec
+import org.apache.spark.sql.test.Spark2TestQueryExecutor
 import org.apache.spark.sql.test.util.QueryTest
 import org.apache.spark.sql.{DataFrame, Row}
 import org.scalatest.BeforeAndAfterAll
@@ -244,11 +245,31 @@ class StandardPartitionTableQueryTestCase extends QueryTest with BeforeAndAfterA
   }
 
 test("Creation of partition table should fail if the colname in table schema and partition column is same even if both are case sensitive"){
-  intercept[Exception]{
+
+  val exception = intercept[Exception]{
     sql("CREATE TABLE uniqdata_char2(name char,id int) partitioned by (NAME char)stored by 'carbondata' ")
   }
+  if(Spark2TestQueryExecutor.spark.version.startsWith("2.1.0")){
+    assert(exception.getMessage.contains("Operation not allowed: Partition columns should not be " +
+                                         "specified in the schema: [\"name\"]"))
+  }
+  else{
+    //spark 2.2 allow creating char data type only with digits thats why this assert is here as it will throw this exception
+    assert(exception.getMessage.contains("DataType char is not supported"))
+
+  }
 }
 
+  test("Creation of partition table should fail for both spark version with same exception when char data type is created with specified digit and colname in table schema and partition column is same even if both are case sensitive"){
+
+    sql("DROP TABLE IF EXISTS UNIQDATA_CHAR2")
+    val exception = intercept[Exception]{
+      sql("CREATE TABLE uniqdata_char2(name char(10),id int) partitioned by (NAME char(10))stored by 'carbondata' ")
+    }
+    assert(exception.getMessage.contains("Operation not allowed: Partition columns should not be " +
+                                         "specified in the schema: [\"name\"]"))
+  }
+
   test("Renaming a partition table should fail"){
     sql("drop table if exists partitionTable")
     sql(