@Test
  public void testCompareByTimePartitionWithCrossSpaceCompaction() throws InterruptedException {
    List<TsFileResource> seqResources = new ArrayList<>();
    List<TsFileResource> unseqResources = new ArrayList<>();
    for (int i = 0; i < 10; i++) {
      seqResources.add(
          new FakedTsFileResource(new File(String.format("%d-%d-0-0.tsfile", i, i)), 10));
    }
    for (int i = 10; i < 20; i++) {
      unseqResources.add(
          new FakedTsFileResource(new File(String.format("%d-%d-0-0.tsfile", i, i)), 10));
    }
    FixedPriorityBlockingQueue<AbstractCompactionTask> candidateCompactionTaskQueue =
        new FixedPriorityBlockingQueue<>(
            IoTDBDescriptor.getInstance().getConfig().getCandidateCompactionTaskQueueSize(),
            new DefaultCompactionTaskComparatorImpl());
    for (int i = 0; i < 10; i++) {
      CrossSpaceCompactionTask task =
          new CrossSpaceCompactionTask(
              i,
              tsFileManager,
              seqResources,
              unseqResources,
              new FastCompactionPerformer(true),
              0,
              0);
      candidateCompactionTaskQueue.put(task);
    }

    for (int i = 9; i >= 0; i--) {
      Assert.assertEquals(candidateCompactionTaskQueue.take().getTimePartition(), i);
    }
  }
Test the comparation of cross space compaction task
iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/compaction/CompactionTaskComparatorTest.java