@Override
  public ObjectInspector initialize(ObjectInspector[] arguments) throws UDFArgumentException {
    if (arguments.length != 3) {
      throw new UDFArgumentLengthException(
          "The function TRANSLATE(expr,from_string,to_string) accepts exactly 3 arguments, but "
          + arguments.length + " arguments is found.");
    }

    for (int i = 0; i < 3; i++) {
      if (arguments[i].getTypeName() != serdeConstants.STRING_TYPE_NAME
          && arguments[i].getTypeName() != serdeConstants.VOID_TYPE_NAME) {
        throw new UDFArgumentTypeException(i, "The " + getOrdinal(i + 1)
            + " argument of function TRANSLATE is expected to \""
            + serdeConstants.STRING_TYPE_NAME + "\", but \""
            + arguments[i].getTypeName() + "\" is found");
      }
    }

    argumentOIs = arguments;
    return PrimitiveObjectInspectorFactory.writableStringObjectInspector;
  }
Return a corresponding ordinal from an integer.
itests/util/src/main/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFTestTranslate.java