Copilot commented on code in PR #15265:
URL: https://github.com/apache/iotdb/pull/15265#discussion_r2026317883
##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/ModificationUtils.java:
##########
@@ -404,16 +403,18 @@ public static List<ModEntry> sortAndMerge(List<ModEntry>
modifications) {
}
public static boolean isDeviceDeletedByMods(
- Collection<ModEntry> currentModifications, ITimeIndex currentTimeIndex,
IDeviceID device)
+ final Collection<ModEntry> currentModifications,
+ final ITimeIndex currentTimeIndex,
+ final IDeviceID device)
throws IllegalPathException {
- if (currentTimeIndex == null) {
- return false;
- }
- Optional<Long> startTime = currentTimeIndex.getStartTime(device);
- Optional<Long> endTime = currentTimeIndex.getEndTime(device);
- if (startTime.isPresent() && endTime.isPresent()) {
- return isAllDeletedByMods(currentModifications, device, startTime.get(),
endTime.get());
- }
- return false;
+ return isAllDeletedByMods(
+ currentModifications,
+ device,
+ Objects.isNull(currentTimeIndex)
+ ? Long.MIN_VALUE
+ : currentTimeIndex.getStartTime(device).orElse(Long.MIN_VALUE),
+ Objects.isNull(currentTimeIndex)
+ ? Long.MAX_VALUE
+ : currentTimeIndex.getStartTime(device).orElse(Long.MAX_VALUE));
Review Comment:
The upper time bound in isDeviceDeletedByMods uses getStartTime(device)
instead of getEndTime(device). Use getEndTime(device) to correctly determine
the deletion interval.
```suggestion
: currentTimeIndex.getEndTime(device).orElse(Long.MAX_VALUE));
```
--
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]