akashrn5 commented on a change in pull request #4246:
URL: https://github.com/apache/carbondata/pull/4246#discussion_r779609866
##########
File path:
core/src/main/java/org/apache/carbondata/core/mutate/CarbonUpdateUtil.java
##########
@@ -732,11 +732,21 @@ public static long cleanUpDeltaFiles(CarbonTable table,
boolean isDryRun) throws
.collect(Collectors.toList()));
}
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
this case more
+ // than 1 delta files are present, then can blindly read
deltaFilesStamps variable
+ Arrays.stream(updateDetails).forEach(block -> {
+ if
(block.getDeleteDeltaStartTimestamp().equals(block.getDeleteDeltaEndTimestamp()))
{
+ totalDeltaFiles.removeIf(filter -> filter.getName().endsWith(block
+ .getDeleteDeltaEndTimestamp() +
CarbonCommonConstants.DELETE_DELTA_FILE_EXT));
+ } else {
+ block.getDeltaFileStamps().stream().forEach(fileName ->
totalDeltaFiles
+ .removeIf(filter -> filter.getName().endsWith(fileName +
Review comment:
same as above
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]