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



##########
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:
       side comment: This API looks very ugly and we should not document it 
like this. I also saw it in our tests and didn't like it. How about we 
introduce a `TableResult.awaitCompletion(timeout)`? For DCL and DDL, it would 
continue immediately.




----------------------------------------------------------------
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:
us...@infra.apache.org


Reply via email to