flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From KurtYoung <...@git.apache.org>
Subject [GitHub] flink pull request #3510: [FLINK-6023] Fix Scala snippet into Process Functi...
Date Fri, 10 Mar 2017 15:32:02 GMT
Github user KurtYoung commented on a diff in the pull request:

    https://github.com/apache/flink/pull/3510#discussion_r105419777
  
    --- Diff: docs/dev/stream/process_function.md ---
    @@ -176,56 +176,57 @@ public class CountWithTimeoutFunction extends RichProcessFunction<Tuple2<String,
     
     <div data-lang="scala" markdown="1">
     {% highlight scala %}
    -import org.apache.flink.api.common.state.ValueState;
    -import org.apache.flink.api.common.state.ValueStateDescriptor;
    -import org.apache.flink.streaming.api.functions.ProcessFunction;
    -import org.apache.flink.streaming.api.functions.ProcessFunction.Context;
    -import org.apache.flink.streaming.api.functions.ProcessFunction.OnTimerContext;
    -import org.apache.flink.util.Collector;
    +import org.apache.flink.api.common.state.ValueState
    +import org.apache.flink.api.common.state.ValueStateDescriptor
    +import org.apache.flink.streaming.api.functions.RichProcessFunction
    +import org.apache.flink.streaming.api.functions.ProcessFunction.Context
    +import org.apache.flink.streaming.api.functions.ProcessFunction.OnTimerContext
    +import org.apache.flink.util.Collector
     
     // the source data stream
    -DataStream<Tuple2<String, String>> stream = ...;
    +val stream: DataStream[Tuple2[String, String]] = ...
     
     // apply the process function onto a keyed stream
    -DataStream<Tuple2<String, Long>> result = stream
    -    .keyBy(0)
    -    .process(new CountWithTimeoutFunction());
    +val result: DataStream[Tuple2[String, Long]] = stream
    +  .keyBy(0)
    +  .process(new CountWithTimeoutFunction())
     
     /**
    - * The data type stored in the state
    - */
    +  * The data type stored in the state
    +  */
     case class CountWithTimestamp(key: String, count: Long, lastModified: Long)
     
     /**
    - * The implementation of the ProcessFunction that maintains the count and timeouts
    - */
    -class TimeoutStateFunction extends ProcessFunction[(String, Long), (String, Long)] {
    +  * The implementation of the ProcessFunction that maintains the count and timeouts
    +  */
    +class TimeoutStateFunction extends RichProcessFunction[(String, Long), (String, Long)]
{
    --- End diff --
    
    The class name should change to CountWithTimeoutFunction to be consistency with java


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message