如何使用siddhi实施执行计划? [英] How to implement execution plans using siddhi?

查看:118
本文介绍了如何使用siddhi实施执行计划?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

首先让我描述一下我的要求:

First of all let me description my requirement:

data.csv : 第一列是id,第二列是vlaue.

data.csv: column one is id,column two is vlaue.

1,0
2,0
3,0
4,86
5,87
6,88
7,89
8,86
9,0
10,0
11,0
12,0
13,0
14,86
15,87
16,88
17,89
18,0
19,0
20,0

这是我的 InputStream 和我的 OutPutStream :

id int,value int

data.csv 将通过使用事件流模拟器插入 InputStream .

如果有五个连续的值> = 85,我会将第一个id,value记录到 OutPutStream 中. 例如,我将记录id = 4,value = 86,但id = 14到id = 17我会忽略它.

If there are five consecutive value>=85, I would record the first id,value into OutPutStream. For example,I will record id=4,value=86 ,but id=14 to id=17 i will ignore it.

那么我该如何在执行计划中编写siddhi脚本来实现它?

So how can i write siddhi script in execution plans to implement it?

================================================ =========================

==========================================================================

data2.csv :

1,0
2,0
3,0
4,86
5,87
6,88
7,89
8,86
9,87
10,88
11,89
12,90
13,91
14,86
15,87
16,88
17,89
18,90
19,90
20,90
21,0
22,0,
23,87
24,85
25,86
26,0
27,17
...
200,91
201,0

推荐答案

对于正好五个连续值> = 85

For exactly five consecutive values >= 85

from every a1=InputStream[value>=85], a2=InputStream[value>=85]+, a3=InputStream[value<85]
select a1.id, a1.value
having (not (a2[3] is null)) and (a2[4] is null)
insert into OutPutStream;

对于五个以上连续值> = 85

For more than five consecutive values >= 85

from every a1=InputStream[value>=85], a2=InputStream[value>=85]+, a3=InputStream[value<85]
select a1.id, a1.value
having (not (a2[3] is null))
insert into OutPutStream;

这篇关于如何使用siddhi实施执行计划?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆