You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@carbondata.apache.org by GitBox <gi...@apache.org> on 2021/06/01 09:41:10 UTC

[GitHub] [carbondata] maheshrajus commented on a change in pull request #4139: [CARBONDATA-4191] update table for primitive column not working when complex child column name and primitive column name match

maheshrajus commented on a change in pull request #4139:
URL: https://github.com/apache/carbondata/pull/4139#discussion_r642947612



##########
File path: integration/spark/src/test/scala/org/apache/carbondata/integration/spark/testsuite/complexType/TestComplexDataType.scala
##########
@@ -757,14 +757,99 @@ class TestComplexDataType extends QueryTest with BeforeAndAfterAll {
     sql("DROP TABLE IF EXISTS test")
     sql("create table test(id int,a struct<b:int,c:int>,d array<int>) STORED AS carbondata")
     sql("insert into test values(1, named_struct('b', 2, 'c', 3), array(4))")
-    val structException = intercept[UnsupportedOperationException](
+    val structException = intercept[AnalysisException](
     sql("update test set(a.b)=(4) where id=1").collect())
-    assertResult("Unsupported operation on Complex data type")(structException.getMessage)
+    assert(structException.getMessage().contains("Unsupported operation on Complex data type"))
     val arrayException = intercept[UnsupportedOperationException](
     sql("update test set(a)=(4) where id=1").collect())
     assertResult("Unsupported operation on Complex data type")(arrayException.getMessage)
   }
 
+  test("check update operation on primitive data types when complex type present in table which " +
+       "has child name equal to primitive data types") {
+    sql("drop table if exists update_complex")
+    sql("create table update_complex (a int, b string, struct1 STRUCT<a:int, c:string>) " +
+        "stored as carbondata")
+    sql("insert into update_complex select 1,'c', named_struct('a',4,'b','d')")
+    sql("update update_complex set (a)=(4)")
+    checkAnswer(sql("select a from update_complex"),
+      Seq(Row(4)))
+    sql("update update_complex set (b)=('y')")

Review comment:
       done




-- 
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