@Override
  public boolean next(NullWritable key, V value) throws IOException {
    try {
      // Need a way to know what thread to interrupt, since this is a blocking thread.
      setReaderThread(Thread.currentThread());

      if (hasInput()) {
        value.readFields(din);
        return true;
      } else {
        // End of input. Confirm we got end of stream indicator from server,
        // as well as DONE status from fragment execution.
        if (!cin.isEndOfData()) {
          throw new IOException("Hit end of input, but did not find expected end of data indicator");
        }

        processReaderEvent();
        return false;
      }
    } catch (IOException io) {
      failOnInterruption(io);
      return false;
    }
  }
Base LLAP RecordReader to handle receiving of the data from the LLAP daemon.
llap-client/src/java/org/apache/hadoop/hive/llap/LlapBaseRecordReader.java