Edge Detection


On my use case, I am looking to detect edges on a time-series waveform.
Using the bound filter, I can get the values above a limit, which works

However, I can't find a way to query for single edges. So, if the limit
is 35, and I have a waveform that hits 45, then 40, then 42 and then 32,
I want to only detect the first value that crossed the limit (45).

I experimented a bit with virtualColumns, my idea being that an
expression could determine if a value is an edge or not. My problem is
that to see if a value is an edge, I need to access the previous value.
I looked at the documentation, and can't seem to find a way to run a
query that does a comparison using the previous value.

Does Druid provides a construct to be able to access the previous values
on a filter or on an expression? Or maybe I am thinking this wrong and
there is a better way to detect edges?

Appreciate any pointers!

Hi Alejandro,

I believe what you describe (event-based analytics, based on time series) would indeed need lookback to previous values, or in the SQL world “Window Functions”, which isn’t yet implemented in Druid.

(I know of an existing implementation called Lookback Query, which is in the works of being released publically, but it would probably take a few months for that to be happen).

If you’re not looking specifically for Druid, you could consider Bullet DB: https://bullet-db.github.io/.