[GitHub] [carbondata] akashrn5 commented on a change in pull request #3988: [CARBONDATA-4037] Improve the table status and segment file writing

Posted by GitBox on
URL: http://apache-carbondata-dev-mailing-list-archive.168.s1.nabble.com/GitHub-carbondata-ShreelekhyaG-opened-a-new-pull-request-3988-WIP-Clean-index-files-when-clean-filesd-tp102150p107582.html


akashrn5 commented on a change in pull request #3988:
URL: https://github.com/apache/carbondata/pull/3988#discussion_r613191589



##########
File path: integration/spark/src/main/scala/org/apache/spark/sql/secondaryindex/util/SecondaryIndexUtil.scala
##########
@@ -231,73 +240,36 @@ object SecondaryIndexUtil {
           } else {
             siRebuildRDD.partitions.foreach { partition =>
               val carbonSparkPartition = partition.asInstanceOf[CarbonSparkPartition]
-              deleteOldCarbonDataFiles(carbonSparkPartition)
+              deleteOldCarbonDataFiles(carbonSparkPartition, validSegmentsToUse.toList)
             }
           }
+          val segmentToLoadStartTimeMap: scala.collection.mutable.Map[String, java.lang.Long] =
+            scala.collection.mutable.Map()
+          // merge index files and write segment file for merged segments
           mergedSegments.asScala.map { seg =>
+            val segmentPath = CarbonTablePath.getSegmentPath(tablePath, seg.getLoadName)
+            try {
+              new CarbonIndexFileMergeWriter(indexCarbonTable)
+                .writeMergeIndexFileBasedOnSegmentFolder(null, false, segmentPath,
+                  seg.getLoadName, carbonLoadModel.getFactTimeStamp.toString,
+                  true)
+            } catch {
+              case e: IOException =>
+                val message =
+                  "Failed to merge index files in path: " + segmentPath + ": " + e.getMessage()

Review comment:
       its a scala class, so you can use `s"..... $variable ...."` for string concatination




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