vikramahuja1001 commented on a change in pull request #4246: URL: https://github.com/apache/carbondata/pull/4246#discussion_r779352493
########## File path: core/src/main/java/org/apache/carbondata/core/mutate/CarbonUpdateUtil.java ########## @@ -733,9 +733,21 @@ public static long cleanUpDeltaFiles(CarbonTable table, boolean isDryRun) throws } SegmentUpdateDetails[] updateDetails = updateStatusManager.readLoadMetadata(); for (SegmentUpdateDetails block : updateDetails) { - totalDeltaFiles.stream().filter(fileName -> fileName.getName().endsWith(block - .getDeleteDeltaStartTimestamp() + CarbonCommonConstants.DELETE_DELTA_FILE_EXT)) - .collect(Collectors.toList()).forEach(fileName -> totalDeltaFiles.remove(fileName)); + // Case 1: When deleteDeltaStartTimestamp = deleteDeltaEndTimestamp. in this case only 1 + // delta file is present and deltaFileStamps is NULL + // Case 2: When deleteDeltaStartTimestamp != deleteDeltaEndTimestamp. in thios case more + // than 1 delta files are present, then can blindly read deltaFilesStamps variable + if (block.getDeleteDeltaStartTimestamp().equals(block.getDeleteDeltaEndTimestamp())) { + totalDeltaFiles.stream().filter(fileName -> fileName.getName().endsWith(block + .getDeleteDeltaStartTimestamp() + CarbonCommonConstants.DELETE_DELTA_FILE_EXT)) + .collect(Collectors.toList()).forEach(totalDeltaFiles::remove); + } else { + for (String deltaFile: block.getDeltaFileStamps()) { + totalDeltaFiles.stream().filter(fileName -> fileName.getName().endsWith( + deltaFile + CarbonCommonConstants.DELETE_DELTA_FILE_EXT)) + .collect(Collectors.toList()).forEach(totalDeltaFiles::remove); Review comment: done -- 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. To unsubscribe, e-mail: dev-unsubscr...@carbondata.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org