@Override
  public boolean hasNextTimeRange() {
    if (hasCachedTimeRange) {
      return true;
    }
    if (curTimeRange == null) {
      curTimeRange = getFirstTimeRange();
      hasCachedTimeRange = true;
      return true;
    }

    long retStartTime;
    long retEndTime;
    long curStartTime = curTimeRange.getMin();
    if (isAscending) {
      retStartTime = curStartTime + curSlidingStep;
      // This is an open interval , [0-100)
      if (retStartTime >= endTime) {
        return false;
      }
    } else {
      retStartTime = curStartTime - curSlidingStep;
      if (retStartTime < startTime) {
        return false;
      }
    }
    retEndTime = Math.min(retStartTime + curInterval, endTime);
    updateIntervalAndStep();
    curTimeRange = new TimeRange(retStartTime, retEndTime);
    hasCachedTimeRange = true;
    return true;
  }
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