Skip to content

Commit 2235e64

Browse files
techdocsmithvtlim317brian
authored
[backport]docs: update timeseries to reflect NULL filling (#15512) (#15548)
Co-authored-by: Victoria Lim <vtlim@users.noreply.github.com> Co-authored-by: 317brian <53799971+317brian@users.noreply.github.com>
1 parent e76b87f commit 2235e64

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

docs/querying/timeseriesquery.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ There are 7 main parts to a timeseries query:
8484
|aggregations|See [Aggregations](../querying/aggregations.md)|no|
8585
|postAggregations|See [Post Aggregations](../querying/post-aggregations.md)|no|
8686
|limit|An integer that limits the number of results. The default is unlimited.|no|
87-
|context|Can be used to modify query behavior, including [grand totals](#grand-totals) and [zero-filling](#zero-filling). See also [Context](../querying/query-context.md) for parameters that apply to all query types.|no|
87+
|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|
8888

8989
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:
9090

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

129-
## Zero-filling
129+
## Empty bucket values
130130

131-
Timeseries queries normally fill empty interior time buckets with zeroes. For example, if you issue a "day" granularity
132-
timeseries query for the interval 2012-01-01/2012-01-04, and no data exists for 2012-01-02, you will receive:
131+
By default, Druid fills empty interior time buckets in the results of timeseries queries with the default value for the [aggregator function](./sql-aggregations.md).
132+
For example, if you issue a "day" granularity
133+
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:
133134

134135
```json
135136
[
@@ -139,7 +140,7 @@ timeseries query for the interval 2012-01-01/2012-01-04, and no data exists for
139140
},
140141
{
141142
"timestamp": "2012-01-02T00:00:00.000Z",
142-
"result": { "sample_name1": 0 }
143+
"result": { "sample_name1": NULL }
143144
},
144145
{
145146
"timestamp": "2012-01-03T00:00:00.000Z",
@@ -148,12 +149,11 @@ timeseries query for the interval 2012-01-01/2012-01-04, and no data exists for
148149
]
149150
```
150151

151-
Time buckets that lie completely outside the data interval are not zero-filled.
152+
Time buckets that lie completely outside the data interval are not filled with the default value.
152153

153-
You can disable all zero-filling with the context flag "skipEmptyBuckets". In this mode, the data point for 2012-01-02
154-
would be omitted from the results.
155-
156-
A query with this context flag set would look like:
154+
You can disable all empty bucket filling with the context flag `skipEmptyBuckets`.
155+
In this mode, Druid omits the data point 2012-01-02 from the results.
156+
For example:
157157

158158
```json
159159
{
@@ -168,4 +168,4 @@ A query with this context flag set would look like:
168168
"skipEmptyBuckets": "true"
169169
}
170170
}
171-
```
171+
```

0 commit comments

Comments
 (0)