private Class<?> getCastFormatVectorExpressionClass(List<ExprNodeDesc> childExpr,
      TypeInfo returnType, String inputType) throws HiveException {
    switch (inputType) {
    case serdeConstants.TIMESTAMP_TYPE_NAME:
      if (returnType.getTypeName().equals(serdeConstants.STRING_TYPE_NAME)) {
        return CastTimestampToStringWithFormat.class;
      }
      if (returnType.getTypeName().startsWith(serdeConstants.VARCHAR_TYPE_NAME)) {
        return CastTimestampToVarCharWithFormat.class;
      }
      if (returnType.getTypeName().startsWith(serdeConstants.CHAR_TYPE_NAME)) {
        return CastTimestampToCharWithFormat.class;
      }
    case serdeConstants.DATE_TYPE_NAME:
      if (returnType.getTypeName().equals(serdeConstants.STRING_TYPE_NAME)) {
        return CastDateToStringWithFormat.class;
      }
      if (returnType.getTypeName().startsWith(serdeConstants.VARCHAR_TYPE_NAME)) {
        return CastDateToVarCharWithFormat.class;
      }
      if (returnType.getTypeName().startsWith(serdeConstants.CHAR_TYPE_NAME)) {
        return CastDateToCharWithFormat.class;
      }
    default: //keep going
    }
    if (inputType.equals(serdeConstants.STRING_TYPE_NAME)
        || inputType.startsWith(serdeConstants.CHAR_TYPE_NAME)
        || inputType.startsWith(serdeConstants.VARCHAR_TYPE_NAME)) {
      switch (returnType.getTypeName()) {
      case serdeConstants.TIMESTAMP_TYPE_NAME:
        return CastStringToTimestampWithFormat.class;
      case serdeConstants.DATE_TYPE_NAME:
        return CastStringToDateWithFormat.class;
      default: //keep going
      }
    }
    throw new HiveException(
        "Expression cast " + inputType + " to " + returnType + " format not" + " vectorizable");
  }
Invoke special handling for expressions that can't be vectorized by regular
descriptor based lookup.
ql/src/java/org/apache/hadoop/hive/ql/exec/vector/VectorizationContext.java