Calculating the "delta" of a metric?


Say I have a field named A in my segments.

What I want to do is calculating the A(in the given time) - A(in the previous not empty bucket).

I can do it by taking the results and calculating in a seperate program. But if Druid suggests a feature like this, that would be great.

Kind regards.


(I’m not a Druid developer nor an expert in any way) Do you want to apply post-aggregations over this “delta aggregation” (a discrete differentiation)? It not, you could do the discrete differentiation after receiving it from Druid without too many overhead in your client application code.

In any way, this idea seems interesting for the first case. (I don’t think this is currently possible).


After thinking for a while, I decided to do that in my applicaton, too.

Thanks for reply.

What is the SQL query you are trying to issue?

Perhaps would help as it also does query planning for Druid.