Class BaseGranularitySpec.LookupIntervalBuckets

java.lang.Object
org.apache.druid.indexer.granularity.BaseGranularitySpec.LookupIntervalBuckets
Enclosing class:
BaseGranularitySpec

protected static class BaseGranularitySpec.LookupIntervalBuckets extends Object
This is a helper class to facilitate sharing the code for sortedBucketIntervals among the various GranularitySpec implementations. In particular, the UniformGranularitySpec needs to avoid materializing the intervals when the need to traverse them arises.
  • Constructor Details

    • LookupIntervalBuckets

      public LookupIntervalBuckets(Iterable<org.joda.time.Interval> intervalIterable)
      Parameters:
      intervalIterable - The intervals to materialize
  • Method Details

    • bucketInterval

      public com.google.common.base.Optional<org.joda.time.Interval> bucketInterval(org.joda.time.DateTime dt)
      Returns a bucket interval using a fast lookup into an efficient data structure where all the intervals have been materialized
      Parameters:
      dt - The date time to lookup
      Returns:
      An Optional containing the interval for the given DateTime if it exists
    • iterator

      public Iterator<org.joda.time.Interval> iterator()
      Returns:
      An iterator to traverse the materialized intervals. The traversal will be done in order as dictated by Comparators.intervalsByStartThenEnd()
    • materializedIntervals

      public TreeSet<org.joda.time.Interval> materializedIntervals()
      Helper method to avoid collecting the intervals from the iterator
      Returns:
      The TreeSet of materialized intervals