private static String getExpressionAtIndex(ObjectInspector[] parameters, int index) throws UDFArgumentTypeException {
    if (parameters.length > index) {
      if (parameters[index] instanceof WritableConstantStringObjectInspector) {
        return ((WritableConstantStringObjectInspector) parameters[index])
            .getWritableConstantValue().toString();
      } else if (parameters[index] instanceof WritableConstantIntObjectInspector) {
        return ((WritableConstantIntObjectInspector) parameters[index]).getWritableConstantValue()
            .toString();
      } else {
        throw new UDFArgumentTypeException(index, String.format(
            "This argument takes only constant STRING or INT, got %s", parameters[index].getTypeName()));
      }
    } else {
      return "*";
    }
  }
This class implements the UDF which can throw an exception in arbitrary vertex (typically mapper)
/ task / task attempt. For throwing exception in reducer side, where most probably
GroupByOperator codepath applies, GenericUDAFExceptionInVertex is used.
ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFExceptionInVertex.java