[ 
https://issues.apache.org/jira/browse/FLINK-5871?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15882416#comment-15882416
 ] 

ASF GitHub Bot commented on FLINK-5871:
---------------------------------------

Github user kl0u commented on a diff in the pull request:

    https://github.com/apache/flink/pull/3381#discussion_r102916874
  
    --- Diff: 
flink-libraries/flink-cep/src/test/java/org/apache/flink/cep/nfa/compiler/NFACompilerTest.java
 ---
    @@ -42,6 +45,43 @@
     
     public class NFACompilerTest extends TestLogger {
     
    +   @Rule
    +   public ExpectedException expectedException = ExpectedException.none();
    +
    +   @Test
    +   public void testNFACompilerUniquePatternName() {
    +
    +           // adjust the rule
    +           expectedException.expect(MalformedPatternException.class);
    +           expectedException.expectMessage("Duplicate pattern name: start. 
Pattern names must be unique.");
    +
    +           Pattern<Event, ?> invalidPattern = 
Pattern.<Event>begin("start").where(new FilterFunction<Event>() {
    +                   private static final long serialVersionUID = 
-3863103355752267133L;
    +
    +                   @Override
    +                   public boolean filter(Event value) throws Exception {
    +                           return value.getName().equals("start");
    +                   }
    +           }).followedBy("middle").subtype(SubEvent.class).where(new 
FilterFunction<SubEvent>() {
    +                   private static final long serialVersionUID = 
-1413973420880409702L;
    +
    +                   @Override
    +                   public boolean filter(SubEvent value) throws Exception {
    +                           return value.getVolume() > 10.0;
    +                   }
    +           }).followedBy("start").subtype(SubEvent.class).where(new 
FilterFunction<SubEvent>() {
    +                   private static final long serialVersionUID = 
-1413973420880409702L;
    +
    +                   @Override
    +                   public boolean filter(SubEvent value) throws Exception {
    +                           return value.getVolume() > 11.0;
    +                   }
    +           }).within(Time.milliseconds(10));
    --- End diff --
    
    Thanks for the review @tillrohrmann . I just had a question about one of 
your comments.


> Enforce uniqueness of pattern names in CEP.
> -------------------------------------------
>
>                 Key: FLINK-5871
>                 URL: https://issues.apache.org/jira/browse/FLINK-5871
>             Project: Flink
>          Issue Type: Bug
>          Components: CEP
>    Affects Versions: 1.3.0
>            Reporter: Kostas Kloudas
>            Assignee: Kostas Kloudas
>              Labels: cep
>             Fix For: 1.3.0
>
>
> Currently, although required, the {{NFACompiler}} does not impose uniqueness 
> of the chosen pattern names. This issue addresses that, and the proposed 
> strategy is to throw an exception whenever a malformed pattern like this is 
> encountered.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to