@Test
  public void testCastTimestampToStringWithFormat() throws HiveException {
    VectorizedRowBatch b =
        TestVectorMathFunctions.getVectorizedRowBatchTimestampInStringOutFormatted();
    BytesColumnVector resultV = (BytesColumnVector) b.cols[1];
    VectorExpression expr = new CastTimestampToStringWithFormat(0, "yyyy".getBytes(), 1);
    expr.evaluate(b);

    Assert.assertEquals("2019", getStringFromBytesColumnVector(resultV, 0));
    Assert.assertEquals("1776", getStringFromBytesColumnVector(resultV, 1));
    Assert.assertEquals("2012", getStringFromBytesColumnVector(resultV, 2));
    Assert.assertEquals("1580", getStringFromBytesColumnVector(resultV, 3));
    Assert.assertEquals("0005", getStringFromBytesColumnVector(resultV, 4));
    Assert.assertEquals("9999", getStringFromBytesColumnVector(resultV, 5));

    resultV = new BytesColumnVector();
    b.cols[1] = resultV;
    expr = new CastTimestampToStringWithFormat(0, "HH24".getBytes(), 1);
    expr.evaluate(b);

    Assert.assertEquals("19", getStringFromBytesColumnVector(resultV, 0));
    Assert.assertEquals("17", getStringFromBytesColumnVector(resultV, 1));
    Assert.assertEquals("23", getStringFromBytesColumnVector(resultV, 2));
    Assert.assertEquals("00", getStringFromBytesColumnVector(resultV, 3));
    Assert.assertEquals("00", getStringFromBytesColumnVector(resultV, 4));
    Assert.assertEquals("23", getStringFromBytesColumnVector(resultV, 5));
  }
Tests vectorized type cast udfs CastDateToStringWithFormat, CastTimestampToStringWithFormat,
CastStringToDateWithFormat, CastStringToTimestampWithFormat.
ql/src/test/org/apache/hadoop/hive/ql/exec/vector/expressions/TestVectorTypeCastsWithFormat.java