protected void initializeInput(ObjectInspector[] arguments) throws UDFArgumentException {
    if (arguments.length < 1) {
      throw new UDFArgumentLengthException("The function " + getName().toUpperCase() +
          "requires at least one argument");
    }
    for (ObjectInspector argument : arguments) {
      if (argument.getCategory() != Category.PRIMITIVE) {
        throw new UDFArgumentException(getName().toUpperCase() +
            " only takes string/date/timestamp types, got " + argument.getTypeName());
      }
    }

    HiveConf conf = SessionState.get() == null ? new HiveConf() : SessionState.getSessionConf();
    PrimitiveObjectInspector arg1OI = (PrimitiveObjectInspector) arguments[0];
    switch (arg1OI.getPrimitiveCategory()) {
      case CHAR:
      case VARCHAR:
      case STRING:
        inputTextConverter = ObjectInspectorConverters.getConverter(arg1OI,
            PrimitiveObjectInspectorFactory.javaStringObjectInspector);
        if (arguments.length > 1) {
          PrimitiveObjectInspector arg2OI = (PrimitiveObjectInspector) arguments[1];
          if (PrimitiveObjectInspectorUtils.getPrimitiveGrouping(arg2OI.getPrimitiveCategory())
              != PrimitiveGrouping.STRING_GROUP) {
            throw new UDFArgumentException(
              "The time pattern for " + getName().toUpperCase() + " should be string type");
          }
          patternConverter = ObjectInspectorConverters.getConverter(arg2OI,
              PrimitiveObjectInspectorFactory.javaStringObjectInspector);
        }
        if (formatter == null) {
          formatter = InstantFormatter.ofConfiguration(conf);
        }
        break;
      case DATE:
        inputDateOI = (DateObjectInspector) arguments[0];
        break;
      case TIMESTAMP:
        inputTimestampOI = (TimestampObjectInspector) arguments[0];
        break;
      case TIMESTAMPLOCALTZ:
        inputTimestampLocalTzOI = (TimestampLocalTZObjectInspector) arguments[0];
        break;
      default:
        throw new UDFArgumentException("The function " + getName().toUpperCase()
            + " takes only string/date/timestamp/timestampwltz types. Got Type:" + arg1OI
            .getPrimitiveCategory().name());
    }
    if (timeZone == null) {
      timeZone = conf.getLocalTimeZone();
    }
  }
deterministic version of UDFUnixTimeStamp. enforces argument
ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFToUnixTimeStamp.java