protected void updateHeap(TimeValuePair ret, TimeValuePair topNext) throws IOException {
    long topTime = ret.getTimestamp();
    long topNextTime = (topNext == null ? Long.MAX_VALUE : topNext.getTimestamp());
    while (!heap.isEmpty() && heap.peek().currTime() == topTime) {
      Element e = heap.poll();
      fillNullValue(ret, e.getTimeValuePair());
      if (!e.hasNext()) {
        long size = e.getReader().getUsedMemorySize();
        usedMemorySize -= size;
        if (memoryReservationManager != null) {
          memoryReservationManager.releaseMemoryCumulatively(size);
        }
        e.getReader().close();
        continue;
      }
      e.next();
      if (e.currTime() == topNextTime) {
        // if the next value of the peek will be overwritten by the next of the top, skip it
        fillNullValue(topNext, e.getTimeValuePair());
        if (e.hasNext()) {
          e.next();
          heap.add(e);
        } else {
          long size = e.getReader().getUsedMemorySize();
          usedMemorySize -= size;
          if (memoryReservationManager != null) {
            memoryReservationManager.releaseMemoryCumulatively(size);
          }
          // the chunk is end
          e.close();
        }
      } else {
        heap.add(e);
      }
    }
  }
remove all the TimeValuePair that shares the same timestamp if it's an aligned path we may need
to use those records that share the same timestamp to fill the null sub sensor value in current
TimeValuePair.

@throws IOException while reading next value and close the Element while there is no value,
    there may throw IOException
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/read/reader/common/PriorityMergeReader.java