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

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

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

    https://github.com/apache/flink/pull/5481#discussion_r171237136
  
    --- Diff: 
flink-streaming-scala/src/main/scala/org/apache/flink/streaming/api/scala/KeyedStream.scala
 ---
    @@ -79,7 +78,34 @@ class KeyedStream[T, K](javaStream: KeyedJavaStream[T, 
K]) extends DataStream[T]
     
         asScalaStream(javaStream.process(processFunction, 
implicitly[TypeInformation[R]]))
       }
    -  
    +
    +  /**
    +   * Applies the given [[KeyedProcessFunction]] on the input stream, 
thereby
    +   * creating a transformed output stream.
    +   *
    +   * The function will be called for every element in the stream and can 
produce
    +   * zero or more output. The function can also query the time and set 
timers. When
    +   * reacting to the firing of set timers the function can emit yet more 
elements.
    +   *
    +   * The function will be called for every element in the input streams 
and can produce zero
    +   * or more output elements. Contrary to the 
[[DataStream#flatMap(FlatMapFunction)]]
    +   * function, this function can also query the time and set timers. When 
reacting to the firing
    +   * of set timers the function can directly emit elements and/or register 
yet more timers.
    +   *
    +   * @param keyedProcessFunction The [[KeyedProcessFunction]] that is 
called for each element
    +   *                             in the stream.
    +   */
    +  @PublicEvolving
    +  def process[K, R: TypeInformation](
    +    keyedProcessFunction: KeyedProcessFunction[K, T, R]): DataStream[R] = {
    +
    +    if (keyedProcessFunction == null) {
    +      throw new NullPointerException("ProcessFunction must not be null.")
    +    }
    --- End diff --
    
    The message now should be `"KeyedProcessFunction must not be null."`


> add KeyedProcessFunction to expose the key in onTimer() and other methods
> -------------------------------------------------------------------------
>
>                 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