osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Something wrong with the until condition FLINK-CEP


Sorry, it seems that I misunderstood the concept of the composition of the until condition and oneOrMore.


 Original Message 
Sender: bupt_ljy<bupt_ljy@xxxxxxx>
Recipient: user<user@xxxxxxxxxxxxxxxx>
Date: Tuesday, Dec 11, 2018 14:00
Subject: 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 {
List<StreamRecord<Event>> 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
Pattern<Event, ?> pattern = Pattern.<Event>begin("start").where(new SimpleCondition<Event>() {
private static final long serialVersionUID = 5726188262756267490L;

@Override
public boolean filter(Event value) throws Exception {
return value.getName().equals("c");
}
}).followedBy("middle").where(new SimpleCondition<Event>() {
private static final long serialVersionUID = 5726188262756267490L;

@Override
public boolean filter(Event value) throws Exception {
return value.getName().equals("a");
}
}).oneOrMore().greedy().until(new SimpleCondition<Event>() {
private static final long serialVersionUID = 5726188262756267490L;

@Override
public boolean filter(Event value) throws Exception {
return value.getPrice() > 3.0;
}
}).followedBy("end").where(new SimpleCondition<Event>() {
private static final long serialVersionUID = 5726188262756267490L;

@Override
public boolean filter(Event value) throws Exception {
return value.getName().equals("d");
}
});

NFA<Event> nfa = compile(pattern, false);

final List<List<Event>> resultingPatterns = feedNFA(inputEvents, nfa);

compareMaps(resultingPatterns, Lists.<List<Event>>newArrayList(
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