Post-query analytics

Sorry for the weird title, I’m not sure what to call this. Is there a way to perform min/max/avg calculations on the resulting output segments? For instance, if my query specified a granularity of 15 minutes, I might get an output that looks like this:

[

{

“timestamp”: “2015-04-21T00:00:00.000Z”,

“result”: [

{

“count”: 17765

}

]

},

{

“timestamp”: “2015-04-21T00:15:00.000Z”,

“result”: [

{

“count”: 8861

}

]

},

{

“timestamp”: “2015-04-21T00:30:00.000Z”,

“result”: [

{

“count”: 16383

}

]

}

]

Is there a way to have the query only return the segment with maximum value of the “count” metric?

Hi Taylor,

I don’t think there’s a Druid feature for doing this. postAggregations exist but they generally apply within each bucket. I think if I was you I would do this on the client side after you get the result back from Druid. There are some client libraries that should make this kind of thing easier: http://druid.io/docs/latest/Libraries.html