You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2018/11/15 12:21:51 UTC

[GitHub] zentol closed pull request #6625: [hotfix][docs] Fix some error about the example of stateful source function in state documentatition

zentol closed pull request #6625: [hotfix][docs] Fix some error about the example of stateful source function in state documentatition
URL: https://github.com/apache/flink/pull/6625
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/docs/dev/stream/state/state.md b/docs/dev/stream/state/state.md
index fb787763536..573018d2717 100644
--- a/docs/dev/stream/state/state.md
+++ b/docs/dev/stream/state/state.md
@@ -632,12 +632,12 @@ on failure/recovery), the user is required to get a lock from the source's conte
 <div class="codetabs" markdown="1">
 <div data-lang="java" markdown="1">
 {% highlight java %}
-public static class CounterSource
+public class CounterSource
         extends RichParallelSourceFunction<Long>
         implements ListCheckpointed<Long> {
 
     /**  current offset for exactly once semantics */
-    private Long offset;
+    private Long offset = 0L;
 
     /** flag for job cancellation */
     private volatile boolean isRunning = true;
@@ -668,7 +668,7 @@ public static class CounterSource
     @Override
     public void restoreState(List<Long> state) {
         for (Long s : state)
-            offset = s;
+            offset += s;
     }
 }
 {% endhighlight %}
@@ -702,7 +702,7 @@ class CounterSource
 
   override def restoreState(state: util.List[Long]): Unit =
     for (s <- state) {
-      offset = s
+      offset += s
     }
 
   override def snapshotState(checkpointId: Long, timestamp: Long): util.List[Long] =


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services