[GitHub] [carbondata] ajantha-bhat commented on a change in pull request #3509: [CARBONDATA-3618] Update query should throw exception if key has more than one value

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[GitHub] [carbondata] ajantha-bhat commented on a change in pull request #3509: [CARBONDATA-3618] Update query should throw exception if key has more than one value

GitBox
ajantha-bhat commented on a change in pull request #3509: [CARBONDATA-3618] Update query should throw exception if key has more than one value
URL: https://github.com/apache/carbondata/pull/3509#discussion_r361782285
 
 

 ##########
 File path: integration/spark2/src/main/scala/org/apache/spark/sql/execution/command/mutation/CarbonProjectForUpdateCommand.scala
 ##########
 @@ -135,7 +136,24 @@ private[sql] case class CarbonProjectForUpdateCommand(
           else {
             Dataset.ofRows(sparkSession, plan)
           }
-
+          if (CarbonProperties.getValidateUpdateKeyValueMapping) {
+            // If more than one value present for the update key, should fail the update
+            val ds = dataSet.select(CarbonCommonConstants.CARBON_IMPLICIT_COLUMN_TUPLEID)
+              .groupBy(CarbonCommonConstants.CARBON_IMPLICIT_COLUMN_TUPLEID)
+              .count()
+              .select("count")
+              .filter(col("count") > lit(1))
+              .limit(1)
+              .collect()
 
 Review comment:
   @jackylk : yes, it is now in the same place as you are suggesting.
   line 135, we are making `Dataset.ofRows(sparkSession, plan)`, on top of this only I am collecting tupleId.

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


With regards,
Apache Git Services