private void applyModificationForAlignedChunkMetadataList(
      TsFileResource tsFileResource, List<AbstractAlignedChunkMetadata> alignedChunkMetadataList)
      throws IllegalPathException {
    if (alignedChunkMetadataList.isEmpty()) {
      // all the value chunks is empty chunk
      return;
    }
    IDeviceID device = currentDevice.getLeft();
    ModEntry ttlDeletion = null;
    Optional<Long> startTime = tsFileResource.getStartTime(device);
    if (startTime.isPresent() && startTime.get() < timeLowerBoundForCurrentDevice) {
      ttlDeletion = CompactionUtils.convertTtlToDeletion(device, timeLowerBoundForCurrentDevice);
    }

    List<ModEntry> modifications =
        modificationCache.computeIfAbsent(
            tsFileResource, r -> new ArrayList<>(tsFileResource.getAllModEntries()));

    // construct the input params List<List<Modification>> for QueryUtils.modifyAlignedChunkMetaData
    AbstractAlignedChunkMetadata alignedChunkMetadata = alignedChunkMetadataList.get(0);
    List<IChunkMetadata> valueChunkMetadataList = alignedChunkMetadata.getValueChunkMetadataList();

    // match time column modifications
    List<ModEntry> modificationForTimeColumn = new ArrayList<>();
    for (ModEntry modification : modifications) {
      if (modification.affectsAll(device)) {
        modificationForTimeColumn.add(modification);
      }
    }
    if (ttlDeletion != null) {
      modificationForTimeColumn.add(ttlDeletion);
    }

    // match value column modifications
    List<List<ModEntry>> modificationForValueColumns = new ArrayList<>();
    for (IChunkMetadata valueChunkMetadata : valueChunkMetadataList) {
      if (valueChunkMetadata == null) {
        modificationForValueColumns.add(Collections.emptyList());
        continue;
      }
      List<ModEntry> modificationList = new ArrayList<>();
      for (ModEntry modification : modifications) {
        if (modification.affects(currentDevice.getLeft())
            && modification.affects(valueChunkMetadata.getMeasurementUid())) {
          modificationList.add(modification);
        }
      }
      if (ttlDeletion != null) {
        modificationList.add(ttlDeletion);
      }
      modificationForValueColumns.add(
          modificationList.isEmpty() ? Collections.emptyList() : modificationList);
    }

    ModificationUtils.modifyAlignedChunkMetaData(
        alignedChunkMetadataList,
        modificationForTimeColumn,
        modificationForValueColumns,
        ignoreAllNullRows);
  }
collect the modification for current device and apply it to the alignedChunkMetadataList.

@param tsFileResource tsfile resource
@param alignedChunkMetadataList list of aligned chunk metadata
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/compaction/execute/utils/MultiTsFileDeviceIterator.java