flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From casidiablo <...@git.apache.org>
Subject [GitHub] flink pull request #5073: [FLINK-8124] Make Trigger implementations more gen...
Date Sun, 26 Nov 2017 16:54:57 GMT
GitHub user casidiablo opened a pull request:

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

    [FLINK-8124] Make Trigger implementations more generic

    # What is the purpose of the change
    
    Flink provides implementations of the `Trigger<T, W extend Window>` class that are
unnecessarily
    specific. `EventTimeTrigger`, for instance, extends `Trigger<Object, TimeWindow>`.
    
    Since most window assigners provided also implement `WindowAssigner<Object, TimeWindow>`
this
    is usually not a problem. However, when implementing custom `WindowAssigner` it could
be problematic:
    
    ```java
    public class CustomWindowAssigner extends WindowAssigner<SomePojo, AnotherWindowImpl>
{
        ...
    
    	@Override
    	public Trigger<SomePojo, AnotherWindowImpl> getDefaultTrigger(StreamExecutionEnvironment
env) {
    		return EventTimeTrigger.create(); // compiler complains about typing
    	}
    
        ...
    }
    ```
    
    ## Brief change log
    
    This commit makes `Trigger` implementations generic, keeping them compatible with the
current
    windowing implementations as well as custom ones.
    
      - `EventTimeTrigger<T, W extends Window>`
      - `ProcessingTimeTrigger<T, W extends Window>`
      - `ContinuousEventTimeTrigger<T, W extends Window>`
      - `ContinuousProcessingTimeTrigger<T, W extends Window>`
      - `CountTrigger<T, W extends Window>`
    
    ## Verifying this change
    
    This change is already covered by existing tests, such as `WindowTranslationTest` or `DataStreamTest`.
    
    ## 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)`: yes
      - The serializers: no
      - The runtime per-record code paths (performance sensitive): no
      - Anything that affects deployment or recovery: JobManager (and its components), Checkpointing,
Yarn/Mesos, ZooKeeper: no
      - The S3 file system connector: no
    
    ## Documentation
    
      - Does this pull request introduce a new feature? no


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

    $ git pull https://github.com/casidiablo/flink generic-triggers

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

    https://github.com/apache/flink/pull/5073.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 #5073
    
----
commit 12abf2d9b7c8d68991aad4e05683744bc3ed7a33
Author: Cristian <me@cristian.io>
Date:   2017-11-26T14:50:44Z

    [FLINK-8124] Make Trigger implementations more generic
    
    Flink provides implementations of the `Trigger<T, W extend Window>` class that are
unnecessarily
    specific. `EventTimeTrigger`, for instance, extends `Trigger<Object, TimeWindow>`.
    
    Since most window assigners provided also implement `WindowAssigner<Object, TimeWindow>`
this
    is usually not a problem. However, when implementing custom `WindowAssigner` it could
be problematic:
    
    ```java
    public class CustomWindowAssigner extends WindowAssigner<SomePojo, AnotherWindowImpl>
{
        ...
    
    	@Override
    	public Trigger<SomePojo, AnotherWindowImpl> getDefaultTrigger(StreamExecutionEnvironment
env) {
    		return EventTimeTrigger.create(); // compiler complains about typing
    	}
    
        ...
    }
    ```
    
    This commit makes `Trigger` implementations generic, keeping them compatible with the
current
    windowing implementations as well as custom ones.

----


---

Mime
View raw message