public abstract class Granularity extends Object implements Cacheable
| Modifier and Type | Class and Description |
|---|---|
static class |
Granularity.Formatter |
| Modifier and Type | Field and Description |
|---|---|
static Comparator<Granularity> |
IS_FINER_THAN |
| Constructor and Description |
|---|
Granularity() |
| Modifier and Type | Method and Description |
|---|---|
org.joda.time.Interval |
bucket(org.joda.time.DateTime t)
Return a granularity-sized Interval containing a particular DateTime.
|
org.joda.time.DateTime |
bucketEnd(org.joda.time.DateTime time) |
abstract org.joda.time.DateTime |
bucketStart(org.joda.time.DateTime time) |
abstract long |
bucketStart(long time) |
static Granularity |
fromString(String str) |
abstract org.joda.time.format.DateTimeFormatter |
getFormatter(Granularity.Formatter type) |
Iterable<org.joda.time.Interval> |
getIterable(org.joda.time.Interval input)
Return an iterable of granular buckets that overlap a particular interval.
|
org.joda.time.DateTimeZone |
getTimeZone() |
static List<Granularity> |
granularitiesFinerThan(Granularity gran0)
Returns a list of standard granularities that are equal to, or finer than, a provided granularity.
|
abstract org.joda.time.DateTime |
increment(org.joda.time.DateTime time) |
abstract long |
increment(long time) |
abstract boolean |
isAligned(org.joda.time.Interval interval)
Return true only if the time chunks populated by this granularity includes the given interval time chunk.
|
static Granularity |
mergeGranularities(List<Granularity> toMerge)
simple merge strategy on query granularity that checks if all are equal or else
returns null.
|
org.joda.time.DateTime |
toDate(String filePath) |
abstract org.joda.time.DateTime |
toDate(String filePath,
Granularity.Formatter formatter) |
org.joda.time.DateTime |
toDateTime(long offset) |
String |
toPath(org.joda.time.DateTime time) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetCacheKeypublic static Comparator<Granularity> IS_FINER_THAN
public static Granularity fromString(String str)
public static Granularity mergeGranularities(List<Granularity> toMerge)
public static List<Granularity> granularitiesFinerThan(Granularity gran0)
public abstract org.joda.time.format.DateTimeFormatter getFormatter(Granularity.Formatter type)
public abstract long increment(long time)
public abstract org.joda.time.DateTime increment(org.joda.time.DateTime time)
public abstract long bucketStart(long time)
public abstract org.joda.time.DateTime bucketStart(org.joda.time.DateTime time)
public abstract org.joda.time.DateTime toDate(String filePath, Granularity.Formatter formatter)
public abstract boolean isAligned(org.joda.time.Interval interval)
public org.joda.time.DateTimeZone getTimeZone()
public org.joda.time.DateTime bucketEnd(org.joda.time.DateTime time)
public org.joda.time.DateTime toDateTime(long offset)
public org.joda.time.DateTime toDate(String filePath)
public final String toPath(org.joda.time.DateTime time)
public final org.joda.time.Interval bucket(org.joda.time.DateTime t)
public Iterable<org.joda.time.Interval> getIterable(org.joda.time.Interval input)
Intervals.ETERNITY and any granularity other than
Granularities.ALL, as well as cases like an input interval of ten years with Granularities.SECOND.
To avoid issues stemming from large numbers of buckets, this method should be avoided, and code that uses
this method should be rewritten to use some other approach. For example: rather than computing all possible
buckets in a wide time range, only process buckets related to actual data points that appear.Copyright © 2011–2023 The Apache Software Foundation. All rights reserved.