Class PeriodGranularity
- java.lang.Object
-
- org.apache.druid.java.util.common.granularity.Granularity
-
- org.apache.druid.java.util.common.granularity.PeriodGranularity
-
- All Implemented Interfaces:
com.fasterxml.jackson.databind.JsonSerializable,Cacheable
public class PeriodGranularity extends Granularity implements com.fasterxml.jackson.databind.JsonSerializable
PeriodGranularity buckets data based on any custom time period
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.druid.java.util.common.granularity.Granularity
Granularity.Formatter
-
-
Field Summary
-
Fields inherited from class org.apache.druid.java.util.common.granularity.Granularity
IS_FINER_THAN
-
-
Constructor Summary
Constructors Constructor Description PeriodGranularity(org.joda.time.Period period, org.joda.time.DateTime origin, org.joda.time.DateTimeZone tz)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description longbucketStart(long time)org.joda.time.DateTimebucketStart(org.joda.time.DateTime time)booleanequals(Object o)byte[]getCacheKey()Get a byte array used as a cache key.org.joda.time.format.DateTimeFormattergetFormatter(Granularity.Formatter type)org.joda.time.DateTimegetOrigin()org.joda.time.PeriodgetPeriod()org.joda.time.DateTimeZonegetTimeZone()inthashCode()longincrement(long t)org.joda.time.DateTimeincrement(org.joda.time.DateTime time)booleanisAligned(org.joda.time.Interval interval)Return true only if the time chunks populated by this granularity includes the given interval time chunk.voidserialize(com.fasterxml.jackson.core.JsonGenerator jsonGenerator, com.fasterxml.jackson.databind.SerializerProvider serializerProvider)voidserializeWithType(com.fasterxml.jackson.core.JsonGenerator jsonGenerator, com.fasterxml.jackson.databind.SerializerProvider serializerProvider, com.fasterxml.jackson.databind.jsontype.TypeSerializer typeSerializer)org.joda.time.DateTimetoDate(String filePath, Granularity.Formatter formatter)org.joda.time.DateTimetoDateTime(long offset)StringtoString()-
Methods inherited from class org.apache.druid.java.util.common.granularity.Granularity
bucket, bucketEnd, fromString, getIterable, granularitiesFinerThan, isFinerThan, mergeGranularities, toDate, toPath
-
-
-
-
Method Detail
-
getPeriod
public org.joda.time.Period getPeriod()
-
getTimeZone
public org.joda.time.DateTimeZone getTimeZone()
- Overrides:
getTimeZonein classGranularity
-
getOrigin
@Nullable public org.joda.time.DateTime getOrigin()
-
getFormatter
public org.joda.time.format.DateTimeFormatter getFormatter(Granularity.Formatter type)
- Specified by:
getFormatterin classGranularity
-
bucketStart
public long bucketStart(long time)
- Specified by:
bucketStartin classGranularity
-
increment
public long increment(long t)
- Specified by:
incrementin classGranularity
-
increment
public org.joda.time.DateTime increment(org.joda.time.DateTime time)
- Specified by:
incrementin classGranularity
-
bucketStart
public org.joda.time.DateTime bucketStart(org.joda.time.DateTime time)
- Specified by:
bucketStartin classGranularity
-
toDate
public org.joda.time.DateTime toDate(String filePath, Granularity.Formatter formatter)
- Specified by:
toDatein classGranularity
-
isAligned
public boolean isAligned(org.joda.time.Interval interval)
Description copied from class:GranularityReturn true only if the time chunks populated by this granularity includes the given interval time chunk. The interval must fit exactly into the scheme of the granularity for this to return true- Specified by:
isAlignedin classGranularity
-
getCacheKey
public byte[] getCacheKey()
Description copied from interface:CacheableGet a byte array used as a cache key.- Specified by:
getCacheKeyin interfaceCacheable- Returns:
- a cache key
-
toDateTime
public org.joda.time.DateTime toDateTime(long offset)
- Overrides:
toDateTimein classGranularity
-
serialize
public void serialize(com.fasterxml.jackson.core.JsonGenerator jsonGenerator, com.fasterxml.jackson.databind.SerializerProvider serializerProvider) throws IOException- Specified by:
serializein interfacecom.fasterxml.jackson.databind.JsonSerializable- Throws:
IOException
-
serializeWithType
public void serializeWithType(com.fasterxml.jackson.core.JsonGenerator jsonGenerator, com.fasterxml.jackson.databind.SerializerProvider serializerProvider, com.fasterxml.jackson.databind.jsontype.TypeSerializer typeSerializer) throws IOException- Specified by:
serializeWithTypein interfacecom.fasterxml.jackson.databind.JsonSerializable- Throws:
IOException
-
-