I'm trying to find sessions that contain 3 specific events, they need to be ordered, meaning that event_1 happens first, then event_2, then event_3, but they don't need to be concentrated exactly one after another. Instead, any number of other random events can be in between them. How do I define a pattern in the match_recognize clause to allow me to mark these events with the classifier statement, and also mark them in case the sequence is incomplete, if for example only event_1 happens, or if event_1 + event_2 happens?
Or is there any other way to do this that is more efficient and doesn't involve match_recognize? I'm trying to avoid multiple joins because data is huge.
Here's a dummy query for presentation:
select
session_id,
event,
event_dttm
from events
match_recognize (
partition by session_id
order by event_dttm
measures
classifier as var
all rows per match with unmatched rows
pattern (???answer needed???)
define
event_1 as event = 'Click image',
event_2 as event = 'Open profile',
event_3 as event = 'Leave review');