Class DateTimeFieldSpec

    • 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,
                                 @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

      • getFormat

        public String getFormat()
      • setFormat

        public void setFormat​(String format)
      • getGranularity

        public String getGranularity()
      • setGranularity

        public void setGranularity​(String granularity)
      • getSampleValue

        public Object getSampleValue()
      • setSampleValue

        public void setSampleValue​(String sampleValue)
      • toJsonObject

        public com.fasterxml.jackson.databind.node.ObjectNode toJsonObject()
        Description copied from class: FieldSpec
        Returns the ObjectNode representing the field spec.

        Only contains fields with non-default value.

        NOTE: here we use ObjectNode to preserve the insertion order.

        Overrides:
        toJsonObject in class FieldSpec