@Test
  public void testCastDateToString() throws HiveException {
    int[] intValues = new int[100];
    VectorizedRowBatch b = TestVectorMathFunctions.getVectorizedRowBatchDateInStringOut(intValues);
    BytesColumnVector resultV = (BytesColumnVector) b.cols[1];
    b.cols[0].noNulls = true;
    VectorExpression expr = new CastDateToString(0, 1);
    expr.evaluate(b);

    SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
    formatter.setCalendar(DateTimeMath.getProlepticGregorianCalendarUTC());

    String expected, result;
    for (int i = 0; i < intValues.length; i++) {
      expected = formatter.format(new java.sql.Date(DateWritableV2.daysToMillis(intValues[i])));
      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 + " Epoch day value: " + intValues[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