Class BaseGranularitySpec.LookupIntervalBuckets
- java.lang.Object
-
- org.apache.druid.segment.indexing.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 Summary
Constructors Constructor Description LookupIntervalBuckets(Iterable<org.joda.time.Interval> intervalIterable)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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 materializedIterator<org.joda.time.Interval>iterator()TreeSet<org.joda.time.Interval>materializedIntervals()Helper method to avoid collecting the intervals from the iterator
-
-
-
Constructor Detail
-
LookupIntervalBuckets
public LookupIntervalBuckets(Iterable<org.joda.time.Interval> intervalIterable)
- Parameters:
intervalIterable- The intervals to materialize
-
-
Method Detail
-
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
-
-