private void flushBatch() throws IOException {
    addBatchToWriter();
    if (!isAsync) {
      for (int c = 0; c < sourceBatch.cols.length; ++c) {
        // This resets vectors in both batches.
        ColumnVector colVector = sourceBatch.cols[c];
        if (colVector != null) {
          colVector.reset();
          colVector.init();
        }
      }
      sourceBatch.selectedInUse = false;
      sourceBatch.size = 0;
      sourceBatch.endOfFile = false;
      propagateSourceBatchFieldsToDest();
    } else {
      // In addBatchToWriter, we have passed the batch to both ORC and operator pipeline
      // (neither ever changes the vectors). We'd need a set of vectors batch to write to.
      // TODO: for now, create this from scratch. Ideally we should return the vectors from ops.
      //       We could also have the ORC thread create it for us in its spare time...
      this.sourceBatch = vrbCtx.createVectorizedRowBatch();
      if (usesSourceIncludes) {
        this.destinationBatch = new VectorizedRowBatch(sourceIncludes.size());
        int inclBatchIx = 0;
        for (Integer columnId : sourceIncludes) {
          destinationBatch.cols[inclBatchIx++] = sourceBatch.cols[columnId];
        }
        destinationBatch.setPartitionInfo(sourceIncludes.size(), 0);
      } else {
        this.destinationBatch = sourceBatch;
      }
    }
  }
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