package org.apache.flink.cep;
import java.io.Serializable;
import java.util.Comparator;
public interface EventComparator<T> extends Comparator<T>, Serializable {
long serialVersionUID = 1L;
}
Here's how it's used
PatternStream<Event> patternStream = CEP.pattern(input, pattern, comparator);
Input is used to provide data, as they will be matched by pattern, the lefts are the filtered data. The comparator is used to handle the data that come in the same time.
so why does it need to extend Serializable? It needs to be serialized?
All of the user functions you implement for use by Flink need to be Serializable. They are instantiated in the client process, and then serialized and sent over the network to the cluster where they are deserialized and used.