Zakelly commented on code in PR #25996:
URL: https://github.com/apache/flink/pull/25996#discussion_r1919476870


##########
flink-examples/flink-examples-streaming/src/main/java/org/apache/flink/streaming/examples/windowing/WindowWordCount.java:
##########
@@ -118,15 +129,33 @@ public static void main(String[] args) throws Exception {
                         // Using a keyBy allows performing aggregations and 
other
                         // stateful transformations over data on a per-key 
basis.
                         // This is similar to a GROUP BY clause in a SQL query.
-                        .keyBy(value -> value.f0)
-                        // create windows of windowSize records slided every 
slideSize records
-                        .countWindow(windowSize, slideSize)
-                        // For each key, we perform a simple sum of the "1" 
field, the count.
-                        // If the input data set is bounded, sum will output a 
final count for
-                        // each word. If it is unbounded, it will continuously 
output updates
-                        // each time it sees a new instance of each word in 
the stream.
-                        .sum(1)
-                        .name("counter");
+                        .keyBy(value -> value.f0);
+
+        DataStream<Tuple2<String, Integer>> counts;
+        if (params.isAsyncState()) {
+            counts =
+                    keyedStream
+                            .enableAsyncState()
+                            // create windows of windowSize records slided 
every slideSize records
+                            .asyncCountWindow(windowSize, slideSize)

Review Comment:
   Ah.... we won't provide new API for user. Only `countWindow` combined with 
`enableAsyncState` is enough.



-- 
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.

To unsubscribe, e-mail: issues-unsubscr...@flink.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to