@Override
  public TimeValuePair nextTimeValuePair() throws IOException {
    Element top = heap.poll();
    TimeValuePair ret = top.getTimeValuePair();
    TimeValuePair topNext = null;
    if (top.hasNext()) {
      top.next();
      topNext = top.currPair();
    }
    updateHeap(ret, topNext);
    if (topNext != null) {
      top.setTimeValuePair(topNext);
      heap.add(top);
    } else {
      long size = top.getReader().getUsedMemorySize();
      usedMemorySize -= size;
      if (memoryReservationManager != null) {
        memoryReservationManager.releaseMemoryCumulatively(size);
      }
    }
    return ret;
  }
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