You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@carbondata.apache.org by GitBox <gi...@apache.org> on 2020/01/05 06:32:03 UTC

[GitHub] [carbondata] jackylk commented on a change in pull request #3559: [CARBONDATA-3652] Make insert and select table columns equal

jackylk commented on a change in pull request #3559: [CARBONDATA-3652] Make insert and select table columns equal
URL: https://github.com/apache/carbondata/pull/3559#discussion_r363072487
 
 

 ##########
 File path: integration/spark2/src/test/scala/org/apache/spark/sql/CarbonAnalysisTest.scala
 ##########
 @@ -0,0 +1,25 @@
+package org.apache.spark.sql
+
+import org.apache.spark.sql.common.util.Spark2QueryTest
+import org.scalatest.BeforeAndAfterAll
+
+class CarbonAnalysisTest extends Spark2QueryTest with BeforeAndAfterAll {
+
+  override def afterAll(): Unit = {
+    sql("DROP TABLE IF EXISTS table1")
+    sql("DROP TABLE IF EXISTS table2")
+  }
+
+  test("test carbon insert and select table column not equal") {
+    sql("DROP TABLE IF EXISTS table1")
+    sql("DROP TABLE IF EXISTS table2")
+    sql("create table table1 (col1 string, col2 string) partitioned by(pt string) stored by 'carbondata'")
+    sql("create table table2 (t2_c1 string, t2_c2 string, t2_c3 string) partitioned by(pt string)")
+
+    sql("insert overwrite table table2 partition(pt=20200101) values('v11', 'v12', 'v13')")
+    val e = intercept[Exception] {
+      sql("insert into table1 select * from table2")
+    }
+    assert(e.getMessage.contains("number of columns are different"))
+  }
 
 Review comment:
   You mean in this case, user should use `insert into table1 select t2_c1, t2_c2, pt from table2` after adding new column in table2?

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services