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

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

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

    https://github.com/apache/flink/pull/5481#discussion_r168121129
  
    --- Diff: 
flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/KeyedProcessOperatorTest.java
 ---
    @@ -397,17 +396,16 @@ public void processElement(Integer value, Context 
ctx, Collector<String> out) th
                }
     
                @Override
    -           public void onTimer(
    -                           long timestamp,
    -                           OnTimerContext ctx,
    -                           Collector<String> out) throws Exception {
    +           public void onTimer(long timestamp, OnTimerContext ctx, 
Collector<String> out) throws Exception {
                }
        }
     
        private static class TriggeringFlatMapFunction extends 
ProcessFunction<Integer, Integer> {
     
                private static final long serialVersionUID = 1L;
     
    +           static final int TEST_VALUE = 17;
    +
                private final TimeDomain timeDomain;
     
                public TriggeringFlatMapFunction(TimeDomain timeDomain) {
    --- End diff --
    
    rename `timeDomain` -> `expectedTimeDomain` and add `expectedKey` and add 
assertion for the expected key to `onTimer()` method triggered both in 
`KeyedProcessOperatorTest#testEventTimeTimers` and 
`KeyedProcessOperatorTest#testProcessingTimeTimers`


> Access to the current key in ProcessFunction#OnTimerContext after keyBy()
> -------------------------------------------------------------------------
>
>                 Key: FLINK-8560
>                 URL: https://issues.apache.org/jira/browse/FLINK-8560
>             Project: Flink
>          Issue Type: Improvement
>          Components: DataStream API
>    Affects Versions: 1.4.0
>            Reporter: Jürgen Thomann
>            Assignee: Bowen Li
>            Priority: Major
>             Fix For: 1.5.0
>
>
> Currently it is required to store the key of a keyBy() in the processElement 
> method to have access to it in the OnTimerContext.
> This is not so good as you have to check in the processElement method for 
> every element if the key is already stored and set it if it's not already set.
> A possible solution would adding OnTimerContext#getCurrentKey() or a similar 
> method. Maybe having it in the open() method could maybe work as well.
> http://apache-flink-user-mailing-list-archive.2336050.n4.nabble.com/Getting-Key-from-keyBy-in-ProcessFunction-tt18126.html



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to