You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by dianfu <gi...@git.apache.org> on 2017/07/28 12:52:37 UTC

[GitHub] flink pull request #4418: [FLINK-7293] [cep] Support custom order by in Patt...

GitHub user dianfu opened a pull request:

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

    [FLINK-7293] [cep] Support custom order by in PatternStream

    *Thank you very much for contributing to Apache Flink - we are happy that you want to help us improve Flink. To help the community review your contribution in the best possible way, please go through the checklist below, which will get the contribution into a shape in which it can be best reviewed.*
    
    *Please understand that we do not do this to make contributions to Flink a hassle. In order to uphold a high standard of quality for code contributions, while at the same time managing a large number of contributions, we need contributors to prepare the contributions well, and give reviewers enough contextual information for the review. Please also understand that contributions that do not follow this guide will take longer to review and thus typically be picked up with lower priority by the community.*
    
    ## Contribution Checklist
    
      - Make sure that the pull request corresponds to a [JIRA issue](https://issues.apache.org/jira/projects/FLINK/issues). Exceptions are made for typos in JavaDoc or documentation files, which need no JIRA issue.
      
      - Name the pull request in the form "[FLINK-1234] [component] Title of the pull request", where *FLINK-1234* should be replaced by the actual issue number. Skip *component* if you are unsure about which is the best component.
      Typo fixes that have no associated JIRA issue should be named following this pattern: `[hotfix] [docs] Fix typo in event time introduction` or `[hotfix] [javadocs] Expand JavaDoc for PuncuatedWatermarkGenerator`.
    
      - Fill out the template below to describe the changes contributed by the pull request. That will give reviewers the context they need to do the review.
      
      - Make sure that the change passes the automated tests, i.e., `mvn clean verify` passes. You can set up Travis CI to do that following [this guide](http://flink.apache.org/contribute-code.html#best-practices).
    
      - Each pull request should address only one issue, not mix up code from multiple issues.
      
      - Each commit in the pull request has a meaningful commit message (including the JIRA id)
    
      - Once all items of the checklist are addressed, remove the above text and this checklist, leaving only the filled out template below.
    
    
    **(The sections below can be removed for hotfixes of typos)**
    
    ## What is the purpose of the change
    
    *(For example: This pull request makes task deployment go through the blob server, rather than through RPC. That way we avoid re-transferring them on each deployment (during recovery).)*
    
    
    ## Brief change log
    
    *(for example:)*
      - *The TaskInfo is stored in the blob store on job creation time as a persistent artifact*
      - *Deployments RPC transmits only the blob storage reference*
      - *TaskManagers retrieve the TaskInfo from the blob cache*
    
    
    ## Verifying this change
    
    *(Please pick either of the following options)*
    
    This change is a trivial rework / code cleanup without any test coverage.
    
    *(or)*
    
    This change is already covered by existing tests, such as *(please describe tests)*.
    
    *(or)*
    
    This change added tests and can be verified as follows:
    
    *(example:)*
      - *Added integration tests for end-to-end deployment with large payloads (100MB)*
      - *Extended integration test for recovery after master (JobManager) failure*
      - *Added test that validates that TaskInfo is transferred only once across recoveries*
      - *Manually verified the change by running a 4 node cluser with 2 JobManagers and 4 TaskManagers, a stateful streaming program, and killing one JobManager and two TaskManagers during the execution, verifying that recovery happens correctly.*
    
    ## Does this pull request potentially affect one of the following parts:
    
      - Dependencies (does it add or upgrade a dependency): (yes / no)
      - The public API, i.e., is any changed class annotated with `@Public(Evolving)`: (yes / no)
      - The serializers: (yes / no / don't know)
      - The runtime per-record code paths (performance sensitive): (yes / no / don't know)
      - Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Yarn/Mesos, ZooKeeper: (yes / no / don't know)
    
    ## Documentation
    
      - Does this pull request introduce a new feature? (yes / no)
      - If yes, how is the feature documented? (not applicable / docs / JavaDocs / not documented)
    


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

    $ git pull https://github.com/dianfu/flink support_comparator

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

    https://github.com/apache/flink/pull/4418.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 #4418
    
----
commit f08b42ecc4b213d74e015e221589c83229bc337c
Author: Dian Fu <fu...@alibaba-inc.com>
Date:   2017-07-28T12:51:06Z

    [FLINK-7293] [cep] Support custom order by in PatternStream

----


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink issue #4418: [FLINK-7293] [cep] Support custom order by in PatternStre...

Posted by kl0u <gi...@git.apache.org>.
Github user kl0u commented on the issue:

    https://github.com/apache/flink/pull/4418
  
    Hi @dianfu and @dawidwys. This PR is actually broken. 
    
    The reason is that the `comparator` in the `AbstractKeyedCEPPatternOperator` is not `serializable` so when Flink tries to ship the job to the cluster, it will fail with a `NotSerializableException`. 
    
    If you want to see that you can modify one of the IT cases in the `CEPITCase`, e.g. the `CEPITCase.testSimplePatternCEP()` and add a comparator in the `DataStream<String> result = CEP.pattern(input, pattern);`
    
    After this is fixed, then I have some more comments on the rest of the implementation:
    
    1) In the `AbstractKeyedCEPPatternOperator` we do not need a new state for the `bufferedEvents`. We can use the already existing `elementQueueState` and store the timestamps and the elements in the case of processing time, as done in event time. This will lead to better code re-use, as we will be able to use code from the event-time logic. In general, it would be nice to unify in the future the processing- and event-time code paths by also buffering elements and registering timers for processing time, as done in event time. This will also solve the issue of having to wait for the next element to arrive, before being able to emit a timed out pattern in processing time. BUT for this we will need to somehow let the user specify a parameter like the `watermark interval` in event-time, so it needs more discussion.
    
    2) Typo in the `CEPOperatorTest`: `getKeyedCepOpearatorWithComparator` -> `getKeyedCepOperatorWithComparator`


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink issue #4418: [FLINK-7293] [cep] Support custom order by in PatternStre...

Posted by dawidwys <gi...@git.apache.org>.
Github user dawidwys commented on the issue:

    https://github.com/apache/flink/pull/4418
  
    +1 from my side.
    
    Let's just wait a bit more to see if @kl0u wants to add some comments, as he commented on the JIRA.
    
    As a side note for the future, please fill in the new contribution checklist as it helps reviewing.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink pull request #4418: [FLINK-7293] [cep] Support custom order by in Patt...

Posted by dianfu <gi...@git.apache.org>.
Github user dianfu commented on a diff in the pull request:

    https://github.com/apache/flink/pull/4418#discussion_r130895852
  
    --- Diff: flink-libraries/flink-cep-scala/src/main/scala/org/apache/flink/cep/scala/CEP.scala ---
    @@ -36,8 +38,26 @@ object CEP {
         * @tparam T Type of the input events
         * @return Resulting pattern stream
         */
    -  def pattern[T](input: DataStream[T], pattern: Pattern[T, _]): PatternStream[T] = {
    +  def pattern[T](input: DataStream[T], pattern: Pattern[T, _ <: T]): PatternStream[T] = {
         wrapPatternStream(JCEP.pattern(input.javaStream, pattern.wrappedPattern))
       }
    +
    +  /**
    +    * Transforms a [[DataStream]] into a [[PatternStream]] in the Scala API.
    +    * See [[org.apache.flink.cep.CEP}]]for a more detailed description how the underlying
    +    * Java API works.
    +    *
    +    * @param input      DataStream containing the input events
    +    * @param pattern    Pattern specification which shall be detected
    +    * @param comparator Comparator to sort events
    --- End diff --
    
    Updated the doc.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink issue #4418: [FLINK-7293] [cep] Support custom order by in PatternStre...

Posted by dianfu <gi...@git.apache.org>.
Github user dianfu commented on the issue:

    https://github.com/apache/flink/pull/4418
  
    @dawidwys  Thanks a lot for your review. Have updated the PR.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink issue #4418: [FLINK-7293] [cep] Support custom order by in PatternStre...

Posted by kl0u <gi...@git.apache.org>.
Github user kl0u commented on the issue:

    https://github.com/apache/flink/pull/4418
  
    @dianfu Changes look good. +1 to merge


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink pull request #4418: [FLINK-7293] [cep] Support custom order by in Patt...

Posted by dianfu <gi...@git.apache.org>.
Github user dianfu commented on a diff in the pull request:

    https://github.com/apache/flink/pull/4418#discussion_r130895782
  
    --- Diff: flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/CEP.java ---
    @@ -38,4 +40,17 @@
     	public static <T> PatternStream<T> pattern(DataStream<T> input, Pattern<T, ?> pattern) {
     		return new PatternStream<>(input, pattern);
     	}
    +
    +	/**
    +	 * Creates a {@link PatternStream} from an input data stream and a pattern.
    +	 *
    +	 * @param input DataStream containing the input events
    +	 * @param pattern Pattern specification which shall be detected
    +	 * @param comparator Comparator to sort events
    --- End diff --
    
    Updated the doc.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink pull request #4418: [FLINK-7293] [cep] Support custom order by in Patt...

Posted by dawidwys <gi...@git.apache.org>.
Github user dawidwys commented on a diff in the pull request:

    https://github.com/apache/flink/pull/4418#discussion_r130564730
  
    --- Diff: flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/CEP.java ---
    @@ -38,4 +40,17 @@
     	public static <T> PatternStream<T> pattern(DataStream<T> input, Pattern<T, ?> pattern) {
     		return new PatternStream<>(input, pattern);
     	}
    +
    +	/**
    +	 * Creates a {@link PatternStream} from an input data stream and a pattern.
    +	 *
    +	 * @param input DataStream containing the input events
    +	 * @param pattern Pattern specification which shall be detected
    +	 * @param comparator Comparator to sort events
    --- End diff --
    
    could you describe in the doc when the operator is applied.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink pull request #4418: [FLINK-7293] [cep] Support custom order by in Patt...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

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


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink pull request #4418: [FLINK-7293] [cep] Support custom order by in Patt...

Posted by dawidwys <gi...@git.apache.org>.
Github user dawidwys commented on a diff in the pull request:

    https://github.com/apache/flink/pull/4418#discussion_r130818022
  
    --- Diff: flink-libraries/flink-cep/src/test/java/org/apache/flink/cep/operator/CEPOperatorTest.java ---
    @@ -923,6 +934,126 @@ public boolean filter(Event value) throws Exception {
     		}
     	}
     
    +	@Test
    +	public void testCEPOperatorComparatorProcessTime() throws Exception {
    +		Event startEvent1 = new Event(42, "start", 1.0);
    +		Event startEvent2 = new Event(42, "start", 2.0);
    +		SubEvent middleEvent1 = new SubEvent(42, "foo1", 3.0, 10.0);
    +		SubEvent middleEvent2 = new SubEvent(42, "foo2", 4.0, 10.0);
    +		Event endEvent1 = new Event(42, "end", 1.0);
    +
    +		Event startEventK2 = new Event(43, "start", 1.0);
    +
    +		KeyedCEPPatternOperator<Event, Integer> operator = getKeyedCepOpearatorWithComparator(true);
    +		OneInputStreamOperatorTestHarness<Event, Map<String, List<Event>>> harness = getCepTestHarness(operator);
    +
    +		try {
    +			harness.open();
    +
    +			harness.setProcessingTime(0L);
    +
    +			harness.processElement(new StreamRecord<>(startEvent1, 1L));
    --- End diff --
    
    Could you update the timestamps to the `0L`(the corresponding processing time)? I know it does not matter in `ProcessingTime`, but I think it will be easier to read that way. What do you think?


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink pull request #4418: [FLINK-7293] [cep] Support custom order by in Patt...

Posted by dawidwys <gi...@git.apache.org>.
Github user dawidwys commented on a diff in the pull request:

    https://github.com/apache/flink/pull/4418#discussion_r130564756
  
    --- Diff: flink-libraries/flink-cep-scala/src/main/scala/org/apache/flink/cep/scala/CEP.scala ---
    @@ -36,8 +38,26 @@ object CEP {
         * @tparam T Type of the input events
         * @return Resulting pattern stream
         */
    -  def pattern[T](input: DataStream[T], pattern: Pattern[T, _]): PatternStream[T] = {
    +  def pattern[T](input: DataStream[T], pattern: Pattern[T, _ <: T]): PatternStream[T] = {
         wrapPatternStream(JCEP.pattern(input.javaStream, pattern.wrappedPattern))
       }
    +
    +  /**
    +    * Transforms a [[DataStream]] into a [[PatternStream]] in the Scala API.
    +    * See [[org.apache.flink.cep.CEP}]]for a more detailed description how the underlying
    +    * Java API works.
    +    *
    +    * @param input      DataStream containing the input events
    +    * @param pattern    Pattern specification which shall be detected
    +    * @param comparator Comparator to sort events
    --- End diff --
    
    could you describe in the doc when the operator is applied.
    
    E.g the comparator is used for sorting events with the same timestamp in case of EventTime or that arrived at the same moment.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink issue #4418: [FLINK-7293] [cep] Support custom order by in PatternStre...

Posted by dianfu <gi...@git.apache.org>.
Github user dianfu commented on the issue:

    https://github.com/apache/flink/pull/4418
  
    @kl0u Good catch. Have updated the PR according to the comments.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink pull request #4418: [FLINK-7293] [cep] Support custom order by in Patt...

Posted by dianfu <gi...@git.apache.org>.
Github user dianfu commented on a diff in the pull request:

    https://github.com/apache/flink/pull/4418#discussion_r130896085
  
    --- Diff: flink-libraries/flink-cep/src/test/java/org/apache/flink/cep/operator/CEPOperatorTest.java ---
    @@ -923,6 +934,126 @@ public boolean filter(Event value) throws Exception {
     		}
     	}
     
    +	@Test
    +	public void testCEPOperatorComparatorProcessTime() throws Exception {
    +		Event startEvent1 = new Event(42, "start", 1.0);
    +		Event startEvent2 = new Event(42, "start", 2.0);
    +		SubEvent middleEvent1 = new SubEvent(42, "foo1", 3.0, 10.0);
    +		SubEvent middleEvent2 = new SubEvent(42, "foo2", 4.0, 10.0);
    +		Event endEvent1 = new Event(42, "end", 1.0);
    +
    +		Event startEventK2 = new Event(43, "start", 1.0);
    +
    +		KeyedCEPPatternOperator<Event, Integer> operator = getKeyedCepOpearatorWithComparator(true);
    +		OneInputStreamOperatorTestHarness<Event, Map<String, List<Event>>> harness = getCepTestHarness(operator);
    +
    +		try {
    +			harness.open();
    +
    +			harness.setProcessingTime(0L);
    +
    +			harness.processElement(new StreamRecord<>(startEvent1, 1L));
    --- End diff --
    
    Updated.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink pull request #4418: [FLINK-7293] [cep] Support custom order by in Patt...

Posted by dianfu <gi...@git.apache.org>.
Github user dianfu commented on a diff in the pull request:

    https://github.com/apache/flink/pull/4418#discussion_r130896153
  
    --- Diff: flink-libraries/flink-cep/src/test/java/org/apache/flink/cep/operator/CEPOperatorTest.java ---
    @@ -923,6 +934,126 @@ public boolean filter(Event value) throws Exception {
     		}
     	}
     
    +	@Test
    +	public void testCEPOperatorComparatorProcessTime() throws Exception {
    +		Event startEvent1 = new Event(42, "start", 1.0);
    +		Event startEvent2 = new Event(42, "start", 2.0);
    +		SubEvent middleEvent1 = new SubEvent(42, "foo1", 3.0, 10.0);
    +		SubEvent middleEvent2 = new SubEvent(42, "foo2", 4.0, 10.0);
    +		Event endEvent1 = new Event(42, "end", 1.0);
    +
    +		Event startEventK2 = new Event(43, "start", 1.0);
    +
    +		KeyedCEPPatternOperator<Event, Integer> operator = getKeyedCepOpearatorWithComparator(true);
    +		OneInputStreamOperatorTestHarness<Event, Map<String, List<Event>>> harness = getCepTestHarness(operator);
    +
    +		try {
    +			harness.open();
    +
    +			harness.setProcessingTime(0L);
    +
    +			harness.processElement(new StreamRecord<>(startEvent1, 1L));
    --- End diff --
    
    Updated


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink issue #4418: [FLINK-7293] [cep] Support custom order by in PatternStre...

Posted by dianfu <gi...@git.apache.org>.
Github user dianfu commented on the issue:

    https://github.com/apache/flink/pull/4418
  
    @dawidwys Updated the contribution checklist.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink pull request #4418: [FLINK-7293] [cep] Support custom order by in Patt...

Posted by dawidwys <gi...@git.apache.org>.
Github user dawidwys commented on a diff in the pull request:

    https://github.com/apache/flink/pull/4418#discussion_r130816980
  
    --- Diff: flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/operator/AbstractKeyedCEPPatternOperator.java ---
    @@ -257,7 +289,32 @@ public void onEventTime(InternalTimer<KEY, VoidNamespace> timer) throws Exceptio
     
     	@Override
     	public void onProcessingTime(InternalTimer<KEY, VoidNamespace> timer) throws Exception {
    -		// not used
    +		NFA<IN> nfa = getNFA();
    +
    +		// emit the events in order
    +		for (IN event : sort(bufferedEvents.get())) {
    +			processEvent(nfa, event, getProcessingTimeService().getCurrentProcessingTime());
    +		}
    +
    +		// remove all buffered rows
    +		bufferedEvents.clear();
    +
    +		updateNFA(nfa);
    +	}
    +
    +	private Iterable<IN> sort(Iterable<IN> iter) {
    +		if (comparator == null) {
    +			return iter;
    +		} else {
    +			// insert all events into the sort buffer
    +			List<IN> sortBuffer = new ArrayList<>();
    --- End diff --
    
    As we dropped support of Java 7, we could use `Stream` here. That way we won't need to create the temporary buffer.
    
    Sth like:
    
    	private Stream<IN> sort(Iterable<IN> iter) {
    		Stream<IN> stream = StreamSupport.stream(iter.spliterator(), false);
    		if (comparator == null) {
    			return stream;
    		} else {
    			return stream.sorted(comparator);
        }
    
    And use it like this:
    
    	sort(bufferedEvents.get()).forEachOrdered(
    		event -> processEvent(nfa, event, getProcessingTimeService().getCurrentProcessingTime())
    	);
    
    What do you think?


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink issue #4418: [FLINK-7293] [cep] Support custom order by in PatternStre...

Posted by dawidwys <gi...@git.apache.org>.
Github user dawidwys commented on the issue:

    https://github.com/apache/flink/pull/4418
  
    merging


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink pull request #4418: [FLINK-7293] [cep] Support custom order by in Patt...

Posted by dianfu <gi...@git.apache.org>.
Github user dianfu commented on a diff in the pull request:

    https://github.com/apache/flink/pull/4418#discussion_r130896034
  
    --- Diff: flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/operator/AbstractKeyedCEPPatternOperator.java ---
    @@ -257,7 +289,32 @@ public void onEventTime(InternalTimer<KEY, VoidNamespace> timer) throws Exceptio
     
     	@Override
     	public void onProcessingTime(InternalTimer<KEY, VoidNamespace> timer) throws Exception {
    -		// not used
    +		NFA<IN> nfa = getNFA();
    +
    +		// emit the events in order
    +		for (IN event : sort(bufferedEvents.get())) {
    +			processEvent(nfa, event, getProcessingTimeService().getCurrentProcessingTime());
    +		}
    +
    +		// remove all buffered rows
    +		bufferedEvents.clear();
    +
    +		updateNFA(nfa);
    +	}
    +
    +	private Iterable<IN> sort(Iterable<IN> iter) {
    +		if (comparator == null) {
    +			return iter;
    +		} else {
    +			// insert all events into the sort buffer
    +			List<IN> sortBuffer = new ArrayList<>();
    --- End diff --
    
    Good advice. Updated.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---