Login  Register

[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

Posted by GitBox on May 25, 2021; 2:56pm
URL: http://apache-carbondata-dev-mailing-list-archive.168.s1.nabble.com/GitHub-carbondata-maheshrajus-opened-a-new-pull-request-4139-WIP-update-table-for-primitive-column-nh-tp108346p108400.html


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



##########
File path: integration/spark/src/main/scala/org/apache/spark/sql/parser/CarbonSpark2SqlParser.scala
##########
@@ -257,6 +258,23 @@ class CarbonSpark2SqlParser extends CarbonDDLSqlParser {
     (SET ~> "(" ~> repsep(element, ",") <~ ")") ~
     ("=" ~> restInput) <~ opt(";") ^^ {
       case tab ~ columns ~ rest =>
+        // If update is received for complex data types then throw exception
+        var finalColumns = List.empty[String]
+        var updateColumns = new ListBuffer[String]()
+        columns.foreach { column =>
+          if (column.contains('.')) {
+            val columnFullName = column.split('.')
+            if ((tab._3.isDefined && tab._3.get.equals(columnFullName(0)))
+                || tab._4.table.equals(columnFullName(0))) {
+              updateColumns += columnFullName(1)

Review comment:
       hi ajantha , i tried with below example. Carbondata not receiving command parse as spark itself throwing exception.
   Spark is allowing two level update but not three levels. Please help me if anything I am missing over here.
   
   ```
   CREATE TABLE test_rename (str1 struct<a:int>, str2 struct<a:struct<b:int>>, str3 struct<a:struct<b:struct<c:int>>>, intfield int) STORED AS carbondata
   update test_rename set(str3.a.b)=(4)
   
   ```
   ![image](https://user-images.githubusercontent.com/17046058/119519572-2d245800-bd97-11eb-90f1-700a91113999.png)
   




--
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:
[hidden email]