public static List<List<TimeRange>> constructDeletionList(
      IDeviceID deviceID,
      List<String> measurementList,
      IMemTable memTable,
      List<Pair<ModEntry, IMemTable>> modsToMemtable,
      long timeLowerBound) {
    if (measurementList.isEmpty()) {
      return Collections.emptyList();
    }
    List<ModEntry> modifications =
        ModificationUtils.getModificationsForMemtable(memTable, modsToMemtable);
    List<List<TimeRange>> deletionList = new ArrayList<>();
    for (String measurement : measurementList) {
      List<TimeRange> columnDeletionList = new ArrayList<>();
      columnDeletionList.add(new TimeRange(Long.MIN_VALUE, timeLowerBound));
      for (ModEntry modification : modifications) {
        if (modification.affects(deviceID)
            && modification.affects(measurement)
            && modification.getEndTime() > timeLowerBound) {
          long lowerBound = Math.max(modification.getStartTime(), timeLowerBound);
          columnDeletionList.add(new TimeRange(lowerBound, modification.getEndTime()));
        }
      }
      deletionList.add(TimeRange.sortAndMerge(columnDeletionList));
    }
    return deletionList;
  }
Methods for modification in memory table
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/ModificationUtils.java