protected void checkSequenceSpaceOverlap(
      List<TsFileResource> sourceSeqFiles,
      List<TsFileResource> sourceUnseqFiles,
      List<TsFileResource> targetFiles,
      List<TsFileResource> validTargetFiles) {
    List<TsFileResource> timePartitionSeqFiles =
        new ArrayList<>(tsFileManager.getOrCreateSequenceListByTimePartition(timePartition));
    timePartitionSeqFiles.removeAll(sourceSeqFiles);
    timePartitionSeqFiles.addAll(validTargetFiles);
    timePartitionSeqFiles.sort(
        (f1, f2) -> {
          int timeDiff =
              Long.compareUnsigned(
                  Long.parseLong(f1.getTsFile().getName().split("-")[0]),
                  Long.parseLong(f2.getTsFile().getName().split("-")[0]));
          return timeDiff == 0
              ? Long.compareUnsigned(
                  Long.parseLong(f1.getTsFile().getName().split("-")[1]),
                  Long.parseLong(f2.getTsFile().getName().split("-")[1]))
              : timeDiff;
        });
    if (this instanceof InnerSpaceCompactionTask
        || this instanceof InsertionCrossSpaceCompactionTask) {
      timePartitionSeqFiles =
          filterResourcesByFileTimeIndexInOverlapValidation(
              timePartitionSeqFiles, validTargetFiles);
    }
    List<TsFileResource> overlapFilesInTimePartition =
        RepairDataFileScanUtil.checkTimePartitionHasOverlap(timePartitionSeqFiles, true);
    if (!overlapFilesInTimePartition.isEmpty()) {
      LOGGER.error(
          "Failed to pass compaction overlap validation, source seq files: {}, source unseq files: {}, target files: {}",
          sourceSeqFiles,
          sourceUnseqFiles,
          targetFiles);
      if (!IoTDBDescriptor.getInstance().getConfig().isEnableAutoRepairCompaction()) {
        throw new CompactionValidationFailedException(overlapFilesInTimePartition);
      }
      for (TsFileResource resource : overlapFilesInTimePartition) {
        if (resource.getTsFileRepairStatus() != TsFileRepairStatus.CAN_NOT_REPAIR) {
          resource.setTsFileRepairStatus(TsFileRepairStatus.NEED_TO_CHECK);
        }
      }
    }
  }
This method find the File object of given filePath by searching it in every data directory. If
the file is not found, it will return null.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/compaction/execute/task/AbstractCompactionTask.java