@Test
  public void testMergeChunkWithDifferentCompression() throws Exception {
    long testTargetChunkPointNum = 1000L;
    long originTargetChunkSize = IoTDBDescriptor.getInstance().getConfig().getTargetChunkSize();
    long originTargetChunkPointNum =
        IoTDBDescriptor.getInstance().getConfig().getTargetChunkPointNum();
    IoTDBDescriptor.getInstance().getConfig().setTargetChunkSize(10240);
    IoTDBDescriptor.getInstance().getConfig().setTargetChunkPointNum(testTargetChunkPointNum);
    long originChunkSizeLowerBound =
        IoTDBDescriptor.getInstance().getConfig().getChunkSizeLowerBoundInCompaction();
    IoTDBDescriptor.getInstance().getConfig().setChunkSizeLowerBoundInCompaction(1);
    long originChunkPointNumLowerBound =
        IoTDBDescriptor.getInstance().getConfig().getChunkPointNumLowerBoundInCompaction();
    IoTDBDescriptor.getInstance().getConfig().setChunkPointNumLowerBoundInCompaction(1);
    try {
      List<TsFileResource> sourceFiles = new ArrayList();
      Set<String> fullPathSetWithDeleted = new HashSet<>(fullPathSet);
      // we add a deleted timeseries to simulate timeseries is deleted before compaction.
      String deletedPath = "root.compactionTest.device999.s999";
      fullPathSetWithDeleted.add(deletedPath);
      int fileNum = 6;
      long pointStep = 300L;
      for (int i = 0; i < fileNum; ++i) {
        List<List<Long>> chunkPagePointsNum = new ArrayList<>();
        List<Long> pagePointsNum = new ArrayList<>();
        pagePointsNum.add((i + 1L) * pointStep);
        chunkPagePointsNum.add(pagePointsNum);
        TsFileResource resource =
            new TsFileResource(new File(SEQ_DIRS, String.format("%d-%d-0-0.tsfile", i + 1, i + 1)));
        sourceFiles.add(resource);
        CompactionFileGeneratorUtils.writeTsFile(
            fullPathSetWithDeleted,
            chunkPagePointsNum,
            i * 2000L,
            resource,
            TSEncoding.PLAIN,
            i % 2 == 0 ? CompressionType.SNAPPY : CompressionType.GZIP);
        Map<String, Pair<Long, Long>> deletionMap = new HashMap<>();
        deletionMap.put(deletedPath, new Pair<>(i * 2000L, (i + 1) * 2000L));
        CompactionFileGeneratorUtils.generateMods(deletionMap, resource, false);
      }
      Map<IFullPath, List<TimeValuePair>> originData =
          CompactionCheckerUtils.getDataByQuery(paths, sourceFiles, new ArrayList<>());
      TsFileResource targetResource =
          TsFileNameGenerator.getInnerCompactionTargetFileResource(sourceFiles, true);
      performer.setSourceFiles(sourceFiles);
      performer.setTargetFiles(Collections.singletonList(targetResource));
      performer.setSummary(new CompactionTaskSummary());
      performer.perform();

      Map<String, List<List<Long>>> chunkPagePointsNumMerged = new HashMap<>();
      // outer list is a chunk, inner list is point num in each page
      List<List<Long>> chunkPointsArray = new ArrayList<>();
      List<Long> pointsArray = new ArrayList<>();
      long curPointNum = 0L;
      for (int i = 0; i < fileNum; ++i) {
        curPointNum += (i + 1L) * pointStep;
        pointsArray.add((i + 1L) * pointStep);
        if (curPointNum > testTargetChunkPointNum) {
          chunkPointsArray.add(pointsArray);
          pointsArray = new ArrayList<>();
          curPointNum = 0;
        }
      }
      if (curPointNum > 0) {
        chunkPointsArray.add(pointsArray);
      }
      for (String path : fullPathSetWithDeleted) {
        chunkPagePointsNumMerged.put(path, chunkPointsArray);
      }
      chunkPagePointsNumMerged.put(deletedPath, null);
      CompactionUtils.moveTargetFile(
          Collections.singletonList(targetResource),
          CompactionTaskType.INNER_SEQ,
          "root.compactionTest");
      Map<IFullPath, List<TimeValuePair>> compactedData =
          CompactionCheckerUtils.getDataByQuery(
              paths, Collections.singletonList(targetResource), new ArrayList<>());
      CompactionCheckerUtils.validDataByValueList(originData, compactedData);
    } finally {
      IoTDBDescriptor.getInstance().getConfig().setTargetChunkSize(originTargetChunkSize);
      IoTDBDescriptor.getInstance().getConfig().setTargetChunkPointNum(originTargetChunkPointNum);
      IoTDBDescriptor.getInstance()
          .getConfig()
          .setChunkSizeLowerBoundInCompaction(originChunkSizeLowerBound);
      IoTDBDescriptor.getInstance()
          .getConfig()
          .setChunkPointNumLowerBoundInCompaction(originChunkPointNumLowerBound);
    }
  }
Generate some chunks are less than the target size and greater than the lower bound, and some
chunks that are less than the lower bound. So the chunk will be merged first, and the cached
chunk will be deserialized into points later.

@throws Exception
iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/compaction/inner/ReadChunkCompactionPerformerNoAlignedTest.java