public void addReader(IPointReader reader, MergeReaderPriority priority, long endTime)
      throws IOException {
    if (reader.hasNextTimeValuePair()) {
      Element element = new Element(reader, reader.nextTimeValuePair(), priority);
      heap.add(element);
      updateCurrentReadStopTime(endTime);
      long size = element.getReader().getUsedMemorySize();
      usedMemorySize += size;
      if (memoryReservationManager != null) {
        memoryReservationManager.reserveMemoryCumulatively(size);
      }
    } else {
      reader.close();
    }
  }
This class implements {@link IPointReader} for data sources with different priorities.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/read/reader/common/PriorityMergeReader.java