I am having a hard time converting this simple SQL Query below into Druid:
SELECT country, city, Count(*)
FROM people_data
WHERE name=\"Mary\"
GROUP BY co
Simple answer is that you cannot select arbitrary dimensions in your groupBy
queries.
Strictly speaking even SQL query does not make sense. If for a given combination of country, city
there are many different values of name
and street
, then how do you squeeze that into a single row? You have to aggregate them, e.g. by using max
function.
In this case you can include the same column in your data as both dimension and metric, e.g. name_dim
and name_metric
, and include corresponding aggregation over your metric, max(name_metric)
.
Please note, that if these columns, name
etc, have high granularity values, then that will kill Druid's roll-up feature.