lf-edge / ekuiper

Lightweight data stream processing engine for IoT edge
https://ekuiper.org
Apache License 2.0
1.48k stars 413 forks source link

Is it possible in ekuiper sql, extracting time difference like sql? #992

Closed iamonlysaiful closed 3 years ago

iamonlysaiful commented 3 years ago

I have two question about time difference related query,

  1. Is it possible to query like tsql SELECT datediff(minute, startdatetime, enddatetime) from demo
  2. Can print time difference of stream windows(e.g. sliding window)'s between first event and last event of specific interval.
superrxan commented 3 years ago

for the first question, I think we do not have yet for the second, you can try the window_start() & window_end() function

select avg(humidity) as avg_hum, window_end() - window_start() as time_diff from demo2 GROUP BY TUMBLINGWINDOW(ss, 10);
Query was submit successfully.
kuiper > [{"avg_hum":15,"time_diff":9971}]
iamonlysaiful commented 3 years ago

@SuperRxan Thanks for your reply.

I'm using emqx/kuiper:1.2.1-alpine , which is using with edgex compose file. from which version window_end() , window_start() these function supported?

superrxan commented 3 years ago

good question !!!

we add these function since this release https://github.com/lf-edge/ekuiper/releases/tag/1.3.0

and you can find the image here https://registry.hub.docker.com/r/lfedge/ekuiper/tags?page=1&ordering=last_updated

iamonlysaiful commented 3 years ago

Hey @SuperRxan Thanks for reply,

this version of ekuiper return this error when I am tyring to run with edgex-ireland compose file image

Here is my compose config. anything to change? image

superrxan commented 3 years ago

you can remove this line in compose config user: kuiper: kuiper