@Override
  public void evaluateGroupBatch(VectorizedRowBatch batch)
      throws HiveException {

    // We don't evaluate input columns...

    /*
     * Do careful maintenance of the outputColVector.noNulls flag.
     */
    LongColumnVector longColVector = (LongColumnVector) batch.cols[outputColumnNum];
    longColVector.isRepeating = true;
    longColVector.isNull[0] = false;
    longColVector.vector[0] = rank;
    groupCount += batch.size;
  }
This class evaluates rank() for a PTF group.

Rank starts at 1; the same rank is streamed to the output column as repeated; after the last
group row, the rank is increased by the number of group rows.
ql/src/java/org/apache/hadoop/hive/ql/exec/vector/ptf/VectorPTFEvaluatorRank.java