Indhumathi27 commented on a change in pull request #4138:
URL: https://github.com/apache/carbondata/pull/4138#discussion_r636305477



##########
File path: 
integration/spark/src/test/scala/org/apache/spark/carbondata/restructure/AlterTableValidationTestCase.scala
##########
@@ -812,6 +812,56 @@ test("test alter command for boolean data type with 
correct default measure valu
     sql("DROP TABLE t1")
   }
 
+  test("testing the duplicate add columns for complex data types") {
+    sql("drop table if exists alter_complex")
+    sql("create table alter_complex (a int, b string, arr1 array<int>) " +
+        "stored as carbondata")
+    var exception = intercept[ProcessMetaDataException] {
+      sql("alter table alter_complex add columns(arr1 array<int>)")
+    }
+    assert(exception.getMessage
+      .contains("Alter table add operation failed: Duplicate column found with 
name"))
+    exception = intercept[ProcessMetaDataException] {
+      sql("alter table alter_complex add columns(arr2 array<int>, arr2 
array<int>)")
+    }
+    assert(exception.getMessage
+      .contains("Alter table add operation failed: Duplicate column found with 
name"))
+    exception = intercept[ProcessMetaDataException] {
+      sql("alter table alter_complex add columns(c int, c int)")
+    }
+    assert(exception.getMessage
+      .contains("Alter table add operation failed: Duplicate column found with 
name"))
+    exception = intercept[ProcessMetaDataException] {
+      sql("alter table alter_complex add columns(c int, c string)")
+    }
+    assert(exception.getMessage
+      .contains("Alter table add operation failed: Duplicate column found with 
name"))
+    exception = intercept[ProcessMetaDataException] {
+      sql("alter table alter_complex add columns(c string, c int)")
+    }
+    assert(exception.getMessage
+      .contains("Alter table add operation failed: Duplicate column found with 
name"))
+    exception = intercept[ProcessMetaDataException] {
+      sql("alter table alter_complex add columns(c string, c array<string>)")
+    }
+    assert(exception.getMessage
+      .contains("Alter table add operation failed: Duplicate column found with 
name"))
+  }
+
+  test("testing the long string properties for complex columns") {
+    sql("drop table if exists alter_complex")
+    sql("create table alter_complex (a int, arr1 array<string>) " +
+        "stored as carbondata")
+    val exception = intercept[RuntimeException] {
+      sql("alter table alter_complex SET TBLPROPERTIES" +
+          "('LONG_STRING_COLUMNS'='arr1.val')")
+    }
+    assert(exception.getMessage

Review comment:
       Here also, can directly check  intercept[] {}.getmessage.contains(errMsg)




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to