@Override
  public Object evaluate(DeferredObject[] arguments) throws HiveException {
    int dayOfWeekInt;
    if (isDayOfWeekConst) {
      dayOfWeekInt = dayOfWeekIntConst;
    } else {
      String dayOfWeek = getStringValue(arguments, 1, converters);
      dayOfWeekInt = getIntDayOfWeek(dayOfWeek);
    }
    if (dayOfWeekInt == -1) {
      return null;
    }

    Date d = getDateValue(arguments, 0, converters);
    if (d == null) {
      return null;
    }

    nextDay(d, dayOfWeekInt);
    output.set(date.toString());
    return output;
  }
GenericUDFNextDay.

Returns the first date which is later than start_date and named as indicated
ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFNextDay.java