簡體   English   中英

如何在 Nesper 的其他兩個事件之間從 stream 中刪除事件?

[英]How to remove events from stream between two other events in Nesper?

我嘗試刪除兩個不同事件之間的事件。

我找到了一種聲明動態上下文的方法,它滿足我要刪除事件的情況。

create objectarray schema ParentEvent(Start Bool,End Bool)
create objectarray schema ChildEvent() inherits ParentEvent

create context RemoveContext initiated by ChildEvent(Start) terminated by ChildEvent(End)

我根本想不通,如何構造 output stream 或 Window? 它只包含不在上下文中的所有其他 ParentEvent。

我在 OutputStream 中插入事件的方式:

insert into MyStream.out select * from ParentEvent(Start or End)

所以假設有 5 個事件 AB C DEF 並且你想要 output B 和 E 之間的所有事件。EPL 是:

create context BetweenCandEContext start B end E;
context BetweenCandEContext select * from Event;

所以上下文定義了開始和結束標准。

在你的情況下,為了“刪除事件”,意思是不處理事件,這意味着你的結束標准是你開始“刪除事件”的標准,你的開始標准是你想停止“刪除事件”的時間。

我建議,與其將其視為“刪除事件”,不如將其視為忽略事件,因為當事件到達時,它們會被忽略(而不是刪除)。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM