代码之家  ›  专栏  ›  技术社区  ›  Christophe Schutz

与lastUnique()相反

  •  0
  • Christophe Schutz  · 技术社区  · 9 年前

    一般来说,对于Esper和EPL来说,我有两个用例,它们基本上是相互对立的。首先,我需要使用 firstunique(*parameters*).win:time(*time*) .

    现在我需要做的恰恰相反,基本上捕捉所有到达该窗口的事件,而不是该语句抛出的事件,基本上是所有重复的事件。

    2 回复  |  直到 9 年前
        1
  •  0
  •   user3613754    9 年前

    您可以使用子查询和“not exists”。例如:

    select * from Event e1 where not exists (select * from Event#firstunique(*parameters*)#time(*time*) e2 where e1.parameters = e2.parameters)
    
        2
  •  0
  •   Christophe Schutz    9 年前

    查询如下所示:

    select * from Event a where exists (select * from Event.std:firstUnique(*parameters*).win:time(*time*) b where a.eventId <> b.eventId)
    

    这解决了我遇到的问题 方法将返回每个事件(重复事件和唯一事件),因为子查询中的窗口将首先填充。

    推荐文章