wuchong commented on a change in pull request #15340:
URL: https://github.com/apache/flink/pull/15340#discussion_r602846458



##########
File path: 
flink-table/flink-sql-client/src/main/java/org/apache/flink/table/client/cli/CliClient.java
##########
@@ -414,25 +418,33 @@ private void callSelect(QueryOperation operation) {
     private boolean callInsert(CatalogSinkModifyOperation operation) {
         printInfo(CliStrings.MESSAGE_SUBMITTING_STATEMENT);
 
+        TableResult tableResult = null;
+        boolean sync = 
executor.getSessionConfig(sessionId).get(TABLE_DML_SYNC);
+        String message;
+        if (sync) {
+            printInfo(MESSAGE_WAIT_EXECUTE);
+            message = MESSAGE_FINISH_STATEMENT;
+        } else {
+            message = MESSAGE_STATEMENT_SUBMITTED;
+        }
         try {
-            TableResult result = executor.executeOperation(sessionId, 
operation);
-            checkState(result.getJobClient().isPresent());
-            terminal.writer()
-                    .println(
-                            
CliStrings.messageInfo(CliStrings.MESSAGE_STATEMENT_SUBMITTED)
-                                    .toAnsi());
+            tableResult = executor.executeOperation(sessionId, operation);
+            checkState(tableResult.getJobClient().isPresent());
+            
terminal.writer().println(CliStrings.messageInfo(message).toAnsi());
+
             // keep compatibility with before
             terminal.writer()
                     .println(
                             String.format(
                                     "Job ID: %s\n",
-                                    
result.getJobClient().get().getJobID().toString()));
+                                    
tableResult.getJobClient().get().getJobID().toString()));

Review comment:
       I think we don't need to print the job id at sync mode, the job id looks 
redundant because job has been finished. 

##########
File path: flink-table/flink-sql-client/src/test/resources/sql/insert.q
##########
@@ -0,0 +1,112 @@
+# insert.q - insert
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to you under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+SET sql-client.execution.result-mode = tableau;
+[INFO] Session property has been set.
+!info
+
+SET table.dml-sync=true;
+[INFO] Session property has been set.
+!info
+
+# ==========================================================================
+# test streaming insert
+# ==========================================================================
+
+SET execution.runtime-mode = streaming;
+[INFO] Session property has been set.
+!info
+
+create table StreamingTable (
+  id int,
+  str string
+) with (
+  'connector' = 'filesystem',
+  'path' = '$VAR_STREAMING_PATH',
+  'format' = 'csv'
+);
+[INFO] Execute statement succeed.
+!info
+
+INSERT INTO StreamingTable SELECT * FROM (VALUES (1, 'Hello World'), (2, 
'Hi'), (2, 'Hi'), (3, 'Hello'), (3, 'World'), (4, 'ADD'), (5, 'LINE'));
+[INFO] Submitting SQL update statement to the cluster...
+[INFO] Execute statement in sync mode. Please wait for the execution finish...
+[INFO] Complete execution of the SQL update statement.
+Job ID:
+
+!info
+
+SELECT id, COUNT(*) as cnt, COUNT(DISTINCT str) as uv
+FROM StreamingTable
+GROUP BY id;
++----+-------------+----------------------+----------------------+
+| op |          id |                  cnt |                   uv |
++----+-------------+----------------------+----------------------+
+| +I |           1 |                    1 |                    1 |
+| +I |           2 |                    1 |                    1 |
+| -U |           2 |                    1 |                    1 |
+| +U |           2 |                    2 |                    1 |
+| +I |           3 |                    1 |                    1 |
+| -U |           3 |                    1 |                    1 |
+| +U |           3 |                    2 |                    2 |
+| +I |           4 |                    1 |                    1 |
+| +I |           5 |                    1 |                    1 |
++----+-------------+----------------------+----------------------+

Review comment:
       The changelog is harder to verify. I think a simple `SELECT *` is 
enough, beacuse we jusst need to verify the all the data has been inserted. 




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