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



##########
File path: 
integration/spark/src/main/scala/org/apache/carbondata/spark/rdd/CarbonTableCompactor.scala
##########
@@ -276,7 +294,40 @@ class CarbonTableCompactor(
           segmentMetaDataAccumulator)
       } else {
         if (mergeRDD != null) {
-          mergeRDD.collect
+          val result = mergeRDD.collect
+          if (!updatePartitionSpecs.isEmpty) {
+            val tableIdentifier = new TableIdentifier(carbonTable.getTableName,
+              Some(carbonTable.getDatabaseName))
+            // To update partitionSpec in hive metastore, drop and add with 
latest path.
+            val oldPartitions: util.List[TablePartitionSpec] =
+              new util.ArrayList[TablePartitionSpec]()
+            val newPartitions: util.List[TablePartitionSpec] =
+              new util.ArrayList[TablePartitionSpec]()
+            updatePartitionSpecs.asScala.foreach {
+              partitionSpec =>
+                var spec = PartitioningUtils.parsePathFragment(
+                  String.join(CarbonCommonConstants.FILE_SEPARATOR, 
partitionSpec.getPartitions))
+                oldPartitions.add(spec)
+                val addPartition = 
mergeRDD.checkAndUpdatePartitionLocation(partitionSpec)
+                spec = PartitioningUtils.parsePathFragment(

Review comment:
        partitionSpec.getPartitions and addPartition.getPartitions will be same 
only. so, please remove oldPartiiton and new partition list and keep one




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