code: public synchronized FlatRow getNextMergedRow() throws IOException {
      ResultQueueEntry<FlatRow> queueEntry = getNext();
  
      switch (queueEntry.getType()) {
      case CompletionMarker:
        lastResponseProcessed = true;
        markerCounter.decrementAndGet();
        break;
      case Data:
        if (startTime != null) {
          getFirstResponseTimer().update(System.nanoTime() - startTime, TimeUnit.NANOSECONDS);
          startTime = null;
        }
        return queueEntry.getResponseOrThrow();
      case Exception:
        markerCounter.decrementAndGet();
        return queueEntry.getResponseOrThrow();
      case RequestResultMarker:
        markerCounter.decrementAndGet();
        if (!completionMarkerFound.get()) {
          requestStream.request(1);
        }
        return getNextMergedRow();
      default:
        throw new IllegalStateException("Cannot process type: " + queueEntry.getType());
      }
  
      Preconditions.checkState(lastResponseProcessed,
        "Should only exit merge loop with by returning a complete FlatRow or hitting end of stream.");
      return null;
    }
docs: Get the next complete {@link FlatRow} object from the response queue.
  
  @return null if end-of-stream, otherwise a complete {@link FlatRow}.
  @throws java.io.IOException On errors.