public static FunctionNode newInstance(Type type, GroupingExpression exp) {
        switch (type) {
        case DATE:
            return newDate(exp);
        case DAY_OF_MONTH:
            return newDayOfMonth(exp);
        case DAY_OF_WEEK:
            return newDayOfWeek(exp);
        case DAY_OF_YEAR:
            return newDayOfYear(exp);
        case HOUR_OF_DAY:
            return newHourOfDay(exp);
        case MINUTE_OF_HOUR:
            return newMinuteOfHour(exp);
        case MONTH_OF_YEAR:
            return newMonthOfYear(exp);
        case SECOND_OF_MINUTE:
            return newSecondOfMinute(exp);
        case YEAR:
            return newYear(exp);
        }
        throw new UnsupportedOperationException("Time function '" + type + "' not supported.");
    }
Creates a new timestamp-function of the specified type for the given {@link GroupingExpression}.

@param type The type of function to create.
@param exp  The expression to evaluate, must evaluate to a long.
@return The created function node.
container-search/src/main/java/com/yahoo/search/grouping/request/TimeFunctions.java