Esper EPL 查询时间(t) 和时间(t-1)
我正在尝试实现一个 EPL 查询,该查询可以获取 Time(t) & 的平均值。时间(t-1)。
例如:
<块引用>a) 在前 5 秒(第 0-5 秒)内有 2 个事件,平均值为 12
b) 在接下来的 5 秒(第 5-10 秒)内,有 3 个事件的平均值为 23 ,并且在捕获此信息的 EPL 查询中,我还可以看到前一次的平均值为 12前5秒窗口
我的想法是以最终的 epl 查询具有时间快照的方式交错对象/查询(t) & Time(t-1),如虚拟创建的对象 ScoreInfoBeforeAfter 中所示。但是它不起作用。
任何想法将不胜感激。谢谢。
~~~
// The object being published to the Esper stream:
class ScoreEvent { int score; ... }
I am trying to implement an EPL query that can pick up the avg for Time(t) & Time(t-1).
For example:
a) in the first 5 seconds (seconds 0-5) there are 2 events with an avg of 12
b) in the next 5 seconds (seconds 5-10) there are 3 events with an avg of 23 , and in the EPL query that catches this information, I am able to also see the avg of 12 from the previous time window of the first 5 seconds
The idea I have is to stagger the objects/queries in such a way that the final epl query has a snapshot of Time(t) & Time(t-1), as seen in the virtually created object ScoreInfoBeforeAfter . However it's not working.
Any ideas would be greatly appreciated. Thanks.
~~~~
// The object being published to the Esper stream:
class ScoreEvent { int score; ... }
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看起来关键字 prior 就是解决方案。
http://esper.codehaus.org/esper -2.1.0/doc/reference/en/html/functionreference.html
请参阅:第 7.1.9 节
根据我在原始帖子中描述的示例,这是我的相应解决方案成立。它似乎工作正常。
..
这很好,因为你可以做这样的事情:
Looks like the keyword prior is the solution.
http://esper.codehaus.org/esper-2.1.0/doc/reference/en/html/functionreference.html
See: Section 7.1.9
In terms of the example I described in the original post, here's the corresponding solution I found. It seems to be working correctly.
..
And then it's nice, because you can do stuff like this: