public RowPositionInBatch getPosition(int i) throws HiveException {
    if (positionCache[i] != null) {
      RowPositionInBatch p = positionCache[i];
      // the caller of getPosition(i) assumes that VectorPTFGroupBatches stands on the actual row
      // (it's loaded into memory), so let's fulfill that requirement
      if (canJump()){
        jumpToBlock(p.block.blockIndex);
      }
      return positionCache[i];
    }

    // there is no blocks at all, all batches are in memory
    if (blocks.isEmpty()){
      return toPositionCache(i, getRowPositionFromBufferedBatches(i));
    }
    VectorSpillBlock lastBlock = blocks.getLast();

    /* this could happen when caller is interested in a row beyond the range's end, let's return the last row
     * E.g if the last block is:
     * [VectorSpillBlock: startBatchIndex: 6, startRowIndex: [10, 11],
     *  spilled: true, spillBatchCount: 2, spillRowCount: 2]]
     * This will return: RowPositionInBatch: row: 12, blockIndex: 3, batchIndex: 1, rowIndexInBatch: 0
     */
    if (i > lastBlock.getLastRowIndex()) {
      return toPositionCache(i,
          new RowPositionInBatch(lastBlock, /* batchIndex */ lastBlock.startRowIndex.length - 1,
              /* rowIndexInBatch */ (int) (lastBlock.startRowIndex[0] + lastBlock.spillRowCount - 1
                  - lastBlock.startRowIndex[lastBlock.spillBatchCount - 1])));
    }

    int blockIndex = 0;
    while (i >= blocks.get(blockIndex).startRowIndex[0] + blocks.get(blockIndex).spillRowCount) {
      blockIndex += 1;
    }

    VectorSpillBlock block = blocks.getCurrentBlock();
    if (blockIndex != block.blockIndex) {
      spillAndResetCurrentBufferedBatches(); // spill if needed
      block = jumpToBlock(blockIndex);
    }

    int batchIndex = findInMemoryBatchIndex(i);
    return toPositionCache(i,
        new RowPositionInBatch(block, batchIndex, i - block.startRowIndex[batchIndex]));
  }
Returns the value at row/col. Row index is absolute inside a PTF partition, col should point to
the remapped column index according to bufferedColumnMap. The input expressions of the
evaluators are already aware of this remapped column as they are changed in
VectorPTFOperator.initBufferedColumns.
@param row
@param col
@return
@throws HiveException
ql/src/java/org/apache/hadoop/hive/ql/exec/vector/ptf/VectorPTFGroupBatches.java