private void setCurrentPartition(VectorizedRowBatch batch) {

    final int count = partitionColumnMap.length;
    for (int i = 0; i < count; i++) {
      ColumnVector colVector = batch.cols[partitionColumnMap[i]];

      // Partition columns are repeated -- so we test element 0.

      final boolean isNull = !colVector.noNulls && colVector.isNull[0];
      currentPartitionIsNull[i] = isNull;

      if (isNull) {
        continue;
      }

      switch (partitionColumnVectorTypes[i]) {
      case LONG:
        currentPartitionLongs[i] = ((LongColumnVector) colVector).vector[0];
        break;
      case DOUBLE:
        currentPartitionDoubles[i] = ((DoubleColumnVector) colVector).vector[0];
        break;
      case BYTES:
        {
          BytesColumnVector byteColVector = (BytesColumnVector) colVector;
          byte[] bytes = byteColVector.vector[0];
          final int start = byteColVector.start[0];
          final int length = byteColVector.length[0];
          if (currentPartitionByteArrays[i] == null || currentPartitionByteLengths[i] < length) {
            currentPartitionByteArrays[i] = Arrays.copyOfRange(bytes, start, start + length);
          } else {
            System.arraycopy(bytes, start, currentPartitionByteArrays[i], 0, length);
          }
          currentPartitionByteLengths[i] = length;
        }
        break;
      case DECIMAL:
        if (currentPartitionDecimals[i] == null) {
          currentPartitionDecimals[i] = new HiveDecimalWritable();
        }
        currentPartitionDecimals[i].set(((DecimalColumnVector) colVector).vector[0]);
        break;
      case TIMESTAMP:
        if (currentPartitionTimestamps[i] == null) {
          currentPartitionTimestamps[i] = new Timestamp(0);
        }
        ((TimestampColumnVector) colVector).timestampUpdate(currentPartitionTimestamps[i], 0);
        break;
      case INTERVAL_DAY_TIME:
        if (currentPartitionIntervalDayTimes[i] == null) {
          currentPartitionIntervalDayTimes[i] = new HiveIntervalDayTime();
        }
        ((IntervalDayTimeColumnVector) colVector).intervalDayTimeUpdate(currentPartitionIntervalDayTimes[i], 0);
        break;
      default:
        throw new RuntimeException("Unexpected column vector type " + partitionColumnVectorTypes[i]);
      }
    }
  }
Let's say we have a typical ordering scenario where is 1 order column:
keyInputColumnMap: [0, 1] (-> key cols contain order cols)
orderColumnMap: [1]
The method returns the non-ordering key columns: [0]

This is typically needed when while forwarding batches and want to fill
only partitioning but non-ordering columns from buffered batches to the overflow batch,
as the buffered batches already contain ordering column which is used for range calculation.

Possible scenarios:
1. explicit partitioning and ordering column
select p_mfgr, p_name, p_retailprice, count(*) over(partition by p_mfgr order by p_date)
keyInputColumnMap: [0, 1]
orderColumnMap: [1]

2a. no explicit ordering col
select p_mfgr, p_name, p_retailprice, count(*) over(partition by p_mfgr)
keyInputColumnMap: [0]
orderColumnMap: [0]

2b. no explicit ordering col, another column (keyInput is 0th again)
select p_mfgr, p_name, p_retailprice, count(*) over(partition by p_name)
keyInputColumnMap: [0]
orderColumnMap: [0]

3. no explicit partitioning col (= constant partition expression)
select p_mfgr, p_name, p_retailprice, count(*) over(order by p_date)
keyInputColumnMap: [1]
orderColumnMap: [1]

4. constant present on the partitioning column
select p_mfgr, p_name, p_retailprice, count(*) over(partition by p_mfgr)
from vector_ptf_part_simple_orc where p_mfgr = "Manufacturer#1";
partitionExpressions: [ConstantVectorExpression(val Manufacturer#1) -> 6:string]
orderExpressions: [ConstantVectorExpression(val Manufacturer#1) -> 7:string]
keyInputColumnMap: []
orderColumnMap: [7]
@param keyInputColumnMap
@param orderColumnMap
@return
ql/src/java/org/apache/hadoop/hive/ql/exec/vector/ptf/VectorPTFOperator.java