0

Can anyone help me define the EPL statement to catch the event when the following situation occurs:

Assumming that there are events with 3 attributes - (string)Symbol, (boolean)Value, (datetime)Timestamp.

If the events have the same Symbol and have Value both true and false at the same time, should be captured. For example event1(Symbol - apple, Value - True, Timestamp - 20210614-14:00:00) and event2(Symbol - apple, Value - False, Timestamp - 20210614-14:00:00). But if the events have different Symbols (like apple and banana) should be ignored (not captured).

Thanks for any help.

Narsu

Narsu
  • 1
  • Events (symbol, value, timestamp) with same timestamp and symbol and different value (true and false) should be captured. – Narsu Jun 14 '21 at 11:59

1 Answers1

0

This would match two events immediately following each other (no criteria were stated as to what can come in between)

select * from MyEvent
  match_recognize (
    partition by symbol
    measures a, b
    pattern (a b)
    define
      b as b.timestamp = a.timestamp and b.value != a.value
)
user3613754
  • 816
  • 1
  • 5
  • 5