@Test
  public void testCastTimestampToLong() throws HiveException {
    long[] longValues = new long[500];
    VectorizedRowBatch b = TestVectorMathFunctions.getVectorizedRowBatchTimestampInLongOut(longValues);
    TimestampColumnVector inV = (TimestampColumnVector) b.cols[0];
    LongColumnVector resultV = (LongColumnVector) b.cols[1];
    b.cols[0].noNulls = true;
    VectorExpression expr = new CastTimestampToLong(0, 1);
    expr.setOutputTypeInfo(TypeInfoFactory.longTypeInfo);
    expr.setOutputDataTypePhysicalVariation(DataTypePhysicalVariation.NONE);
    expr.transientInit(hiveConf);
    expr.evaluate(b);
    for (int i = 0; i < longValues.length; i++) {
      long actual = resultV.vector[i];
      long timestampLong = inV.getTimestampAsLong(i);
      if (actual != timestampLong) {
        assertTrue(false);
      }
    }
  }
Test VectorExpression classes for vectorized implementations of type casts.
ql/src/test/org/apache/hadoop/hive/ql/exec/vector/expressions/TestVectorTypeCasts.java