sjwiesman commented on a change in pull request #13384:
URL: https://github.com/apache/flink/pull/13384#discussion_r489576296



##########
File path: docs/dev/libs/state_processor_api.md
##########
@@ -345,6 +345,44 @@ Along with reading registered state values, each key has 
access to a `Context` w
 
 {% panel **Note:** When using a `KeyedStateReaderFunction`, all state 
descriptors must be registered eagerly inside of open. Any attempt to call a 
`RuntimeContext#get*State` will result in a `RuntimeException`. %}
 
+### Window State
+
+The state processor api supports reading state from a [window operator]({{ 
site.baseurl }}/dev/stream/operators/windows.html).
+This includes both time based windows along with other types, pre-aggregation, 
non-aggregated, and windows with evictors.
+
+<div class="codetabs" markdown="1">
+<div data-lang="java" markdown="1">
+{% highlight java %}
+
+ExecutionEnvironment batchEnv = ExecutionEnvironment.getExecutionEnvironment();
+ExistingSavepoint savepoint = Savepoint.load(batchEnv, 
"hdfs://checkpoint-dir", new MemoryStateBackend());
+
+int count = savepoint
+    // The timeWindow method supports reading from any type of time based 
window, including but not limited to
+    // Tumbling, Sliding, and Session windows for both event time and 
processing time.
+    .timeWindow()
+    .reduce(uid, new ReduceSum(), Types.INT, Types.INT)
+    .count();

Review comment:
       `count` is a dataset feature. Will remove. 




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to