@SuppressWarnings("unchecked")
  public <K,V> RecordWriter<K, V> getWriter(String id) throws IOException, InterruptedException {
    RecordWriter<?, ?> writer = null;
    synchronized (lock) {
      long startTime = System.nanoTime();
      boolean isFirst = true;
      while ((writer = writers.get(id)) == null) {
        String error = errors.remove(id);
        if (error != null) {
          throw new IOException(error);
        }
        if (isFirst) {
          LOG.info("Waiting for writer for " + id);
          isFirst = false;
        }
        if (((System.nanoTime() - startTime) / 1000000) > writerTimeoutMs) {
          throw new IOException("The writer for " + id + " has timed out after "
              + writerTimeoutMs + "ms");
        }
        lock.wait(writerTimeoutMs);
      }
    }
    LOG.info("Returning writer for: "+id);
    return (RecordWriter<K, V>) writer;
  }
Responsible for sending back result set data to the connections
made by external clients via the LLAP input format.
ql/src/java/org/apache/hadoop/hive/llap/LlapOutputFormatService.java