Skip to content

Commit

Permalink
apply suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
techdocsmith committed Dec 7, 2023
1 parent 3a1b241 commit 02c5a3d
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions docs/querying/timeseriesquery.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ There are 7 main parts to a timeseries query:
|aggregations|See [Aggregations](../querying/aggregations.md)|no|
|postAggregations|See [Post Aggregations](../querying/post-aggregations.md)|no|
|limit|An integer that limits the number of results. The default is unlimited.|no|
|context|Can be used to modify query behavior, including [grand totals](#grand-totals) and [NULL filling](#null-filling). See also [Context](../querying/query-context.md) for parameters that apply to all query types.|no|
|context|Can be used to modify query behavior, including [grand totals](#grand-totals) and [empty bucket values](#empty-bucket-values). See also [Context](../querying/query-context.md) for parameters that apply to all query types.|no|

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:

Expand Down Expand Up @@ -126,11 +126,11 @@ The grand totals row will appear as the last row in the result array, and will h
row even if the query is run in "descending" mode. Post-aggregations in the grand totals row will be computed based
upon the grand total aggregations.

## NULL filling
## Empty bucket values

By default timeseries queries fill empty interior time buckets with NULL.
By default Druid fills empty interior time buckets in responses to timeseries queries with the default value for the [aggregator function](./sql-aggregations.md).
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:
timeseries query for the interval 2012-01-01/2012-01-04 using the SUM aggregator, and no data exists for 2012-01-02, Druid returns:

```json
[
Expand All @@ -149,7 +149,7 @@ timeseries query for the interval 2012-01-01/2012-01-04, and no data exists for
]
```

Time buckets that lie completely outside the data interval are not filled with NULL.
Time buckets that lie completely outside the data interval are not filled with the default value.

You can disable all NULL filling with the context flag "skipEmptyBuckets".
In this mode, Druid omits the data point 2012-01-02 from the results.
Expand All @@ -168,7 +168,4 @@ For example:
"skipEmptyBuckets": "true"
}
}
```

Prior to Druid 28, Druid filled empty interior time buckets with zero by default.
You can set `druid.generic.useDefaultValueForNull=true` to retain the legacy behavior, however it will eventually be removed.
```

0 comments on commit 02c5a3d

Please sign in to comment.