Github user ravipesala commented on a diff in the pull request:

    https://github.com/apache/carbondata/pull/2587#discussion_r206419167
  
    --- Diff: 
core/src/main/java/org/apache/carbondata/core/metadata/SegmentFileStore.java ---
    @@ -793,25 +794,31 @@ public static void cleanSegments(CarbonTable table, 
List<PartitionSpec> partitio
       /**
        * Deletes the segment file and its physical files like partition 
folders from disk
        * @param tablePath
    -   * @param segmentFile
    +   * @param segment
        * @param partitionSpecs
        * @throws IOException
        */
    -  public static void deleteSegment(String tablePath, String segmentFile,
    -      List<PartitionSpec> partitionSpecs) throws IOException {
    -    SegmentFileStore fileStore = new SegmentFileStore(tablePath, 
segmentFile);
    +  public static void deleteSegment(String tablePath, Segment segment,
    +      List<PartitionSpec> partitionSpecs,
    +      SegmentUpdateStatusManager updateStatusManager) throws Exception {
    +    SegmentFileStore fileStore = new SegmentFileStore(tablePath, 
segment.getSegmentFileName());
         List<String> indexOrMergeFiles = 
fileStore.readIndexFiles(SegmentStatus.SUCCESS, true);
         Map<String, List<String>> indexFilesMap = fileStore.getIndexFilesMap();
         for (Map.Entry<String, List<String>> entry : indexFilesMap.entrySet()) 
{
           FileFactory.deleteFile(entry.getKey(), 
FileFactory.getFileType(entry.getKey()));
           for (String file : entry.getValue()) {
    +        String[] deltaFilePaths =
    +            updateStatusManager.getDeleteDeltaFilePath(file, 
segment.getSegmentNo());
    +        for (String deltaFilePath : deltaFilePaths) {
    +          FileFactory.deleteFile(deltaFilePath, 
FileFactory.getFileType(deltaFilePath));
    +        }
             FileFactory.deleteFile(file, FileFactory.getFileType(file));
           }
         }
         deletePhysicalPartition(partitionSpecs, indexFilesMap, 
indexOrMergeFiles, tablePath);
         String segmentFilePath =
             CarbonTablePath.getSegmentFilesLocation(tablePath) + 
CarbonCommonConstants.FILE_SEPARATOR
    --- End diff --
    
    ok


---

Reply via email to