May I do filtering on Metric column?


Would like to know if possible to filter metric column when
querying Druid.

I need to calculate the average value of a metric column excluding
when the value equal to 0, which mean those rows should be filtered and a specific
count will be used.

So the query will be like the following SQL query. In this
case, count will be the number of rows with a non-zero metric value

select sum(metric_value)/count where metric_value != 0
from db


Yes, and actually, using Druid SQL ( that query should work basically as-is. But you can also do it in Druid’s native query language by doing a not+selector filter on metric_value and “0”.

Thank you Gian, That works really well.