twalthr commented on a change in pull request #16871:
URL: https://github.com/apache/flink/pull/16871#discussion_r700774083



##########
File path: docs/content/docs/dev/table/data_stream_api.md
##########
@@ -337,6 +324,86 @@ In particular, the section discusses how to influence the 
schema derivation with
 types. It covers working with event-time and watermarks. It discusses how to 
declare a primary key and
 changelog mode for the input and output streams.
 
+The example above shows how the final result is computed incrementally by 
continuously emitting row-wise
+updates for each incoming record. However, in cases where the input streams 
are finite (i.e. *bounded*),
+a result can be computed more efficiently by leveraging batch processing 
principles. Both DataStream
+API and Table API offer a specialized *batch runtime mode*.
+
+The following example illustrates that the unified pipeline is able to process 
both batch and streaming data
+by just switching a flag.
+
+{{< tabs "61a8a0b8-c38b-48f3-b52e-563546139380" >}}
+{{< tab "Java" >}}
+```java
+import org.apache.flink.api.common.RuntimeExecutionMode;
+import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
+import org.apache.flink.table.api.bridge.java.StreamTableEnvironment;
+
+// setup DataStream API
+StreamExecutionEnvironment env = 
StreamExecutionEnvironment.getExecutionEnvironment();
+
+// set the batch runtime mode
+env.setRuntimeMode(RuntimeExecutionMode.BATCH);
+
+// uncomment this for streaming mode
+// env.setRuntimeMode(RuntimeExecutionMode.STREAMING);
+
+// setup Table API
+// the table environment adopts the runtime mode during initialization
+StreamTableEnvironment tableEnv = StreamTableEnvironment.create(env);
+
+// define the same pipeline as above
+
+// prints in BATCH mode:
+// +I[Bob, 10]
+// +I[Alice, 112]
+
+// prints in STREAMING mode:
+// +I[Alice, 12]
+// +I[Bob, 10]
+// -U[Alice, 12]
+// +U[Alice, 112]

Review comment:
       I would leave it as a code comment here because this is only a page for 
integration with DataStream API. I don't want to cover all details about how 
changelog processing works. This should be a dedicated page that requires a lot 
of thought. Also what switching to batch mode means actually belongs on a 
different "concepts" page, but I briefly explained it here to have at least 
something.




-- 
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: [email protected]

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


Reply via email to