You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2020/02/27 10:16:08 UTC

[GitHub] [flink] shuai-xu opened a new pull request #11235: [FLINK-15980] fix that the notFollowedBy in the end of GroupPattern may be ignored

shuai-xu opened a new pull request #11235: [FLINK-15980] fix that the notFollowedBy in the end of GroupPattern may be ignored
URL: https://github.com/apache/flink/pull/11235
 
 
   
   
   ## What is the purpose of the change
   
   *This pull request fix that the notFollowedBy in the end of GroupPattern will be ignored when compiling.*
   
   
   ## Verifying this change
   
   This change added tests and can be verified as follows:
     - *Added test in NotPatternITCase
   
   ## Does this pull request potentially affect one of the following parts:
   
     - Dependencies (does it add or upgrade a dependency): (no)
     - The public API, i.e., is any changed class annotated with `@Public(Evolving)`: (no)
     - The serializers: (no)
     - The runtime per-record code paths (performance sensitive): (no)
     - Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Kubernetes/Yarn/Mesos, ZooKeeper: (no)
     - The S3 file system connector: (no)
   
   ## Documentation
   
     - Does this pull request introduce a new feature? (no)
     - If yes, how is the feature documented? (not applicable)
   

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [flink] StephanEwen commented on a change in pull request #11235: [FLINK-15980] fix that the notFollowedBy in the end of GroupPattern may be ignored

Posted by GitBox <gi...@apache.org>.
StephanEwen commented on a change in pull request #11235: [FLINK-15980] fix that the notFollowedBy in the end of GroupPattern may be ignored
URL: https://github.com/apache/flink/pull/11235#discussion_r386271750
 
 

 ##########
 File path: flink-libraries/flink-cep/src/test/java/org/apache/flink/cep/nfa/NotPatternITCase.java
 ##########
 @@ -980,6 +980,53 @@ public void testNotFollowedByBeforeZeroOrMoreCombinationsSkipTillAny() throws Ex
 		));
 	}
 
+	@Test
+	public void testNotFollowedByInTheEndOfGroupPattern() throws Exception {
+
+		List<StreamRecord<Event>> inputEvents = new ArrayList<>();
+
+		int i = 0;
+		inputEvents.add(new StreamRecord<>(NotFollowByData.A_1, i++));
+		inputEvents.add(new StreamRecord<>(NotFollowByData.C_1, i++));
+		inputEvents.add(new StreamRecord<>(NotFollowByData.B_1, i++));
+		inputEvents.add(new StreamRecord<>(NotFollowByData.A_1, i++));
+		inputEvents.add(new StreamRecord<>(NotFollowByData.B_2, i++));
+
+		Pattern<Event, ?> startPattern = Pattern
+				.<Event>begin("a").where(new SimpleCondition<Event>() {
+					private static final long serialVersionUID = 5726188262756267490L;
+
+					@Override
+					public boolean filter(Event value) throws Exception {
+						return value.getName().equals("a");
+					}
+				})
+				.notFollowedBy("not c").where(new SimpleCondition<Event>() {
+					private static final long serialVersionUID = 5726188262756267490L;
+
+					@Override
+					public boolean filter(Event value) throws Exception {
+						return value.getName().equals("c");
+					}
+				});
+
+		Pattern<Event, ?> pattern = Pattern.begin(startPattern).followedBy("b")
+				.where(new SimpleCondition<Event>() {
+					private static final long serialVersionUID = 5726188262756267490L;
+
+					@Override
+					public boolean filter(Event value) throws Exception {
+						return value.getName().equals("b");
+					}
+				});
+
+		NFA<Event> nfa = compile(pattern, false);
+
+		final List<List<Event>> matches = feedNFA(inputEvents, nfa);
+
+		comparePatterns(matches, Lists.<List<Event>>newArrayList(Lists.newArrayList(NotFollowByData.A_1, NotFollowByData.B_2)));
 
 Review comment:
   Would it be simpler to just use `new ArrayList<>(...)`?

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [flink] flinkbot edited a comment on issue #11235: [FLINK-15980] fix that the notFollowedBy in the end of GroupPattern may be ignored

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on issue #11235: [FLINK-15980] fix that the notFollowedBy in the end of GroupPattern may be ignored
URL: https://github.com/apache/flink/pull/11235#issuecomment-591902090
 
 
   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "77a1dad4a2ab2c832bd1c341baac3a94c432150f",
       "status" : "SUCCESS",
       "url" : "https://travis-ci.com/flink-ci/flink/builds/150812052",
       "triggerID" : "77a1dad4a2ab2c832bd1c341baac3a94c432150f",
       "triggerType" : "PUSH"
     }, {
       "hash" : "3359b4cc3ef957037bd3af725ef9250a2b3cec73",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "3359b4cc3ef957037bd3af725ef9250a2b3cec73",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 77a1dad4a2ab2c832bd1c341baac3a94c432150f Travis: [SUCCESS](https://travis-ci.com/flink-ci/flink/builds/150812052) 
   * 3359b4cc3ef957037bd3af725ef9250a2b3cec73 UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [flink] shuai-xu commented on a change in pull request #11235: [FLINK-15980] fix that the notFollowedBy in the end of GroupPattern may be ignored

Posted by GitBox <gi...@apache.org>.
shuai-xu commented on a change in pull request #11235: [FLINK-15980] fix that the notFollowedBy in the end of GroupPattern may be ignored
URL: https://github.com/apache/flink/pull/11235#discussion_r386905832
 
 

 ##########
 File path: flink-libraries/flink-cep/src/test/java/org/apache/flink/cep/nfa/NotPatternITCase.java
 ##########
 @@ -980,6 +980,53 @@ public void testNotFollowedByBeforeZeroOrMoreCombinationsSkipTillAny() throws Ex
 		));
 	}
 
+	@Test
+	public void testNotFollowedByInTheEndOfGroupPattern() throws Exception {
+
+		List<StreamRecord<Event>> inputEvents = new ArrayList<>();
+
+		int i = 0;
+		inputEvents.add(new StreamRecord<>(NotFollowByData.A_1, i++));
+		inputEvents.add(new StreamRecord<>(NotFollowByData.C_1, i++));
+		inputEvents.add(new StreamRecord<>(NotFollowByData.B_1, i++));
+		inputEvents.add(new StreamRecord<>(NotFollowByData.A_1, i++));
+		inputEvents.add(new StreamRecord<>(NotFollowByData.B_2, i++));
+
+		Pattern<Event, ?> startPattern = Pattern
+				.<Event>begin("a").where(new SimpleCondition<Event>() {
+					private static final long serialVersionUID = 5726188262756267490L;
+
+					@Override
+					public boolean filter(Event value) throws Exception {
+						return value.getName().equals("a");
+					}
+				})
+				.notFollowedBy("not c").where(new SimpleCondition<Event>() {
+					private static final long serialVersionUID = 5726188262756267490L;
 
 Review comment:
   OK

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [flink] flinkbot edited a comment on issue #11235: [FLINK-15980] fix that the notFollowedBy in the end of GroupPattern may be ignored

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on issue #11235: [FLINK-15980] fix that the notFollowedBy in the end of GroupPattern may be ignored
URL: https://github.com/apache/flink/pull/11235#issuecomment-591902090
 
 
   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "77a1dad4a2ab2c832bd1c341baac3a94c432150f",
       "status" : "DELETED",
       "url" : "https://travis-ci.com/flink-ci/flink/builds/150812052",
       "triggerID" : "77a1dad4a2ab2c832bd1c341baac3a94c432150f",
       "triggerType" : "PUSH"
     }, {
       "hash" : "3359b4cc3ef957037bd3af725ef9250a2b3cec73",
       "status" : "SUCCESS",
       "url" : "https://travis-ci.com/flink-ci/flink/builds/151515991",
       "triggerID" : "3359b4cc3ef957037bd3af725ef9250a2b3cec73",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 3359b4cc3ef957037bd3af725ef9250a2b3cec73 Travis: [SUCCESS](https://travis-ci.com/flink-ci/flink/builds/151515991) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [flink] flinkbot edited a comment on issue #11235: [FLINK-15980] fix that the notFollowedBy in the end of GroupPattern may be ignored

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on issue #11235: [FLINK-15980] fix that the notFollowedBy in the end of GroupPattern may be ignored
URL: https://github.com/apache/flink/pull/11235#issuecomment-591902090
 
 
   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "77a1dad4a2ab2c832bd1c341baac3a94c432150f",
       "status" : "PENDING",
       "url" : "https://travis-ci.com/flink-ci/flink/builds/150812052",
       "triggerID" : "77a1dad4a2ab2c832bd1c341baac3a94c432150f",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 77a1dad4a2ab2c832bd1c341baac3a94c432150f Travis: [PENDING](https://travis-ci.com/flink-ci/flink/builds/150812052) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [flink] StephanEwen commented on a change in pull request #11235: [FLINK-15980] fix that the notFollowedBy in the end of GroupPattern may be ignored

Posted by GitBox <gi...@apache.org>.
StephanEwen commented on a change in pull request #11235: [FLINK-15980] fix that the notFollowedBy in the end of GroupPattern may be ignored
URL: https://github.com/apache/flink/pull/11235#discussion_r386271501
 
 

 ##########
 File path: flink-libraries/flink-cep/src/test/java/org/apache/flink/cep/nfa/NotPatternITCase.java
 ##########
 @@ -980,6 +980,53 @@ public void testNotFollowedByBeforeZeroOrMoreCombinationsSkipTillAny() throws Ex
 		));
 	}
 
+	@Test
+	public void testNotFollowedByInTheEndOfGroupPattern() throws Exception {
+
+		List<StreamRecord<Event>> inputEvents = new ArrayList<>();
+
+		int i = 0;
+		inputEvents.add(new StreamRecord<>(NotFollowByData.A_1, i++));
+		inputEvents.add(new StreamRecord<>(NotFollowByData.C_1, i++));
+		inputEvents.add(new StreamRecord<>(NotFollowByData.B_1, i++));
+		inputEvents.add(new StreamRecord<>(NotFollowByData.A_1, i++));
+		inputEvents.add(new StreamRecord<>(NotFollowByData.B_2, i++));
+
+		Pattern<Event, ?> startPattern = Pattern
+				.<Event>begin("a").where(new SimpleCondition<Event>() {
+					private static final long serialVersionUID = 5726188262756267490L;
+
+					@Override
+					public boolean filter(Event value) throws Exception {
+						return value.getName().equals("a");
+					}
+				})
+				.notFollowedBy("not c").where(new SimpleCondition<Event>() {
+					private static final long serialVersionUID = 5726188262756267490L;
 
 Review comment:
   For tests, I think it is nicer to have a class-wise `@SuppressWarning("serial")` rather than having these IDs in every function.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [flink] shuai-xu commented on a change in pull request #11235: [FLINK-15980] fix that the notFollowedBy in the end of GroupPattern may be ignored

Posted by GitBox <gi...@apache.org>.
shuai-xu commented on a change in pull request #11235: [FLINK-15980] fix that the notFollowedBy in the end of GroupPattern may be ignored
URL: https://github.com/apache/flink/pull/11235#discussion_r386907011
 
 

 ##########
 File path: flink-libraries/flink-cep/src/test/java/org/apache/flink/cep/nfa/NotPatternITCase.java
 ##########
 @@ -980,6 +980,53 @@ public void testNotFollowedByBeforeZeroOrMoreCombinationsSkipTillAny() throws Ex
 		));
 	}
 
+	@Test
+	public void testNotFollowedByInTheEndOfGroupPattern() throws Exception {
+
+		List<StreamRecord<Event>> inputEvents = new ArrayList<>();
+
+		int i = 0;
+		inputEvents.add(new StreamRecord<>(NotFollowByData.A_1, i++));
+		inputEvents.add(new StreamRecord<>(NotFollowByData.C_1, i++));
+		inputEvents.add(new StreamRecord<>(NotFollowByData.B_1, i++));
+		inputEvents.add(new StreamRecord<>(NotFollowByData.A_1, i++));
+		inputEvents.add(new StreamRecord<>(NotFollowByData.B_2, i++));
+
+		Pattern<Event, ?> startPattern = Pattern
+				.<Event>begin("a").where(new SimpleCondition<Event>() {
+					private static final long serialVersionUID = 5726188262756267490L;
+
+					@Override
+					public boolean filter(Event value) throws Exception {
+						return value.getName().equals("a");
+					}
+				})
+				.notFollowedBy("not c").where(new SimpleCondition<Event>() {
+					private static final long serialVersionUID = 5726188262756267490L;
+
+					@Override
+					public boolean filter(Event value) throws Exception {
+						return value.getName().equals("c");
+					}
+				});
+
+		Pattern<Event, ?> pattern = Pattern.begin(startPattern).followedBy("b")
+				.where(new SimpleCondition<Event>() {
+					private static final long serialVersionUID = 5726188262756267490L;
+
+					@Override
+					public boolean filter(Event value) throws Exception {
+						return value.getName().equals("b");
+					}
+				});
+
+		NFA<Event> nfa = compile(pattern, false);
+
+		final List<List<Event>> matches = feedNFA(inputEvents, nfa);
+
+		comparePatterns(matches, Lists.<List<Event>>newArrayList(Lists.newArrayList(NotFollowByData.A_1, NotFollowByData.B_2)));
 
 Review comment:
   It seems that ArrayList has no constructor for multi elements. So it has to be multi lines to use `new ArrayList<>()`

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [flink] flinkbot edited a comment on issue #11235: [FLINK-15980] fix that the notFollowedBy in the end of GroupPattern may be ignored

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on issue #11235: [FLINK-15980] fix that the notFollowedBy in the end of GroupPattern may be ignored
URL: https://github.com/apache/flink/pull/11235#issuecomment-591902090
 
 
   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "77a1dad4a2ab2c832bd1c341baac3a94c432150f",
       "status" : "SUCCESS",
       "url" : "https://travis-ci.com/flink-ci/flink/builds/150812052",
       "triggerID" : "77a1dad4a2ab2c832bd1c341baac3a94c432150f",
       "triggerType" : "PUSH"
     }, {
       "hash" : "3359b4cc3ef957037bd3af725ef9250a2b3cec73",
       "status" : "PENDING",
       "url" : "https://travis-ci.com/flink-ci/flink/builds/151515991",
       "triggerID" : "3359b4cc3ef957037bd3af725ef9250a2b3cec73",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 77a1dad4a2ab2c832bd1c341baac3a94c432150f Travis: [SUCCESS](https://travis-ci.com/flink-ci/flink/builds/150812052) 
   * 3359b4cc3ef957037bd3af725ef9250a2b3cec73 Travis: [PENDING](https://travis-ci.com/flink-ci/flink/builds/151515991) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [flink] flinkbot commented on issue #11235: [FLINK-15980] fix that the notFollowedBy in the end of GroupPattern may be ignored

Posted by GitBox <gi...@apache.org>.
flinkbot commented on issue #11235: [FLINK-15980] fix that the notFollowedBy in the end of GroupPattern may be ignored
URL: https://github.com/apache/flink/pull/11235#issuecomment-591894057
 
 
   Thanks a lot for your contribution to the Apache Flink project. I'm the @flinkbot. I help the community
   to review your pull request. We will use this comment to track the progress of the review.
   
   
   ## Automated Checks
   Last check on commit 77a1dad4a2ab2c832bd1c341baac3a94c432150f (Thu Feb 27 10:22:21 UTC 2020)
   
   **Warnings:**
    * No documentation files were touched! Remember to keep the Flink docs up to date!
   
   
   <sub>Mention the bot in a comment to re-run the automated checks.</sub>
   ## Review Progress
   
   * ❓ 1. The [description] looks good.
   * ❓ 2. There is [consensus] that the contribution should go into to Flink.
   * ❓ 3. Needs [attention] from.
   * ❓ 4. The change fits into the overall [architecture].
   * ❓ 5. Overall code [quality] is good.
   
   Please see the [Pull Request Review Guide](https://flink.apache.org/contributing/reviewing-prs.html) for a full explanation of the review process.<details>
    The Bot is tracking the review progress through labels. Labels are applied according to the order of the review items. For consensus, approval by a Flink committer of PMC member is required <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot approve description` to approve one or more aspects (aspects: `description`, `consensus`, `architecture` and `quality`)
    - `@flinkbot approve all` to approve all aspects
    - `@flinkbot approve-until architecture` to approve everything until `architecture`
    - `@flinkbot attention @username1 [@username2 ..]` to require somebody's attention
    - `@flinkbot disapprove architecture` to remove an approval you gave earlier
   </details>

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [flink] flinkbot commented on issue #11235: [FLINK-15980] fix that the notFollowedBy in the end of GroupPattern may be ignored

Posted by GitBox <gi...@apache.org>.
flinkbot commented on issue #11235: [FLINK-15980] fix that the notFollowedBy in the end of GroupPattern may be ignored
URL: https://github.com/apache/flink/pull/11235#issuecomment-591902090
 
 
   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "77a1dad4a2ab2c832bd1c341baac3a94c432150f",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "77a1dad4a2ab2c832bd1c341baac3a94c432150f",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 77a1dad4a2ab2c832bd1c341baac3a94c432150f UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [flink] flinkbot edited a comment on issue #11235: [FLINK-15980] fix that the notFollowedBy in the end of GroupPattern may be ignored

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on issue #11235: [FLINK-15980] fix that the notFollowedBy in the end of GroupPattern may be ignored
URL: https://github.com/apache/flink/pull/11235#issuecomment-591902090
 
 
   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "77a1dad4a2ab2c832bd1c341baac3a94c432150f",
       "status" : "SUCCESS",
       "url" : "https://travis-ci.com/flink-ci/flink/builds/150812052",
       "triggerID" : "77a1dad4a2ab2c832bd1c341baac3a94c432150f",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 77a1dad4a2ab2c832bd1c341baac3a94c432150f Travis: [SUCCESS](https://travis-ci.com/flink-ci/flink/builds/150812052) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services