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

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

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

    https://github.com/apache/flink/pull/3438#discussion_r104446345
  
    --- Diff: 
flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/ProcessFunction.java
 ---
    @@ -19,30 +19,35 @@
     package org.apache.flink.streaming.api.functions;
     
     import org.apache.flink.annotation.PublicEvolving;
    -import org.apache.flink.api.common.functions.Function;
    +import org.apache.flink.api.common.functions.AbstractRichFunction;
     import org.apache.flink.streaming.api.TimeDomain;
     import org.apache.flink.streaming.api.TimerService;
     import org.apache.flink.util.Collector;
     
     /**
      * A function that processes elements of a stream.
      *
    - * <p>The function will be called for every element in the input 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.
    + * <p>For every element in the input stream {@link #processElement(Object, 
Context, Collector)}
    + * is invoked. This can produce zero or more elements as output. 
Implementations can also
    + * query the time and set timers through the provided {@link Context}. For 
firing timers
    + * {@link #onTimer(long, OnTimerContext, Collector)} will be invoked. This 
can again produce
    + * zero or more elements as output and register further timers.
      *
    - * <p>The function will be called for every element in the input stream 
and can produce
    - * zero or more output elements. Contrary to the
    - * {@link org.apache.flink.api.common.functions.FlatMapFunction}, this 
function can also query
    - * the time (both event and processing) and set timers, through the 
provided {@link Context}.
    - * When reacting to the firing of set timers the function can directly 
emit a result, and/or
    - * register a timer that will trigger an action in the future.
    + * <p><b>NOTE:</b> Access to keyed state and timers (which are also scoped 
to a key) is only
    + * available if the {@code ProcessFunction} is applied on a {@code 
KeyedStream}.
    + *
    + * <p><b>NOTE:</b> A {@code ProcessFunction} is always a
    + * {@link org.apache.flink.api.common.functions.RichFunction}. Therefore, 
access to the
    + * {@link org.apache.flink.api.common.functions.RuntimeContext} as always 
available and setup and
    + * teardown methods can be implemented. See
    + * {@link 
org.apache.flink.api.common.functions.RichFunction#open(org.apache.flink.configuration.Configuration)}
    + * and {@link org.apache.flink.api.common.functions.RichFunction#close()}.
      *
      * @param <I> Type of the input elements.
      * @param <O> Type of the output elements.
      */
     @PublicEvolving
    -public interface ProcessFunction<I, O> extends Function {
    +public abstract class ProcessFunction<I, O> extends AbstractRichFunction {
    --- End diff --
    
    hi @wenlong88 in the ML discussion 
(https://lists.apache.org/thread.html/f3fe7d68986877994ad6b66173f40e72fc454420720a74ea5a834cc2@%3Cdev.flink.apache.org%3E)
 we decided to make `ProcessFunction` available on non-keyed streams as well to 
allow using side outputs there. This requires making the `onTimer()` method 
abstract, otherwise every user would always have to implement it. We marked 
`ProcessFunction` as `@PublicEvolcing` just for such cases; it's still a very 
young API and we didn't know exactly what was going to be needed in the end.


> Side Outputs in Flink
> ---------------------
>
>                 Key: FLINK-4460
>                 URL: https://issues.apache.org/jira/browse/FLINK-4460
>             Project: Flink
>          Issue Type: New Feature
>          Components: Core, DataStream API
>    Affects Versions: 1.2.0, 1.1.3
>            Reporter: Chen Qin
>            Assignee: Chen Qin
>              Labels: latearrivingevents, sideoutput
>
> https://docs.google.com/document/d/1vg1gpR8JL4dM07Yu4NyerQhhVvBlde5qdqnuJv4LcV4/edit?usp=sharing



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to