Druid Granularity ( WindowStart-Inclusive WindowEnd-Exclusive )

Hello,

we have the following structure in our data. The Json data comes in at every 15 mins interval.

Our usecase needs to find the last - minus on the stream_value field for every 15 mins

{“timestamp”: “2018-08-16T11:00Z”,“key”:“key1”,“stream_value”:“25”}

{“timestamp”: “2018-08-16T11:15Z”,“key”:“key1”,“stream_value”:“50”}

{“timestamp”: “2018-08-16T11:30Z”,“key”:“key1”,“stream_value”:“75”}

{“timestamp”: “2018-08-16T11:45Z”,“key”:“key1”,“stream_value”:“100”}

{“timestamp”: “2018-08-16T12:00Z”,“key”:“key1”,“stream_value”:“125”}

Below is the query which we are using

{

“queryType”: “groupBy”,

“dataSource”: "test

_datasource",

“granularity”: “fifteen_minute”,

“dimensions”: [“key”],

“aggregations”: [

{ “type”: “doubleLast”, “name”: “last_value”, “fieldName”: “stream_value” },

{ “type”: “doubleFirst”, “name”: “first_value”, “fieldName”: “stream_value” }

],

“postAggregations”: [

{ “type”: “arithmetic”,

“name”: “difference”,

“fn”: “-”,

“fields”: [

 { "type": "hyperUniqueCardinality",  "fieldName": "last_value" },
 { "type": "hyperUniqueCardinality",  "fieldName": "first_value" }

]

}

],

}

The granularity seems to be inclusive at the left and exclusive at the right because of which the first and last values are the same.

{

“version” : “v1”,

“timestamp” : “2018-08-16T11:00Z”,

“event” : {

“difference” : 0.0,

“first_value” : 25,

“last_value” : 25,

“source_key” : “key1”

}

}, {

“version” : “v1”,

“timestamp” : “2018-08-16T11:15Z”,

“event” : {

“generation” : 0.0,

“first_value” : 50,

“last_value” : 50,

“source_key” : “key1”

}

}

Please let me know if there is anyway where we can make inclusive at both the ends of the Intervals.

Thanks very much for the help.

Hi Prahu,

Even I am facing same problem, But looks like there is no solution available or work around.

If anyone have any work around please help us on this.