@Override
  public Object evaluate(DeferredObject[] arguments) throws HiveException {
    if (arguments[0].get() == null) {
      return null;
    }
    if (inputTextConverter != null) {
      String textVal = (String) inputTextConverter.convert(arguments[0].get());
      if (textVal == null) {
        return null;
      }
      try {
        final long epochSeconds;
        if (patternConverter == null) {
          epochSeconds = formatter.parse(textVal).getEpochSecond();
        } else {
          epochSeconds = formatter.parse(textVal, (String) patternConverter.convert(arguments[1].get())).getEpochSecond();
        }
        retValue.set(epochSeconds);
        return retValue;
      } catch (RuntimeException e) {
        return null;
      }
    } else if (inputDateOI != null) {
      TimestampTZ timestampTZ = TimestampTZUtil.convert(
          inputDateOI.getPrimitiveJavaObject(arguments[0].get()), timeZone);
      retValue.set(timestampTZ.getEpochSecond());
    } else if (inputTimestampOI != null)  {
      TimestampTZ timestampTZ = TimestampTZUtil.convert(
          inputTimestampOI.getPrimitiveJavaObject(arguments[0].get()), timeZone);
      retValue.set(timestampTZ.getEpochSecond());
    } else {
      TimestampTZ timestampTZ =
          inputTimestampLocalTzOI.getPrimitiveJavaObject(arguments[0].get());
      retValue.set(timestampTZ.getEpochSecond());
    }

    return retValue;
  }
deterministic version of UDFUnixTimeStamp. enforces argument
ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFToUnixTimeStamp.java