These types of queries take a timeseries query object and return an array of JSON objects where each object represents a value asked for by the timeseries query.
An example timeseries query object is shown below:
To pull it all together, the above query would return 2 data points, one for each day between 2012-01-01 and 2012-01-03, from the “sample_datasource” table. Each data point would be the (long) sum of sample_fieldName1, the (double) sum of sample_fieldName2 and the (double) result of sample_fieldName1 divided by sample_fieldName2 for the filter set. The output looks like this:
Druid can include an extra “grand totals” row as the last row of a timeseries result set. To enable this, add "grandTotal" : true
to your query context. For example:
Zero-filling
Timeseries queries normally fill empty interior time buckets with zeroes. For example, if you issue a “day” granularity timeseries query for the interval 2012-01-01/2012-01-04, and no data exists for 2012-01-02, you will receive:
Time buckets that lie completely outside the data interval are not zero-filled.
A query with this context flag set would look like: