Getting rolling Aggregates in Druid

367 views
Skip to first unread message

Surya Vijayaraghavan

unread,
Aug 8, 2018, 1:01:38 PM8/8/18
to Druid User
Hey guys,

For the data I have currently, I answer a use case like - Give me the number of page views on an hourly basis. 
The result I get is
TimeStamp                    | Page View
===========================
2018-07-18T00:00:00Z  |  10
2018-07-18T01:00:00Z  |  5
2018-07-18T02:00:00Z  |  0
2018-07-18T03:00:00Z  |  15


The usecase that I want to solve is - Give me the total number page views till that hour. That means, I want to do an overall aggregate of my page views. So the result should look like - 
TimeStamp                    | Page View
============================
2018-07-18T00:00:00Z  |  10
2018-07-18T01:00:00Z  |  15
2018-07-18T02:00:00Z  |  15
2018-07-18T03:00:00Z  |  30


Is there any way I can achieve this? 

Tan Huynh

unread,
Aug 8, 2018, 4:16:29 PM8/8/18
to Druid User
This is a great question.  I have a similar use case where I need to calculate the cumulative sum of a metric.    

Pratik Khadloya

unread,
Aug 28, 2018, 7:31:33 PM8/28/18
to Druid User
+1 I have a similar use case.

Atul Mohan

unread,
Aug 30, 2018, 9:54:05 AM8/30/18
to druid...@googlegroups.com
Hello,
We're working on releasing a custom query type called RollingAverage query as a separate extension into the community. This extension should be able to solve your usecases.

Thanks,
Atul

--
You received this message because you are subscribed to the Google Groups "Druid User" group.
To unsubscribe from this group and stop receiving emails from it, send an email to druid-user+...@googlegroups.com.
To post to this group, send email to druid...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/druid-user/9bab1bfe-46b2-4e10-869a-c1bfa6f54f6f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
Atul Mohan

Surya Vijayaraghavan

unread,
Aug 30, 2018, 7:27:37 PM8/30/18
to Druid User
Thanks Atul! 
Please let me know if you can point me to a repo or whether I can contribute it. 

Pratik Khadloya

unread,
Sep 5, 2018, 1:36:15 PM9/5/18
to Druid User
Thats great to know! Thanks a lot!

no...@singular.net

unread,
Sep 6, 2018, 5:41:25 AM9/6/18
to Druid User
That might be really useful to us as well! we'd love to hear additional information and possibly contribute.

Charles Allen

unread,
Sep 6, 2018, 12:58:59 PM9/6/18
to druid...@googlegroups.com
Thanks Atul!
Have you considered doing a org.apache.druid.query.PostProcessingOperator instead of a whole new query type?



Eyal Yurman

unread,
Sep 6, 2018, 1:59:17 PM9/6/18
to Druid User
Hi Charles,

Our implementation doesn't use PostProcessingOperator but is leveraging the groupBy query internally.

We've been running this query type for a while in production and I'm glad to see there is a demand for it in other companies,

I'll try to open the pr this week.

Tan Huynh

unread,
Sep 6, 2018, 2:24:00 PM9/6/18
to druid...@googlegroups.com
Hi Eyal,

Can you describe the algorithm that you are using?   Are you using nested groupby to get the previous segment total?
Thanks
Tan


For more options, visit https://groups.google.com/d/optout.
--
Tan Huynh

Eyal Yurman

unread,
Sep 10, 2018, 5:41:45 AM9/10/18
to Druid User
Hi,

I've opened a new issue so you can review the concept of what we implemented:

I'm working on the user-guide (documentation) and hope to submit a pr later this week.


On Wednesday, August 8, 2018 at 10:01:38 AM UTC-7, Surya Vijayaraghavan wrote:

Eyal Yurman

unread,
Sep 10, 2018, 5:42:54 AM9/10/18
to Druid User
(sorry for the multiple replies)

Hi,

I've opened a new issue so you can review the concept of what we implemented:

I'm working on the user-guide (documentation) and hope to submit a pr later this week.

Eyal Yurman

unread,
Oct 8, 2018, 5:30:43 PM10/8/18
to Druid User

Pratik Khadloya

unread,
Oct 11, 2018, 1:24:00 PM10/11/18
to Druid User
Thanks a lot Eyal! Does this work with hyperUnique or Theta Sketch columns?

Eyal Yurman

unread,
Oct 19, 2018, 12:47:35 PM10/19/18
to druid...@googlegroups.com
Yes, it works with Theta Sketch columns.

On Thu, Oct 11, 2018 at 10:24 AM Pratik Khadloya <tisp...@gmail.com> wrote:
Thanks a lot Eyal! Does this work with hyperUnique or Theta Sketch columns?

--
You received this message because you are subscribed to the Google Groups "Druid User" group.
To unsubscribe from this group and stop receiving emails from it, send an email to druid-user+...@googlegroups.com.
To post to this group, send email to druid...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.


--
Best regards,

Eyal Yurman
+972-54-3056315
Reply all
Reply to author
Forward
0 new messages