You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by al...@apache.org on 2017/09/05 16:07:25 UTC
[5/5] flink git commit: [FLINK-7568] Update ProcessFunction.Context
in window documentation
[FLINK-7568] Update ProcessFunction.Context in window documentation
Project: http://git-wip-us.apache.org/repos/asf/flink/repo
Commit: http://git-wip-us.apache.org/repos/asf/flink/commit/006572f4
Tree: http://git-wip-us.apache.org/repos/asf/flink/tree/006572f4
Diff: http://git-wip-us.apache.org/repos/asf/flink/diff/006572f4
Branch: refs/heads/master
Commit: 006572f4031eaaca586f789f103297bbc10dab77
Parents: 9fe8f21
Author: Aljoscha Krettek <al...@gmail.com>
Authored: Fri Sep 1 12:28:13 2017 +0200
Committer: Aljoscha Krettek <al...@gmail.com>
Committed: Tue Sep 5 17:33:47 2017 +0200
----------------------------------------------------------------------
docs/dev/stream/operators/windows.md | 63 ++++++++++++++++++++++++++-----
1 file changed, 53 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flink/blob/006572f4/docs/dev/stream/operators/windows.md
----------------------------------------------------------------------
diff --git a/docs/dev/stream/operators/windows.md b/docs/dev/stream/operators/windows.md
index 4cfebf2..63113b6 100644
--- a/docs/dev/stream/operators/windows.md
+++ b/docs/dev/stream/operators/windows.md
@@ -491,15 +491,35 @@ public abstract class ProcessWindowFunction<IN, OUT, KEY, W extends Window> impl
Iterable<IN> elements,
Collector<OUT> out) throws Exception;
- /**
- * The context holding window metadata
- */
- public abstract class Context {
- /**
- * @return The window that is being evaluated.
- */
- public abstract W window();
- }
+ /**
+ * The context holding window metadata.
+ */
+ public abstract class Context implements java.io.Serializable {
+ /**
+ * Returns the window that is being evaluated.
+ */
+ public abstract W window();
+
+ /** Returns the current processing time. */
+ public abstract long currentProcessingTime();
+
+ /** Returns the current event-time watermark. */
+ public abstract long currentWatermark();
+
+ /**
+ * State accessor for per-key and per-window state.
+ *
+ * <p><b>NOTE:</b>If you use per-window state you have to ensure that you clean it up
+ * by implementing {@link ProcessWindowFunction#clear(Context)}.
+ */
+ public abstract KeyedStateStore windowState();
+
+ /**
+ * State accessor for per-key global state.
+ */
+ public abstract KeyedStateStore globalState();
+ }
+
}
{% endhighlight %}
</div>
@@ -528,15 +548,38 @@ abstract class ProcessWindowFunction[IN, OUT, KEY, W <: Window] extends Function
*/
abstract class Context {
/**
- * @return The window that is being evaluated.
+ * Returns the window that is being evaluated.
*/
def window: W
+
+ /**
+ * Returns the current processing time.
+ */
+ def currentProcessingTime: Long
+
+ /**
+ * Returns the current event-time watermark.
+ */
+ def currentWatermark: Long
+
+ /**
+ * State accessor for per-key and per-window state.
+ */
+ def windowState: KeyedStateStore
+
+ /**
+ * State accessor for per-key global state.
+ */
+ def globalState: KeyedStateStore
}
+
}
{% endhighlight %}
</div>
</div>
+
+
A `ProcessWindowFunction` can be defined and used like this:
<div class="codetabs" markdown="1">