@Override
    protected Object execute(Object[] data, State state) {
        long time = (long) data[0];
        String durationName = (String) data[1];
        TimePeriod.Duration duration;
        switch (durationName) {
            case "SECONDS":
                duration = TimePeriod.Duration.SECONDS;
                break;
            case "MINUTES":
                duration = TimePeriod.Duration.MINUTES;
                break;
            case "HOURS":
                duration = TimePeriod.Duration.HOURS;
                break;
            case "DAYS":
                duration = TimePeriod.Duration.DAYS;
                break;
            case "MONTHS":
                duration = TimePeriod.Duration.MONTHS;
                break;
            case "YEARS":
                duration = TimePeriod.Duration.YEARS;
                break;
            default:
                // Will not get hit
                throw new SiddhiAppRuntimeException("Duration '" + durationName + "' used for " +
                        "incrementalAggregator:aggregateBaseTime() is invalid.");
        }
        return IncrementalTimeConverterUtil.getStartTimeOfAggregates(time, duration, timeZone);
    }
Executor class for finding the start time and end time of the within clause in incremental processing.
This is important when retrieving incremental aggregate values by specifying a time range with 'within' clause.
modules/siddhi-core/src/main/java/io/siddhi/core/executor/incremental/IncrementalAggregateBaseTimeFunctionExecutor.java