Calculating Time Between Events

Is there a good way to calculate the time between two events in Druid? (Same as: https://groups.google.com/d/msg/druid-user/gCNk88H6EGQ/fbRiBSyVDAAJ?)

I’m imagining finding two records in a Druid table via a query on dimensions and then doing something like an R difftime() to return the time difference. Subsequently want to calculate the average time between like events by rolling up lots of such time deltas to find the average.

Any pointers?

Maybe a nested query? The inner query to group together related events and find min/max time for each group of events and the time difference between them, and the outer query to find the average of those differences.

If that’s not what you meant, then I have the same question as Slim did in the other thread – could you express what you’re wanting to do as SQL? That usually helps understand what you’re getting at.