Github user kl0u commented on the issue:

    https://github.com/apache/flink/pull/3477
  
    Hi @dawidwys , the following produces no output, which should not be the 
case. The same holds if you change the pattern to `oneOrMore`.
    
    ```
    public void testZeroOrMore() {
                List<StreamRecord<Event>> inputEvents = new ArrayList<>();
    
                Event startEvent = new Event(40, "c", 1.0);
                Event middleEvent1 = new Event(41, "a", 2.0);
                Event middleEvent2 = new Event(42, "a", 3.0);
                Event middleEvent3 = new Event(43, "a", 4.0);
                Event end1 = new Event(44, "b", 5.0);
                Event end2 = new Event(45, "d", 6.0);
                Event end3 = new Event(46, "d", 7.0);
                Event end4 = new Event(47, "e", 8.0);
    
                inputEvents.add(new StreamRecord<>(startEvent, 1));
                inputEvents.add(new StreamRecord<>(middleEvent1, 3));
                inputEvents.add(new StreamRecord<>(middleEvent2, 4));
                inputEvents.add(new StreamRecord<>(middleEvent3, 5));
                inputEvents.add(new StreamRecord<>(end1, 6));
                inputEvents.add(new StreamRecord<>(end2, 7));
                inputEvents.add(new StreamRecord<>(end3, 8));
                inputEvents.add(new StreamRecord<>(end4, 9));
    
                Pattern<Event, ?> pattern = 
Pattern.<Event>begin("start").where(new FilterFunction<Event>() {
                        private static final long serialVersionUID = 
5726188262756267490L;
    
                        @Override
                        public boolean filter(Event value) throws Exception {
                                return value.getName().equals("a");
                        }
                }).zeroOrMore();
    
                NFA<Event> nfa = NFACompiler.compile(pattern, 
Event.createTypeSerializer(), false);
    
                Set<Set<Event>> resultingPatterns = new HashSet<>();
                List<Collection<Event>> allPatterns = new ArrayList<>();
    
                for (StreamRecord<Event> inputEvent : inputEvents) {
                        Collection<Map<String, Event>> patterns = nfa.process(
                                        inputEvent.getValue(),
                                        inputEvent.getTimestamp()).f0;
    
                        for (Map<String, Event> foundPattern : patterns) {
                                System.out.println(foundPattern);
                        }
                }
        }
    ```


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to