@Override
  public void run() {
    while (true) {
      WriteOperation op = null;
      int fallbackMs = 8;
      while (true) {
        // The reason we poll here is that a blocking queue causes the query thread to spend
        // non-trivial amount of time signaling when an element is added; we'd rather that the
        // time was wasted on this background thread.
        op = queue.poll();
        if (op != null) break;
        if (fallbackMs > 262144) { // Arbitrary... we don't expect caller to hang out for 7+ mins.
          LlapIoImpl.LOG.error("ORC encoder timed out waiting for input");
          discardData();
          return;
        }
        try {
          Thread.sleep(fallbackMs);
        } catch (InterruptedException e) {
          LlapIoImpl.LOG.error("ORC encoder interrupted waiting for input");
          discardData();
          return;
        }
        fallbackMs <<= 1;
      }
      try {
        if (op.apply(orcWriter, cacheWriter)) {
          LlapIoImpl.LOG.info("ORC encoder received a exit event");
          completion.onComplete(this);
          return;
        }
      } catch (Exception e) {
        LlapIoImpl.LOG.error("ORC encoder failed", e);
        discardData();
        return;
      }
    }
  }
The class that writes rows from a text reader to an ORC writer using VectorDeserializeRow.
llap-server/src/java/org/apache/hadoop/hive/llap/io/encoded/VectorDeserializeOrcWriter.java