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



##########
File path: 
flink-table/flink-table-common/src/main/java/org/apache/flink/table/utils/PrintUtils.java
##########
@@ -116,65 +116,60 @@ public static void printAsTableauForm(
             String nullColumn,
             boolean deriveColumnWidthByType,
             boolean printRowKind) {
-        final List<TableColumn> columns = tableSchema.getTableColumns();
-        String[] columnNames = 
columns.stream().map(TableColumn::getName).toArray(String[]::new);
-        if (printRowKind) {
-            columnNames =
-                    Stream.concat(Stream.of(ROW_KIND_COLUMN), 
Arrays.stream(columnNames))
-                            .toArray(String[]::new);
-        }
-
-        final int[] colWidths;
-        if (deriveColumnWidthByType) {
-            colWidths =
-                    columnWidthsByType(
-                            columns,
-                            maxColumnWidth,
-                            nullColumn,
-                            printRowKind ? ROW_KIND_COLUMN : null);
-        } else {
-            final List<Row> rows = new ArrayList<>();
-            final List<String[]> content = new ArrayList<>();
-            content.add(columnNames);
-            while (it.hasNext()) {
-                Row row = it.next();
-                rows.add(row);
-                content.add(rowToString(row, nullColumn, printRowKind));
+        if (it.hasNext()) {

Review comment:
       Personally, I don't like big if else block. Could you return the method 
when it is emtpy? 
   
   

##########
File path: 
flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/TableEnvironmentImpl.java
##########
@@ -628,12 +628,19 @@ public boolean dropTemporaryView(String path) {
 
     @Override
     public String[] listUserDefinedFunctions() {
-        return functionCatalog.getUserDefinedFunctions();
+        return sortFunctions(functionCatalog.getUserDefinedFunctions());
     }
 
     @Override
     public String[] listFunctions() {
-        return functionCatalog.getFunctions();
+        return sortFunctions(functionCatalog.getFunctions());

Review comment:
       I think we can simply `Arrays.sort(functionCatalog.getFunctions())`. The 
returned `getFunctions` should never be null. 




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