Query concatenation


We’re trying out Druid We stumbled upon a small doubt trying to performing some complex queries:

We’ve been trying to see if it’s possible to combine aggregation and pagination in a single query. For example, as a first step, we’d need to realize this query (using the wikiticker data source provided by the tutorials):


“queryType”: “topN”,

“dataSource”: “wikiticker”,

“dimension”: “page”,

“threshold”: 8,

“metric”: “count”,

“granularity”: “all”,

“aggregations”: [


“type”: “longSum”,

“name”: “count”,

“fieldName”: “count”



“intervals”: [“2015-09-12/2015-09-13”]


And with this result, use Select with the pertinent pagingSpec:


“queryType”: “select”,

“dataSource”: “wikiticker”,

“descending”: “true”,

“dimension” : [“regionName”],

“metric” : [“added”, “count”, “delta”],

“granularity”: “all”,

“intervals”: [“2015-09-12/2015-09-13”],

“pagingSpec”:{“pagingIdentifiers”: {}, “threshold”:6}


In order to use pagination.

We’ve seen that the only way to use nested queries is with GroupBy, but is there any other way to accomplish what we need?

Has anyone else stumbled upon this problem and could offer their solution? Any help is greatly appreciated!

Thank you very much!

-Joan Cardona

Are you just looking for the added, count, and delta per region name?