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



##########
File path: 
flink-table/flink-sql-client/src/main/java/org/apache/flink/table/client/cli/CliClient.java
##########
@@ -781,6 +626,51 @@ private void callDdl(String ddl, String successMessage, 
String errorMessage) {
 
     // 
--------------------------------------------------------------------------------------------
 
+    private void callShowResult(SqlCommandCall cmdCall, boolean useCommand, 
boolean isSorted) {
+        final List<String> results;
+        try {
+            results =
+                    CollectionUtil.iteratorToList(
+                                    executor.executeSql(
+                                                    sessionId,
+                                                    useCommand
+                                                            ? 
cmdCall.command.toString()
+                                                            : 
cmdCall.operands[0])
+                                            .collect())
+                            .stream()
+                            .map(r -> checkNotNull(r.getField(0)).toString())
+                            .collect(Collectors.toList());
+        } catch (SqlExecutionException e) {
+            printExecutionException(e);
+            return;
+        }
+        if (results.isEmpty()) {
+            
terminal.writer().println(CliStrings.messageInfo(CliStrings.MESSAGE_EMPTY).toAnsi());
+        } else {
+            if (isSorted) {
+                Collections.sort(results);

Review comment:
       If we have sorted requirement, this should be sorted by 
TableEnvironment. The SQL Client should be a simple wrapper on TableEnv. 




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