From 9169f50fd017590efff15204914d3775755da3c3 Mon Sep 17 00:00:00 2001 From: Gian Merlino Date: Tue, 17 Apr 2018 12:50:08 -0700 Subject: [PATCH] Timeseries: Epoch time instead of null for grandTotal. May be friendlier to people who have written serde code that assumes all timestamps are non-null. --- docs/content/querying/timeseriesquery.md | 6 +++--- .../query/timeseries/TimeseriesQueryQueryToolChest.java | 3 ++- .../druid/query/timeseries/TimeseriesQueryRunnerTest.java | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/docs/content/querying/timeseriesquery.md b/docs/content/querying/timeseriesquery.md index 9a42bfa87264..be279faaa14e 100644 --- a/docs/content/querying/timeseriesquery.md +++ b/docs/content/querying/timeseriesquery.md @@ -94,9 +94,9 @@ Druid can include an extra "grand totals" row as the last row of a timeseries re } ``` -The grand totals row will appear as the last row in the result array, and will have no timestamp. It will be the last -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. +The grand totals row will appear as the last row in the result array, and will have the Unix epoch as its timestamp +(1970-01-01T00:00:00Z). It will be the last 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. #### Zero-filling diff --git a/processing/src/main/java/io/druid/query/timeseries/TimeseriesQueryQueryToolChest.java b/processing/src/main/java/io/druid/query/timeseries/TimeseriesQueryQueryToolChest.java index c50d2dd50f83..af6debe2be53 100644 --- a/processing/src/main/java/io/druid/query/timeseries/TimeseriesQueryQueryToolChest.java +++ b/processing/src/main/java/io/druid/query/timeseries/TimeseriesQueryQueryToolChest.java @@ -28,6 +28,7 @@ import com.google.common.collect.Maps; import com.google.common.collect.Ordering; import com.google.inject.Inject; +import io.druid.java.util.common.DateTimes; import io.druid.java.util.common.granularity.Granularity; import io.druid.java.util.common.guava.Sequence; import io.druid.java.util.common.guava.Sequences; @@ -181,7 +182,7 @@ public Sequence> run( } final Result result = new Result<>( - null, + DateTimes.EPOCH, new TimeseriesResultValue(totalsMap) ); diff --git a/processing/src/test/java/io/druid/query/timeseries/TimeseriesQueryRunnerTest.java b/processing/src/test/java/io/druid/query/timeseries/TimeseriesQueryRunnerTest.java index 385a96b3e743..eb062b1282b3 100644 --- a/processing/src/test/java/io/druid/query/timeseries/TimeseriesQueryRunnerTest.java +++ b/processing/src/test/java/io/druid/query/timeseries/TimeseriesQueryRunnerTest.java @@ -453,7 +453,7 @@ public void testTimeseriesGrandTotal() expectedResults.add( new Result<>( - null, + DateTimes.EPOCH, new TimeseriesResultValue( ImmutableMap.of( "rows",