sunsence edited a comment on issue #6124: [FLINK-8914][CEP]Fix wrong semantic 
when greedy pattern is the head of the pattern
URL: https://github.com/apache/flink/pull/6124#issuecomment-469992799
 
 
   @dawidwys The proper AfterMatchSkip strategy can only work on some 
situations, such as 
   
   `List<String> strings = Arrays.asList("1,3,5,5,5,5,1,6,".split(","));
   
           DataStream<String> input = env.fromCollection(strings);
   
           Pattern<String, ?> pattern = Pattern.<String>
                   begin("start", 
AfterMatchSkipStrategy.skipPastLastEvent()).where(new SimpleCondition<String>() 
{
               @Override
               public boolean filter(String value) {
                   return value.equals("5");
               }
           }).oneOrMore()
                   .followedBy("end").where(new SimpleCondition<String>() {
   
                       @Override
                       public boolean filter(String value) {
                           return value.equals("6");
                       }
                   });`
   
   The output is :
   **=======
   5
   5
   5
   5
   6
   =======**
   
   While ,when I have only one pattern,it doesn't work fine.
   
   
   ` List<String> strings = Arrays.asList("1,3,5,5,5,5,1,6,".split(","));
   
           DataStream<String> input = env.fromCollection(strings);
   
           Pattern<String, ?> pattern = Pattern.<String>
                   begin("start", 
AfterMatchSkipStrategy.skipPastLastEvent()).where(new SimpleCondition<String>() 
{
               @Override
               public boolean filter(String value) {
                   return value.equals("5");
               }
           }).oneOrMore().greedy()`
   
   The output is :
   =======
   5
   ======
   =======
   5
   ======
   =======
   5
   ======
   =======
   5
   ======
   
   
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to