Indhumathi27 commented on a change in pull request #4048: URL: https://github.com/apache/carbondata/pull/4048#discussion_r544322928
########## File path: core/src/main/java/org/apache/carbondata/core/metadata/SegmentFileStore.java ########## @@ -1125,19 +1125,21 @@ public static void deleteSegment(String tablePath, Segment segment, SegmentFileStore fileStore = new SegmentFileStore(tablePath, segment.getSegmentFileName()); List<String> indexOrMergeFiles = fileStore.readIndexFiles(SegmentStatus.SUCCESS, true, FileFactory.getConfiguration()); - Map<String, List<String>> indexFilesMap = fileStore.getIndexFilesMap(); - for (Map.Entry<String, List<String>> entry : indexFilesMap.entrySet()) { - FileFactory.deleteFile(entry.getKey()); - for (String file : entry.getValue()) { - String[] deltaFilePaths = - updateStatusManager.getDeleteDeltaFilePath(file, segment.getSegmentNo()); - for (String deltaFilePath : deltaFilePaths) { - FileFactory.deleteFile(deltaFilePath); + if (!indexOrMergeFiles.isEmpty() && indexOrMergeFiles.get(0).startsWith(tablePath)) { Review comment: what if the external segment is copied inside table folder, this will delete external segment also ---------------------------------------------------------------- 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: us...@infra.apache.org