Siddhi 3.1.0, 我的siddhiql是这样的:
define stream demo(key string, v1 int, v2 int, v3 int);
from demo#window.cron(0/5 * * * * ?)
select key,sum(v1) as v1,sum(v2) as v2,sum(v3) as v3 insert into outputStream
我希望获得密钥key
组的结果聚合,实际上每个事件我收到一个聚合结果,但每组不会收到一个聚合结果。
我知道timeBatch
可以获得每组的结果,但它无法控制输出时间段。
有什么建议吗?
答案 0 :(得分:0)
您应该使用GroupBy子句。
from demo#window.cron(0/5 * * * * ?)
select key,sum(v1) as v1,sum(v2) as v2,sum(v3) as v3
group by key
insert into outputStream;