private TimeRange getRightmostTimeRange() {
    long retStartTime;
    long retEndTime;
    long intervalNum = (long) Math.ceil((endTime - startTime) / (double) slidingStep);
    retStartTime = slidingStep * (intervalNum - 1) + startTime;
    if (isIntervalCyclicChange && endTime - retStartTime > interval % slidingStep) {
      retStartTime += interval % slidingStep;
      updateIntervalAndStep();
    }
    retEndTime = Math.min(retStartTime + curInterval, endTime);
    updateIntervalAndStep();
    return new TimeRange(retStartTime, retEndTime);
  }
This class iteratively generates pre-aggregated time windows.

<p>For example, startTime = 0, endTime = 11, interval = 5, slidingStep = 3, return
[0,2),[2,3),[3,5),[5,6),[6,8),[8,9),[9,10)
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/aggregation/timerangeiterator/PreAggrWindowIterator.java