I am new to Flink and Flink CEP. When working with Event Time, does Flink CEP iterates the events to check patterns in ascending (event-)time order or not? Thanks in advance!
Asked
Active
Viewed 424 times
1 Answers
0
Yes, when working with event time, Flink's CEP library sorts the events by their timestamps. It uses the watermarks to know when events can safely be considered ready for processing.

David Anderson
- 39,434
- 4
- 33
- 60
-
Thanks a lot! So, let me be more specific. 1) At the beginning, I have a datastream of events. 1.1) I assignTimestampsAndWatermarks with BoundedOutOfOrdernessTimestampExtractor 1.2) I make this datastream a keyed datastream 1.3) I apply pattern() and select() and result in a new datastream. Now I want to apply again pattern() and select() to get another datastream. Q1: Is it needed again to apply steps 1.1 and 1.2 in order FlinkCEP to run with Event Time and sort my new events in ascending Event Time order? – alex Feb 28 '19 at 10:42
-
Q2: If YES, what if I didn't do that. How Flink CEP would work? Would It use Process Time? With what order would Flnik CEP access the new event? – alex Feb 28 '19 at 10:43
-
I believe the stream resulting from the PatternSelectFunction will have timestamps and watermarks, and so everything should just work. – David Anderson Feb 28 '19 at 13:54
-
The thing is that I combine events with timestamps (starting and ending time of trips) to extract events with ranges (time range of trips). Next, I want to detect events across different trips (trips with overlapping time ranges). – alex Mar 01 '19 at 12:38
-
1) Assign assignTimestampsAndWatermarks getting starting time of each trip (This way I think that I will get the trips sorted by ascending starting time, am I right?) 2) Now, for each trip (t1), I have to seek for other overlapping trips that have started before t1 ended. Does this solution sound you good? Can it be optimized? – alex Mar 01 '19 at 12:38