How to convert sql query

Hi

How to convert below sql to Druid query api ?

select cnt, count(distinct session_id)

from

(

select session_id, count(*) as cnt

from source

group by session_id

)

group by cnt;

I think that query should work as-is with Druid SQL: http://druid.io/docs/latest/querying/sql.html. It would end up getting executed as a nested groupBy: http://druid.io/docs/latest/querying/groupbyquery.html#nested-groupbys