@Test
  public void testCastTimestampToString() throws HiveException {
    int numberToTest = 100;
    long[] epochSecondValues = new long[numberToTest];
    int[] nanoValues = new int[numberToTest];
    VectorizedRowBatch b =
        TestVectorMathFunctions.getVectorizedRowBatchTimestampInStringOut(epochSecondValues, nanoValues);
    BytesColumnVector resultV = (BytesColumnVector) b.cols[1];
    b.cols[0].noNulls = true;
    VectorExpression expr = new CastTimestampToString(0, 1);
    expr.evaluate(b);

    String expected, result;
    for (int i = 0; i < numberToTest; i++) {
      expected = org.apache.hadoop.hive.common.type.Timestamp
          .ofEpochSecond(epochSecondValues[i], nanoValues[i]).toString();
      byte[] subbyte = Arrays.copyOfRange(resultV.vector[i], resultV.start[i],
          resultV.start[i] + resultV.length[i]);
      result = new String(subbyte, StandardCharsets.UTF_8);
      Assert.assertEquals("Index: " +  i + " Seconds since epoch: " + epochSecondValues[i] +
              " nanoseconds: " + nanoValues[i],
          expected, result);
    }
  }
Test VectorExpression classes for vectorized implementations of type casts.
ql/src/test/org/apache/hadoop/hive/ql/exec/vector/expressions/TestVectorTypeCasts.java