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



##########
File path: docs/try-flink/table_api.md
##########
@@ -462,14 +469,17 @@ public class SpendReport {
         tEnv.registerTableSource("transactions", new 
UnboundedTransactionTableSource());
         tEnv.registerTableSink("spend_report", new SpendReportTableSink());
 
-        tEnv
+        Table table = tEnv
             .scan("transactions")
             .window(Tumble.over("1.hour").on("timestamp").as("w"))
             .groupBy("accountId, w")
-            .select("accountId, w.start as timestamp, amount.sum")
-            .insertInto("spend_report");
+            .select("accountId, w.start as timestamp, amount.sum");
 
-        env.execute("Spend Report");
+        // trigger execution
+        TableResult tableResult = table.executeInsert("spend_report");
+        // wait job finished
+        tableResult.getJobClient().get()

Review comment:
       Yes, I think the behavior is fine. Maybe we can express it in a better 
name and definition. How about `TableResult.await()` that "waits until a result 
is ready"? Either the result is ready through `collect` or for INSERT INTO the 
result is ready once the job is completed and the number of rows is returned 
(at least this is the case for batch and would be the same for streaming in the 
future).




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