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

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

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

    https://github.com/apache/flink/pull/2301#discussion_r72416957
  
    --- Diff: 
flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/WindowOperatorTest.java
 ---
    @@ -2003,6 +2048,53 @@ public void apply(String key,
     
        }
     
    +   public static class RichSumReducerWithEventTime<W extends Window> 
extends RichWindowFunction<Tuple2<String, Integer>, Tuple2<String, Integer>, 
String, W>
    +           implements EventTimeFunction<String, W> {
    +           private static final long serialVersionUID = 1L;
    +
    +           private boolean openCalled = false;
    +           private static int count = 0;
    +           @Override
    +           public void open(Configuration parameters) throws Exception {
    +                   super.open(parameters);
    +                   openCalled = true;
    +           }
    +
    +           @Override
    +           public void close() throws Exception {
    +                   super.close();
    +                   closeCalled.incrementAndGet();
    +           }
    +
    +           @Override
    +           public void apply(String key,
    +                                             W window,
    +                                             Iterable<Tuple2<String, 
Integer>> input,
    --- End diff --
    
    this _should_ fail checkstyle, as the indentation is partly done with 
spaces. we only use tabs.


> Add an interface for EventTime aware User Function
> --------------------------------------------------
>
>                 Key: FLINK-3674
>                 URL: https://issues.apache.org/jira/browse/FLINK-3674
>             Project: Flink
>          Issue Type: New Feature
>          Components: Streaming
>    Affects Versions: 1.0.0
>            Reporter: Stephan Ewen
>            Assignee: ramkrishna.s.vasudevan
>
> I suggest to add an interface that UDFs can implement, which will let them be 
> notified upon watermark updates.
> Example usage:
> {code}
> public interface EventTimeFunction {
>     void onWatermark(Watermark watermark);
> }
> public class MyMapper implements MapFunction<String, String>, 
> EventTimeFunction {
>     private long currentEventTime = Long.MIN_VALUE;
>     public String map(String value) {
>         return value + " @ " + currentEventTime;
>     }
>     public void onWatermark(Watermark watermark) {
>         currentEventTime = watermark.getTimestamp();
>     }
> }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to