Druid Querying unique count

I use Druid for monitoring metrics data. The data can be represented as follows:

timestamp   |  file  |  user_id  |  size

I was able to solve this. I used a nested groupBy to get the logic