TsReaper commented on a change in pull request #12199:
URL: https://github.com/apache/flink/pull/12199#discussion_r426477145



##########
File path: 
flink-table/flink-table-common/src/main/java/org/apache/flink/table/utils/PrintUtils.java
##########
@@ -124,17 +134,22 @@ public static void printAsTableauForm(
        }
 
        public static String[] rowToString(Row row) {
-               return rowToString(row, NULL_COLUMN);
+               return rowToString(row, NULL_COLUMN, false);
        }
 
-       public static String[] rowToString(Row row, String nullColumn) {
-               final String[] fields = new String[row.getArity()];
+       public static String[] rowToString(Row row, String nullColumn, boolean 
printChangeMode) {
+               final int len = printChangeMode ? row.getArity() + 1 : 
row.getArity();
+               final String[] fields = new String[len];
+               int index = 0;
+               if (printChangeMode) {
+                       fields[index++] = row.getKind().shortString();
+               }
                for (int i = 0; i < row.getArity(); i++) {
                        final Object field = row.getField(i);
                        if (field == null) {
-                               fields[i] = nullColumn;
+                               fields[index++] = nullColumn;
                        } else {
-                               fields[i] = 
StringUtils.arrayAwareToString(field);
+                               fields[index++] = 
StringUtils.arrayAwareToString(field);

Review comment:
       Change this to `List<String> fields` and `add` to it. Directly 
maintaining the `index` is sort of hard to read.




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