private List<IMeasurementSchema> collectSchemaFromAlignedChunkMetadataList(
      LinkedList<Pair<TsFileSequenceReader, List<AlignedChunkMetadata>>> readerAndChunkMetadataList)
      throws IOException {
    Set<MeasurementSchema> schemaSet = new HashSet<>();
    Set<String> measurementSet = new HashSet<>();
    for (Pair<TsFileSequenceReader, List<AlignedChunkMetadata>> readerListPair :
        readerAndChunkMetadataList) {
      TsFileSequenceReader reader = readerListPair.left;
      if (reader instanceof CompactionTsFileReader) {
        ((CompactionTsFileReader) reader).markStartOfAlignedSeries();
      }
      List<AlignedChunkMetadata> alignedChunkMetadataList = readerListPair.right;
      collectSchemaFromOneFile(alignedChunkMetadataList, reader, schemaSet, measurementSet);
      if (reader instanceof CompactionTsFileReader) {
        ((CompactionTsFileReader) reader).markEndOfAlignedSeries();
      }
    }
    List<IMeasurementSchema> collectedSchemaList = new ArrayList<>(schemaSet);
    collectedSchemaList.sort(Comparator.comparing(IMeasurementSchema::getMeasurementName));
    return collectedSchemaList;
  }
collect the measurement metadata from list of alignedChunkMetadata list, and sort them in
dictionary order.

@param readerAndChunkMetadataList list of reader and alignedChunkMetadata list
@return schema list sorted by dictionary order
@throws IOException if io errors occurred
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/compaction/execute/utils/executor/readchunk/AlignedSeriesCompactionExecutor.java