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 long
bucketStart(long time)
org.joda.time.DateTime
bucketStart(org.joda.time.DateTime time)
boolean
equals(Object o)
byte[]
getCacheKey()
Get a byte array used as a cache key.org.joda.time.format.DateTimeFormatter
getFormatter(Granularity.Formatter type)
org.joda.time.DateTime
getOrigin()
org.joda.time.Period
getPeriod()
org.joda.time.DateTimeZone
getTimeZone()
int
hashCode()
long
increment(long t)
org.joda.time.DateTime
increment(org.joda.time.DateTime time)
boolean
isAligned(org.joda.time.Interval interval)
Return true only if the time chunks populated by this granularity includes the given interval time chunk.void
serialize(com.fasterxml.jackson.core.JsonGenerator jsonGenerator, com.fasterxml.jackson.databind.SerializerProvider serializerProvider)
void
serializeWithType(com.fasterxml.jackson.core.JsonGenerator jsonGenerator, com.fasterxml.jackson.databind.SerializerProvider serializerProvider, com.fasterxml.jackson.databind.jsontype.TypeSerializer typeSerializer)
org.joda.time.DateTime
toDate(String filePath, Granularity.Formatter formatter)
org.joda.time.DateTime
toDateTime(long offset)
String
toString()
-
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:
getTimeZone
in classGranularity
-
getOrigin
@Nullable public org.joda.time.DateTime getOrigin()
-
getFormatter
public org.joda.time.format.DateTimeFormatter getFormatter(Granularity.Formatter type)
- Specified by:
getFormatter
in classGranularity
-
bucketStart
public long bucketStart(long time)
- Specified by:
bucketStart
in classGranularity
-
increment
public long increment(long t)
- Specified by:
increment
in classGranularity
-
increment
public org.joda.time.DateTime increment(org.joda.time.DateTime time)
- Specified by:
increment
in classGranularity
-
bucketStart
public org.joda.time.DateTime bucketStart(org.joda.time.DateTime time)
- Specified by:
bucketStart
in classGranularity
-
toDate
public org.joda.time.DateTime toDate(String filePath, Granularity.Formatter formatter)
- Specified by:
toDate
in classGranularity
-
isAligned
public boolean isAligned(org.joda.time.Interval interval)
Description copied from class:Granularity
Return 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:
isAligned
in classGranularity
-
getCacheKey
public byte[] getCacheKey()
Description copied from interface:Cacheable
Get a byte array used as a cache key.- Specified by:
getCacheKey
in interfaceCacheable
- Returns:
- a cache key
-
toDateTime
public org.joda.time.DateTime toDateTime(long offset)
- Overrides:
toDateTime
in classGranularity
-
serialize
public void serialize(com.fasterxml.jackson.core.JsonGenerator jsonGenerator, com.fasterxml.jackson.databind.SerializerProvider serializerProvider) throws IOException
- Specified by:
serialize
in 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:
serializeWithType
in interfacecom.fasterxml.jackson.databind.JsonSerializable
- Throws:
IOException
-
-