You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@flink.apache.org by bupt_ljy <bu...@163.com> on 2018/12/11 06:00:20 UTC
Something wrong with the until condition FLINK-CEP
Hi all,
I seem to find a problem of until condition in testGreedyUntilZeroOrMoreWithDummyEventsAfterQuantifier in GreedyITCase.java. I modify the unit test a little bit like this:
@Test
public void testGreedyUntilZeroOrMoreWithDummyEventsAfterQuantifier() throws Exception {
ListStreamRecordEvent inputEvents = new ArrayList();
Event c = new Event(40, "c", 1.0);
Event a1 = new Event(41, "a", 2.0);
Event a2 = new Event(42, "d", 2.0);
inputEvents.add(new StreamRecord(c, 1));
inputEvents.add(new StreamRecord(a1, 2));
inputEvents.add(new StreamRecord(a2, 3));
// c a* d
PatternEvent, ? pattern = Pattern.Eventbegin("start").where(new SimpleConditionEvent() {
private static final long serialVersionUID = 5726188262756267490L;
@Override
public boolean filter(Event value) throws Exception {
return value.getName().equals("c");
}
}).followedBy("middle").where(new SimpleConditionEvent() {
private static final long serialVersionUID = 5726188262756267490L;
@Override
public boolean filter(Event value) throws Exception {
return value.getName().equals("a");
}
}).oneOrMore().greedy().until(new SimpleConditionEvent() {
private static final long serialVersionUID = 5726188262756267490L;
@Override
public boolean filter(Event value) throws Exception {
return value.getPrice() 3.0;
}
}).followedBy("end").where(new SimpleConditionEvent() {
private static final long serialVersionUID = 5726188262756267490L;
@Override
public boolean filter(Event value) throws Exception {
return value.getName().equals("d");
}
});
NFAEvent nfa = compile(pattern, false);
final ListListEvent resultingPatterns = feedNFA(inputEvents, nfa);
compareMaps(resultingPatterns, Lists.ListEventnewArrayList(
Lists.newArrayList(c, a1, a2)
));
}
I think this should fail because no events satisfies the until condition, but it works.
Flink version is 1.6.
Best,
Jiayi Liao