Package org.apache.pinot.spi.data
Class DateTimeFieldSpec
- java.lang.Object
-
- org.apache.pinot.spi.data.FieldSpec
-
- org.apache.pinot.spi.data.DateTimeFieldSpec
-
- All Implemented Interfaces:
Serializable,Comparable<FieldSpec>
public final class DateTimeFieldSpec extends FieldSpec
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classDateTimeFieldSpec.TimeFormat-
Nested classes/interfaces inherited from class org.apache.pinot.spi.data.FieldSpec
FieldSpec.DataType, FieldSpec.FieldType
-
-
Field Summary
-
Fields inherited from class org.apache.pinot.spi.data.FieldSpec
_dataType, _defaultNullValue, _isSingleValueField, _name, _transformFunction, _virtualColumnProvider, DEFAULT_DIMENSION_NULL_VALUE_OF_BIG_DECIMAL, DEFAULT_DIMENSION_NULL_VALUE_OF_BOOLEAN, DEFAULT_DIMENSION_NULL_VALUE_OF_BYTES, DEFAULT_DIMENSION_NULL_VALUE_OF_DOUBLE, DEFAULT_DIMENSION_NULL_VALUE_OF_FLOAT, DEFAULT_DIMENSION_NULL_VALUE_OF_INT, DEFAULT_DIMENSION_NULL_VALUE_OF_JSON, DEFAULT_DIMENSION_NULL_VALUE_OF_LONG, DEFAULT_DIMENSION_NULL_VALUE_OF_STRING, DEFAULT_DIMENSION_NULL_VALUE_OF_TIMESTAMP, DEFAULT_MAX_LENGTH, DEFAULT_METRIC_NULL_VALUE_OF_BIG_DECIMAL, DEFAULT_METRIC_NULL_VALUE_OF_BYTES, DEFAULT_METRIC_NULL_VALUE_OF_DOUBLE, DEFAULT_METRIC_NULL_VALUE_OF_FLOAT, DEFAULT_METRIC_NULL_VALUE_OF_INT, DEFAULT_METRIC_NULL_VALUE_OF_LONG, DEFAULT_METRIC_NULL_VALUE_OF_STRING
-
-
Constructor Summary
Constructors Constructor Description DateTimeFieldSpec()DateTimeFieldSpec(String name, FieldSpec.DataType dataType, String format, String granularity)DateTimeFieldSpec(String name, FieldSpec.DataType dataType, String format, String granularity, Object sampleValue)Constructs a DateTimeFieldSpec with basic fields name, dataType, format and granularityDateTimeFieldSpec(String name, FieldSpec.DataType dataType, String format, String granularity, Object defaultNullValue, String transformFunction)Constructs a DateTimeFieldSpec with basic fields - name, dataType, format, granularity - and also with defaultNullValue and transformFunctionDateTimeFieldSpec(String name, FieldSpec.DataType dataType, String format, String granularity, Object defaultNullValue, String transformFunction, String sampleValue)Constructs a DateTimeFieldSpec with basic fields - name, dataType, format, granularity - and also with defaultNullValue and transformFunction
-
Method Summary
Modifier and Type Method Description booleanequals(Object o)FieldSpec.FieldTypegetFieldType()StringgetFormat()DateTimeFormatSpecgetFormatSpec()StringgetGranularity()DateTimeGranularitySpecgetGranularitySpec()ObjectgetSampleValue()inthashCode()voidsetFormat(String format)voidsetGranularity(String granularity)voidsetSampleValue(String sampleValue)voidsetSingleValueField(boolean isSingleValueField)com.fasterxml.jackson.databind.node.ObjectNodetoJsonObject()Returns theObjectNoderepresenting the field spec.StringtoString()-
Methods inherited from class org.apache.pinot.spi.data.FieldSpec
appendDefaultNullValue, appendTransformFunction, compareTo, getDataType, getDefaultNullValue, getDefaultNullValue, getDefaultNullValueString, getMaxLength, getName, getStringValue, getTransformFunction, getVirtualColumnProvider, isBackwardCompatibleWith, isSingleValueField, isVirtualColumn, setDataType, setDefaultNullValue, setMaxLength, setName, setTransformFunction, setVirtualColumnProvider
-
-
-
-
Constructor Detail
-
DateTimeFieldSpec
public DateTimeFieldSpec()
-
DateTimeFieldSpec
public DateTimeFieldSpec(String name, FieldSpec.DataType dataType, String format, String granularity, @Nullable Object sampleValue)
Constructs a DateTimeFieldSpec with basic fields name, dataType, format and granularity- Parameters:
format- - defines how to interpret the numeric value in the date time column. Format has to follow the pattern - size:timeunit:timeformat, where size and timeUnit together define the granularity of the time column value. Size is the integer value of the granularity size. TimeFormat tells us whether the time column value is expressed in epoch or is a simple date format pattern Consider 2 date time values for example 2017/07/01 00:00:00 and 2017/08/29 05:20:00: e.g. 1) If the time column value is defined in millisSinceEpoch (1498892400000, 1504009200000) this configuration will be 1:MILLISECONDS:EPOCH 2) If the time column value is defined in 5 minutes since epoch (4996308, 5013364) this configuration will be 5:MINUTES:EPOCH 3) If the time column value is defined in a simple date format of a day (e.g. 20170701, 20170829), this configuration will be 1:DAYS:SIMPLE_DATE_FORMAT:yyyyMMdd (the pattern can be configured as desired)granularity- - defines in what granularity the data is bucketed. Granularity has to follow pattern- size:timeunit, where size and timeUnit together define the bucket granularity of the data. This is independent of the format, which is purely defining how to interpret the numeric value in the date time column. E.g. 1) if a time column is defined in millisSinceEpoch (format=1:MILLISECONDS:EPOCH), but the data buckets are 5 minutes, the granularity will be 5:MINUTES. 2) if a time column is defined in hoursSinceEpoch (format=1:HOURS:EPOCH), and the data buckets are 1 hours, the granularity will be 1:HOURS
-
DateTimeFieldSpec
public DateTimeFieldSpec(String name, FieldSpec.DataType dataType, String format, String granularity)
-
DateTimeFieldSpec
public DateTimeFieldSpec(String name, FieldSpec.DataType dataType, String format, String granularity, @Nullable Object defaultNullValue, @Nullable String transformFunction)
Constructs a DateTimeFieldSpec with basic fields - name, dataType, format, granularity - and also with defaultNullValue and transformFunction
-
DateTimeFieldSpec
public DateTimeFieldSpec(String name, FieldSpec.DataType dataType, String format, String granularity, @Nullable Object defaultNullValue, @Nullable String transformFunction, @Nullable String sampleValue)
Constructs a DateTimeFieldSpec with basic fields - name, dataType, format, granularity - and also with defaultNullValue and transformFunction
-
-
Method Detail
-
getFieldType
public FieldSpec.FieldType getFieldType()
- Specified by:
getFieldTypein classFieldSpec
-
setSingleValueField
public void setSingleValueField(boolean isSingleValueField)
- Overrides:
setSingleValueFieldin classFieldSpec
-
getFormat
public String getFormat()
-
setFormat
public void setFormat(String format)
-
getFormatSpec
public DateTimeFormatSpec getFormatSpec()
-
getGranularity
public String getGranularity()
-
setGranularity
public void setGranularity(String granularity)
-
getSampleValue
public Object getSampleValue()
-
setSampleValue
public void setSampleValue(String sampleValue)
-
getGranularitySpec
public DateTimeGranularitySpec getGranularitySpec()
-
toJsonObject
public com.fasterxml.jackson.databind.node.ObjectNode toJsonObject()
Description copied from class:FieldSpecReturns theObjectNoderepresenting the field spec.Only contains fields with non-default value.
NOTE: here we use
ObjectNodeto preserve the insertion order.- Overrides:
toJsonObjectin classFieldSpec
-
-