Github user alpinegizmo commented on a diff in the pull request:
https://github.com/apache/flink/pull/4634#discussion_r137000137
--- Diff: docs/dev/stream/operators/windows.md ---
@@ -663,25 +623,42 @@ input
.keyBy(<key selector>)
.window(<window assigner>)
.process(new MyProcessWindowFunction())
+
+/* ... */
+
+class MyWindowFunction extends ProcessWindowFunction[(String, Long),
String, String, TimeWindow] {
+
+ def apply(key: String, context: Context, input: Iterable[(String,
Long)], out: Collector[String]): () = {
+ var count = 0L
+ for (in <- input) {
+ count = count + 1
+ }
+ out.collect(s"Window ${context.window} count: $count")
+ }
+}
{% endhighlight %}
</div>
</div>
-### WindowFunction with Incremental Aggregation
+The example shows a `ProcessWindowFunction` that counts the elements in a
window. In addition, the window function adds information about the window to
the output.
+
+<span class="label label-danger">Attention</span> Note that using
`ProcessWindowFunction` for simple aggregates such as count is quite
inefficient. The next section shows how a `ReduceFunction` can be combined with
a `ProcessWindowFunction` to get both incremental aggregation and the added
information of a `ProcessWindowFunction`.
-A `WindowFunction` can be combined with either a `ReduceFunction` or a
`FoldFunction` to
+### ProcessWindowFunction with Incremental Aggregation
+
+A `ProcessWindowFunction` can be combined with either a `ReduceFunction`
or a `FoldFunction` to
--- End diff --
Sure, that sounds fine.
---