ekuiper icon indicating copy to clipboard operation
ekuiper copied to clipboard

Support New Type of Window

Open sunjiawe opened this issue 1 year ago • 4 comments

What would you like to be added/modified:

It is a good idea to add a new type of windows, not base on time or count, but on the condition expr.

TDengine have this feature: https://docs.tdengine.com/taos-sql/distinguished/#state-window continuous rows with the same status belong to a status window. Once the status changes, the status window closes

Why is this needed: It will be very helpful in some manufacturing applicatrion.

Maybe I'm a new player, can I implement this with the existing syntax?

sunjiawe avatar May 11 '24 00:05 sunjiawe

Check the conditional sliding window https://ekuiper.org/docs/en/latest/sqls/windows.html#the-trigger-condition-of-the-sliding-window

ngjaying avatar May 11 '24 00:05 ngjaying

Check the conditional sliding window https://ekuiper.org/docs/en/latest/sqls/windows.html#the-trigger-condition-of-the-sliding-window

how to exactly control the start point of the window? refer: https://docs.tdengine.com/taos-sql/distinguished/#event-window td can use start with expr1 end with expr2

conditional sliding window, in my understanding, only can control end with OVER(when expr)

sunjiawe avatar May 11 '24 01:05 sunjiawe

Check the conditional sliding window https://ekuiper.org/docs/en/latest/sqls/windows.html#the-trigger-condition-of-the-sliding-window

this is the demo in https://docs.tdengine.com/taos-sql/distinguished/#event-window

select _wstart, _wend, count(*) from t event_window start with c1 > 0 end with c2 < 10 

And this is the version I translated into ekuiper:

SELECT count(*) FROM t GROUP BY SlidingWindow(ss,60) FILTER(where c1 > 0) OVER(when c2 < 10)

FILTER control the window started, OVER control the window closed. And (ss,60) is an additional constraint on the windows length on time. Am I right?

sunjiawe avatar May 11 '24 01:05 sunjiawe

Snipaste_2024-05-11_09-18-16

I don't think conditional sliding window meet my need. The doc mean Each piece of data meets the filtering conditions will trigger.

I want only trigger once when OVER expr, then the windows should reopen on FILTER expr

sunjiawe avatar May 11 '24 01:05 sunjiawe