leonardBang commented on a change in pull request #15658: URL: https://github.com/apache/flink/pull/15658#discussion_r616374968
########## File path: flink-table/flink-table-common/src/main/java/org/apache/flink/table/utils/PrintUtils.java ########## @@ -174,27 +215,238 @@ public static void printAsTableauForm( printWriter.flush(); } - public static String[] rowToString(Row row) { - return rowToString(row, NULL_COLUMN, false); + public static String[] rowToString( + Row row, ResolvedSchema resolvedSchema, ZoneId sessionTimeZone) { + return rowToString(row, NULL_COLUMN, false, resolvedSchema, sessionTimeZone); } - public static String[] rowToString(Row row, String nullColumn, boolean printRowKind) { + public static String[] rowToString( + Row row, + String nullColumn, + boolean printRowKind, + ResolvedSchema resolvedSchema, + ZoneId sessionTimeZone) { final int len = printRowKind ? row.getArity() + 1 : row.getArity(); final List<String> fields = new ArrayList<>(len); if (printRowKind) { fields.add(row.getKind().shortString()); } for (int i = 0; i < row.getArity(); i++) { final Object field = row.getField(i); + final LogicalType fieldType = + resolvedSchema.getColumnDataTypes().get(i).getLogicalType(); if (field == null) { fields.add(nullColumn); } else { - fields.add(StringUtils.arrayAwareToString(field)); + fields.add( + StringUtils.arrayAwareToString( + normalizeTimestamp(field, fieldType, sessionTimeZone))); } } return fields.toArray(new String[0]); } + /** + * Normalizes field that contains TIMESTAMP and TIMESTAMP_LTZ type data. + * + * <p>This method supports array type and nested type. + */ + private static Object normalizeTimestamp( Review comment: After discussion with Jark, we think we can refactor this in the future by adding a string representation for all internal data structure (i.e. RowData), in this way we can reuse the string representation for output and planner codegen -- 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