Skip to content

Timeseries: Add "grandTotal" option.#5640

Merged
b-slim merged 4 commits intoapache:masterfrom
gianm:timeseries-grand-total
Apr 17, 2018
Merged

Timeseries: Add "grandTotal" option.#5640
b-slim merged 4 commits intoapache:masterfrom
gianm:timeseries-grand-total

Conversation

@gianm
Copy link
Copy Markdown
Contributor

@gianm gianm commented Apr 13, 2018

Adds a grandTotal option to timeseries queries. It saves the need for two queries when a UI wants to draw a timeseries but also wants to show the grand total, and also reduces cluster load (since the grand total is cheap to compute when piggybacked on the main query).

I'm not sure if the way I did this is best -- check out mergeResults in the tool chest. I'm open to other suggestions.

Similar to #5280, but it's for timeseries.

@gianm gianm added the Feature label Apr 13, 2018
responseContext
);

if (query.isGrandTotal()) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gianm wouldn't this materialize the sequence before actual streaming of the results starts?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think so, because Sequences.map is lazy.

@b-slim
Copy link
Copy Markdown
Contributor

b-slim commented Apr 16, 2018

👍

@jihoonson
Copy link
Copy Markdown
Contributor

I'm not sure if the way I did this is best -- check out mergeResults in the tool chest. I'm open to other suggestions.

Are you concerning about doing an additional aggregation for grandTotal in brokers instead of, like other metrics, computing pre-merge aggregates in historicals and merging them in brokers? I think it's fine if it's documented.

@gianm
Copy link
Copy Markdown
Contributor Author

gianm commented Apr 17, 2018

@jihoonson nah I'm not concerned about that. I was mostly wondering if it was kosher to do the accumulation by stuffing things in a side-array while mapping the results sequence. I didn't see a better way to implement it though.

@jihoonson
Copy link
Copy Markdown
Contributor

I see. I think it's fine.

@b-slim b-slim merged commit fbf3fc1 into apache:master Apr 17, 2018
sathishsri88 pushed a commit to sathishs/druid that referenced this pull request May 8, 2018
* Timeseries: Add "grandTotal" option.

* Modify whitespace.

* Checkstyle workaround.
gianm added a commit to implydata/druid-public that referenced this pull request Jul 25, 2018
* Timeseries: Add "grandTotal" option.

* Modify whitespace.

* Checkstyle workaround.
@dclim dclim added this to the 0.13.0 milestone Oct 8, 2018
@gianm gianm deleted the timeseries-grand-total branch September 23, 2022 19:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants