Uploaded image for project: 'Flink'
  1. Flink
  2. FLINK-6609

Wrong version assignment when multiple TAKEs transitions

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: 1.3.0
    • Fix Version/s: 1.3.0
    • Component/s: CEP
    • Labels:
      None

      Description

      This test fails due to wrong version assignment for TAKEs from the same state.

      @Test
      	public void testMultipleTakesVersionCollision() {
      		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(41, "a", 3.0);
      		Event middleEvent3 = new Event(41, "a", 4.0);
      		Event middleEvent4 = new Event(41, "a", 5.0);
      		Event middleEvent5 = new Event(41, "a", 6.0);
      		Event end = new Event(44, "b", 5.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<>(middleEvent4, 6));
      		inputEvents.add(new StreamRecord<>(middleEvent5, 7));
      		inputEvents.add(new StreamRecord<>(end, 10));
      
      		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("middle1").where(new SimpleCondition<Event>() {
      			private static final long serialVersionUID = 5726188262756267490L;
      
      			@Override
      			public boolean filter(Event value) throws Exception {
      				return value.getName().equals("a");
      			}
      		}).oneOrMore().allowCombinations().followedBy("middle2").where(new SimpleCondition<Event>() {
      			private static final long serialVersionUID = 5726188262756267490L;
      
      			@Override
      			public boolean filter(Event value) throws Exception {
      				return value.getName().equals("a");
      			}
      		}).oneOrMore().allowCombinations().followedBy("end").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 = NFACompiler.compile(pattern, Event.createTypeSerializer(), false);
      
      		final List<List<Event>> resultingPatterns = feedNFA(inputEvents, nfa);
      
      		compareMaps(resultingPatterns, Lists.newArrayList(
      
      			Lists.newArrayList(startEvent, middleEvent1, middleEvent2, middleEvent3, middleEvent4, middleEvent5, end),
      			Lists.newArrayList(startEvent, middleEvent1, middleEvent2, middleEvent3, middleEvent4, middleEvent5, end),
      			Lists.newArrayList(startEvent, middleEvent1, middleEvent2, middleEvent3, middleEvent4, middleEvent5, end),
      			Lists.newArrayList(startEvent, middleEvent1, middleEvent2, middleEvent3, middleEvent4, middleEvent5, end),
      
      			Lists.newArrayList(startEvent, middleEvent1, middleEvent2, middleEvent3, middleEvent4, end),
      			Lists.newArrayList(startEvent, middleEvent1, middleEvent2, middleEvent4, middleEvent5, end),
      			Lists.newArrayList(startEvent, middleEvent1, middleEvent2, middleEvent3, middleEvent4, end),
      			Lists.newArrayList(startEvent, middleEvent1, middleEvent2, middleEvent3, middleEvent5, end),
      			Lists.newArrayList(startEvent, middleEvent1, middleEvent3, middleEvent4, middleEvent5, end),
      			Lists.newArrayList(startEvent, middleEvent1, middleEvent3, middleEvent4, middleEvent5, end),
      			Lists.newArrayList(startEvent, middleEvent1, middleEvent2, middleEvent3, middleEvent4, end),
      			Lists.newArrayList(startEvent, middleEvent1, middleEvent2, middleEvent3, middleEvent5, end),
      			Lists.newArrayList(startEvent, middleEvent1, middleEvent2, middleEvent4, middleEvent5, end),
      
      			Lists.newArrayList(startEvent, middleEvent1, middleEvent2, middleEvent3, end),
      			Lists.newArrayList(startEvent, middleEvent1, middleEvent3, middleEvent4, end),
      			Lists.newArrayList(startEvent, middleEvent1, middleEvent4, middleEvent5, end),
      			Lists.newArrayList(startEvent, middleEvent1, middleEvent2, middleEvent3, end),
      			Lists.newArrayList(startEvent, middleEvent1, middleEvent2, middleEvent4, end),
      			Lists.newArrayList(startEvent, middleEvent1, middleEvent2, middleEvent5, end),
      
      			Lists.newArrayList(startEvent, middleEvent1, middleEvent2, end)
      			));
      	}
      

        Issue Links

          Activity

          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user dawidwys closed the pull request at:

          https://github.com/apache/flink/pull/3927

          Show
          githubbot ASF GitHub Bot added a comment - Github user dawidwys closed the pull request at: https://github.com/apache/flink/pull/3927
          Hide
          kkl0u Kostas Kloudas added a comment -

          Fixed on master with 00ce3f1b12c7d7bf996d5f91bf006f0e18a719e7

          Show
          kkl0u Kostas Kloudas added a comment - Fixed on master with 00ce3f1b12c7d7bf996d5f91bf006f0e18a719e7
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user kl0u commented on the issue:

          https://github.com/apache/flink/pull/3927

          @dawidwys thanks a lot for the work! I merged it on the master and the 1.3 release. Could you close this PR and the related JIRA?

          Show
          githubbot ASF GitHub Bot added a comment - Github user kl0u commented on the issue: https://github.com/apache/flink/pull/3927 @dawidwys thanks a lot for the work! I merged it on the master and the 1.3 release. Could you close this PR and the related JIRA?
          Hide
          githubbot ASF GitHub Bot added a comment -

          GitHub user dawidwys opened a pull request:

          https://github.com/apache/flink/pull/3927

          FLINK-6609 Wrong version assignment when multiple TAKEs transitions

          Thanks for contributing to Apache Flink. Before you open your pull request, please take the following check list into consideration.
          If your changes take all of the items into account, feel free to open your pull request. For more information and/or questions please refer to the [How To Contribute guide](http://flink.apache.org/how-to-contribute.html).
          In addition to going through the list, please provide a meaningful description of your changes.

          • [ ] General
          • The pull request references the related JIRA issue ("[FLINK-XXX] Jira title text")
          • The pull request addresses only one issue
          • Each commit in the PR has a meaningful commit message (including the JIRA id)
          • [ ] Documentation
          • Documentation has been added for new functionality
          • Old documentation affected by the pull request has been updated
          • JavaDoc for public methods has been added
          • [ ] Tests & Build
          • Functionality added by the pull request is covered by tests
          • `mvn clean verify` has been executed successfully locally or a Travis build has passed

          You can merge this pull request into a Git repository by running:

          $ git pull https://github.com/dawidwys/flink cep-version-bug

          Alternatively you can review and apply these changes as the patch at:

          https://github.com/apache/flink/pull/3927.patch

          To close this pull request, make a commit to your master/trunk branch
          with (at least) the following in the commit message:

          This closes #3927


          commit 1bda80636691fb094aef7c5872dc916aa5c6130e
          Author: kl0u <kkloudas@gmail.com>
          Date: 2017-05-05T11:55:07Z

          FLINK-6371 [cep] NFA return matched patterns as Map<String, List<T>>.

          commit 7afd74948acddbca007630f28f47af36e606e52e
          Author: kl0u <kkloudas@gmail.com>
          Date: 2017-05-11T09:39:00Z

          FLINK-6536 [cep] Improve error message in SharedBuffer::put().

          commit efe0c63d57693ca586bfc83b079f6550a8a08477
          Author: kl0u <kkloudas@gmail.com>
          Date: 2017-05-12T14:01:38Z

          FLINK-6255 [cep] Remove PatternStream.getSideOutput().

          commit 4dc8113f5a83d1464e007ff613603c5569bac864
          Author: kkloudas <kkloudas@gmail.com>
          Date: 2017-05-15T12:33:09Z

          FLINK-6578 [cep] Fix self-loop handling in SharedBuffer.

          commit 3a421f97120c4fe6a6d8640f59953203a1d9d4e6
          Author: kkloudas <kkloudas@gmail.com>
          Date: 2017-05-15T12:49:00Z

          [hotfix] [cep] Remove unused keySelector in operator.

          commit ff965e87b55ac7aa9806c4abff66cc34a34addf7
          Author: kkloudas <kkloudas@gmail.com>
          Date: 2017-05-16T15:07:29Z

          FLINK-6604 [cep] Remove java serialization from the library.

          commit 8313e0eb424ed1258ac5632313b2312353e7ce9e
          Author: Dawid Wysakowicz <dawid@getindata.com>
          Date: 2017-05-17T07:16:08Z

          FLINK-6609 Wrong version assignment when multiple TAKEs transitions


          Show
          githubbot ASF GitHub Bot added a comment - GitHub user dawidwys opened a pull request: https://github.com/apache/flink/pull/3927 FLINK-6609 Wrong version assignment when multiple TAKEs transitions Thanks for contributing to Apache Flink. Before you open your pull request, please take the following check list into consideration. If your changes take all of the items into account, feel free to open your pull request. For more information and/or questions please refer to the [How To Contribute guide] ( http://flink.apache.org/how-to-contribute.html ). In addition to going through the list, please provide a meaningful description of your changes. [ ] General The pull request references the related JIRA issue (" [FLINK-XXX] Jira title text") The pull request addresses only one issue Each commit in the PR has a meaningful commit message (including the JIRA id) [ ] Documentation Documentation has been added for new functionality Old documentation affected by the pull request has been updated JavaDoc for public methods has been added [ ] Tests & Build Functionality added by the pull request is covered by tests `mvn clean verify` has been executed successfully locally or a Travis build has passed You can merge this pull request into a Git repository by running: $ git pull https://github.com/dawidwys/flink cep-version-bug Alternatively you can review and apply these changes as the patch at: https://github.com/apache/flink/pull/3927.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #3927 commit 1bda80636691fb094aef7c5872dc916aa5c6130e Author: kl0u <kkloudas@gmail.com> Date: 2017-05-05T11:55:07Z FLINK-6371 [cep] NFA return matched patterns as Map<String, List<T>>. commit 7afd74948acddbca007630f28f47af36e606e52e Author: kl0u <kkloudas@gmail.com> Date: 2017-05-11T09:39:00Z FLINK-6536 [cep] Improve error message in SharedBuffer::put(). commit efe0c63d57693ca586bfc83b079f6550a8a08477 Author: kl0u <kkloudas@gmail.com> Date: 2017-05-12T14:01:38Z FLINK-6255 [cep] Remove PatternStream.getSideOutput(). commit 4dc8113f5a83d1464e007ff613603c5569bac864 Author: kkloudas <kkloudas@gmail.com> Date: 2017-05-15T12:33:09Z FLINK-6578 [cep] Fix self-loop handling in SharedBuffer. commit 3a421f97120c4fe6a6d8640f59953203a1d9d4e6 Author: kkloudas <kkloudas@gmail.com> Date: 2017-05-15T12:49:00Z [hotfix] [cep] Remove unused keySelector in operator. commit ff965e87b55ac7aa9806c4abff66cc34a34addf7 Author: kkloudas <kkloudas@gmail.com> Date: 2017-05-16T15:07:29Z FLINK-6604 [cep] Remove java serialization from the library. commit 8313e0eb424ed1258ac5632313b2312353e7ce9e Author: Dawid Wysakowicz <dawid@getindata.com> Date: 2017-05-17T07:16:08Z FLINK-6609 Wrong version assignment when multiple TAKEs transitions

            People

            • Assignee:
              dawidwys Dawid Wysakowicz
              Reporter:
              dawidwys Dawid Wysakowicz
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development