@Override
  public ObjectInspector initialize(ObjectInspector[] arguments)
      throws UDFArgumentException {
    if (arguments.length != 1) {
      throw new UDFArgumentLengthException(
          "The function evaluate_npe(string)"
            + "needs only one argument.");
    }

    if (!arguments[0].getTypeName().equals(serdeConstants.STRING_TYPE_NAME)) {
      throw new UDFArgumentTypeException(0,
        "Argument 1 of function evaluate_npe must be \""
        + serdeConstants.STRING_TYPE_NAME + "but \""
        + arguments[0].getTypeName() + "\" was found.");
    }

    argumentOIs = arguments;
    return PrimitiveObjectInspectorFactory.writableStringObjectInspector;
  }
GenericUDFEvaluateNPE
This UDF is to throw an Null Pointer Exception
It is used to test hive failure handling
itests/util/src/main/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFEvaluateNPE.java