private List<TimeRange> getOldSortedDeleteIntervals(
      IDeviceID deviceId, MeasurementSchema schema) {
    if (oldModification != null) {
      ChunkMetadata chunkMetadata = new ChunkMetadata();
      modsIterator = oldModification.iterator();
      ModEntry currentDeletion = null;
      while (modsIterator.hasNext()) {
        currentDeletion = modsIterator.next();
        // if deletion path match the chunkPath, then add the deletion to the list
        if (currentDeletion.affects(deviceId)
            && currentDeletion.affects(schema.getMeasurementName())) {
          chunkMetadata.insertIntoSortedDeletions(currentDeletion.getTimeRange());
        }
      }
      return chunkMetadata.getDeleteIntervalList();
    }
    return null;
  }
This method is for rewriting the Chunk which data is in the different time partitions. In this
case, we have to decode the data to points, and then rewrite the data points to different
chunkWriters, finally write chunks to their own upgraded TsFiles.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/tools/TsFileSplitByPartitionTool.java