public static boolean numberFitsExpression(int number, String expression) {
    if (expression.contains("-")) {// "1-10"
      int min = Integer.parseInt(expression.split("-")[0]);
      int max = Integer.parseInt(expression.split("-")[1]);
      return number <= max && number >= min;
    } else if (expression.contains(",")) { // 1,2,3,4
      List<Integer> numbers = Arrays.asList(expression.split(",")).stream()
          .map(x -> Integer.valueOf(x)).collect(Collectors.toList());
      return numbers.contains(number);
    } else if ("*".equals(expression)) {
      return true;
    } else {
      return Integer.parseInt(expression) == number;
    }
  }
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