Class IntervalsByGranularity

java.lang.Object
org.apache.druid.java.util.common.granularity.IntervalsByGranularity

public class IntervalsByGranularity extends Object
Produce a stream of intervals generated by a given set of intervals as input and a given granularity. This class avoids materializing the granularity intervals whenever possible.
  • Constructor Details

    • IntervalsByGranularity

      public IntervalsByGranularity(Collection<org.joda.time.Interval> intervals, Granularity granularity)
      Parameters:
      intervals - Intervals for which to apply the given granularity. They should not contain overlapped intervals.
      granularity - The granularity to apply
      Throws:
      IAE - if intervals contains at least an overlapping pair
  • Method Details

    • granularityIntervalsIterator

      public Iterator<org.joda.time.Interval> granularityIntervalsIterator()
      Returns:
      The intervals according to the granularity. The intervals are provided in order according to Comparators.intervalsByStartThenEnd()