liyubin117 commented on code in PR #21182:
URL: https://github.com/apache/flink/pull/21182#discussion_r1044035987


##########
flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/TableEnvironmentImpl.java:
##########
@@ -1600,23 +1619,34 @@ private Object[][] buildTableColumns(ResolvedSchema 
schema) {
                                                             "PRI(%s)",
                                                             String.join(", ", 
columns))));
                         });
-
+        boolean nonComments = isSchemaNonColumnComments(schema);
         return schema.getColumns().stream()
                 .map(
                         (c) -> {
                             final LogicalType logicalType = 
c.getDataType().getLogicalType();
-                            return new Object[] {
-                                c.getName(),
-                                logicalType.copy(true).asSummaryString(),
-                                logicalType.isNullable(),
-                                fieldToPrimaryKey.getOrDefault(c.getName(), 
null),
-                                c.explainExtras().orElse(null),
-                                fieldToWatermark.getOrDefault(c.getName(), 
null)
-                            };
+                            final ArrayList<Object> result =
+                                    new ArrayList<>(
+                                            Arrays.asList(
+                                                    c.getName(),
+                                                    
logicalType.copy(true).asSummaryString(),
+                                                    logicalType.isNullable(),
+                                                    
fieldToPrimaryKey.getOrDefault(
+                                                            c.getName(), null),
+                                                    
c.explainExtras().orElse(null),
+                                                    
fieldToWatermark.getOrDefault(
+                                                            c.getName(), 
null)));
+                            if (!nonComments) {
+                                result.add(c.getComment().orElse(null));
+                            }
+                            return result.toArray();
                         })
                 .toArray(Object[][]::new);
     }
 
+    private boolean isSchemaNonColumnComments(ResolvedSchema schema) {

Review Comment:
   The solution is to make results compatible with former version, so we could 
make the results simpler, also don't need to modify plenty of test cases.



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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to