How to use nested groupBys?

read the docs , i found the section

Query Data Source

This is used for nested groupBys and is only currently supported for groupBys.

Query Data Source

This is used for nested groupBys and is only currently supported for groupBys.

{
    "type": "query",
    "query": {
        "type": "groupBy",
        ...
    }
}

but no example here, how to use it ?

I use it like this, hope it can help you!

{

“queryType”: “groupBy”,

“dataSource”:{

“type”: “query”,

“query”: {

“queryType”: “groupBy”,

“dataSource”: “druid”,

“granularity”: “all”,

“dimensions”: [“idvisiteur”, “site”],

“aggregations”: [

{“type”: “count”, “name”: “rows”}

],

“intervals”: [“2016-04-01T00:00/2016-04-02T00”]

}

},

“granularity”: “all”,

“dimensions”: [“site”],

“aggregations”: [

{“type”: “count”, “name”: “rows”}

],

“intervals”: [“2016-04-01T00:00/2016-04-02T00”]

}

Ben

It would be great if this documentation could be updated as well.

Thank u very much it works well, I can filter the result in “groupBy”.

If i want to count the rows of “grouyBy” result, how to get it ? The count maybe return the roll up result.

what i want is :

select count(*) from (select userid sum(pv) as pv_sum, sum(vv) as vv_sum from mytable where host=‘my.url.com’ group by userid having (pv_sum>5 and vv_sum>3) )

在 2016年5月25日星期三 UTC+8上午12:00:03,Benjamin Angelaud写道:

thanks for fangjin’s reply. I will write the experience of using druid in the druid blog.

在 2016年5月25日星期三 UTC+8上午12:45:28,Fangjin Yang写道: