How to construct a Druid query equivalent to this SQL

Hi,

I’m trying to construct a Druid query based on this data which I’ve done in SQL? Not sure if it’s possible?

For example, I have this data in Druid.

I guess this is possible by groupBy

{
“queryType”: “groupBy”,
“dataSource”: “sparrow-firehose-web”,
“dimensions”: ["_c", “_t”],
“granularity”: “all”,
“threshold”: 50,
“filter”: {
“type”: “and”,
“fields”: [{
“type”: “selector”,
“dimension”: “_o”,
“value”: “origin”
}
]
},
“aggregations”: [{
“type”:“count”,
“name”:“count”,
“fieldName”:"_c"
}],
“intervals”: [“2016-03-23T00:00:00.000/2016-03-24T00:00:00.000”]
}

``

So I guess the question is, is this possible with topN?

Hey Noppanit,

Maybe you could take a look at https://github.com/implydata/plyql

SQL over druid.