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

    if (childExpressions != null) {
      super.evaluateChildren(batch);
    }

    LongColumnVector outV = (LongColumnVector) batch.cols[outputColumnNum];
    BytesColumnVector inputCol = (BytesColumnVector)batch.cols[this.inputColumnNum[0]];

    final int n = inputCol.isRepeating ? 1 : batch.size;
    int[] sel = batch.selected;
    final boolean selectedInUse = (inputCol.isRepeating == false) && batch.selectedInUse;

    if (batch.size == 0) {

      // n != batch.size when isRepeating
      return;
    }

    // We do not need to do a column reset since we are carefully changing the output.
    outV.isRepeating = false;

    if (inputCol.isRepeating) {
      if (inputCol.noNulls || !inputCol.isNull[0]) {
        try {
          outV.isNull[0] = false;
          outV.vector[0] = getField(inputCol.vector[0], inputCol.start[0], inputCol.length[0]);
        } catch (ParseException e) {
          outV.noNulls = false;
          outV.isNull[0] = true;
        }
      } else {
        outV.isNull[0] = true;
        outV.noNulls = false;
      }
      outV.isRepeating = true;
      return;
    }

    if (inputCol.noNulls) {
      if (selectedInUse) {
        for (int j = 0; j < n; j++) {
          int i = sel[j];
          try {
            outV.vector[i] = getField(inputCol.vector[i], inputCol.start[i], inputCol.length[i]);
            outV.isNull[i] = false;
          } catch (ParseException e) {
            outV.noNulls = false;
            outV.isNull[i] = true;
          }
        }
      } else {
        for (int i = 0; i < n; i++) {
          try {
            outV.vector[i] = getField(inputCol.vector[i], inputCol.start[i], inputCol.length[i]);
            outV.isNull[i] = false;
          } catch (ParseException e) {
            outV.noNulls = false;
            outV.isNull[i] = true;
          }
        }
      }
    } else /* there are nulls in the inputColVector */ {

      // Carefully handle NULLs...
      outV.noNulls = false;

      if (selectedInUse) {
        for (int j = 0; j < n; j++) {
          int i = sel[j];
          outV.isNull[i] = inputCol.isNull[i];
          if (!inputCol.isNull[i]) {
            try {
              outV.vector[i] = getField(inputCol.vector[i], inputCol.start[i], inputCol.length[i]);
            } catch (ParseException e) {
              outV.isNull[i] = true;
            }
          }
        }
      } else {
        for (int i = 0; i < n; i++) {
          outV.isNull[i] = inputCol.isNull[i];
          if (!inputCol.isNull[i]) {
            try {
              outV.vector[i] = getField(inputCol.vector[i], inputCol.start[i], inputCol.length[i]);
            } catch (ParseException e) {
              outV.isNull[i] = true;
            }
          }
        }
      }
    }
  }
Abstract class to return various fields from a String.
ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/VectorUDFTimestampFieldString.java